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 */
81 #ifdef CONFIG_SND_DEBUG
85 ALC260_MODEL_LAST
/* last tag */
95 ALC262_HP_BPC_D7000_WL
,
96 ALC262_HP_BPC_D7000_WF
,
108 ALC262_MODEL_LAST
/* last tag */
117 ALC268_ACER_ASPIRE_ONE
,
120 #ifdef CONFIG_SND_DEBUG
124 ALC268_MODEL_LAST
/* last tag */
131 ALC269_ASUS_EEEPC_P703
,
132 ALC269_ASUS_EEEPC_P901
,
134 ALC269_MODEL_LAST
/* last tag */
151 /* ALC861-VD models */
172 ALC662_ASUS_EEEPC_P701
,
173 ALC662_ASUS_EEEPC_EP20
,
212 ALC883_TARGA_2ch_DIG
,
218 ALC883_LENOVO_101E_2ch
,
219 ALC883_LENOVO_NB0763
,
220 ALC888_LENOVO_MS7195_DIG
,
227 ALC883_FUJITSU_PI2515
,
228 ALC883_3ST_6ch_INTEL
,
236 #define GPIO_MASK 0x03
239 /* codec parameterization */
240 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
241 unsigned int num_mixers
;
243 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
247 unsigned int num_init_verbs
;
249 char *stream_name_analog
; /* analog PCM stream */
250 struct hda_pcm_stream
*stream_analog_playback
;
251 struct hda_pcm_stream
*stream_analog_capture
;
252 struct hda_pcm_stream
*stream_analog_alt_playback
;
253 struct hda_pcm_stream
*stream_analog_alt_capture
;
255 char *stream_name_digital
; /* digital PCM stream */
256 struct hda_pcm_stream
*stream_digital_playback
;
257 struct hda_pcm_stream
*stream_digital_capture
;
260 struct hda_multi_out multiout
; /* playback set-up
261 * max_channels, dacs must be set
262 * dig_out_nid and hp_nid are optional
264 hda_nid_t alt_dac_nid
;
267 unsigned int num_adc_nids
;
269 hda_nid_t
*capsrc_nids
;
270 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
273 unsigned int num_mux_defs
;
274 const struct hda_input_mux
*input_mux
;
275 unsigned int cur_mux
[3];
278 const struct hda_channel_mode
*channel_mode
;
279 int num_channel_mode
;
282 /* PCM information */
283 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
285 /* dynamic controls, init_verbs and input_mux */
286 struct auto_pin_cfg autocfg
;
287 unsigned int num_kctl_alloc
, num_kctl_used
;
288 struct snd_kcontrol_new
*kctl_alloc
;
289 struct hda_input_mux private_imux
;
290 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
293 void (*init_hook
)(struct hda_codec
*codec
);
294 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
296 /* for pin sensing */
297 unsigned int sense_updated
: 1;
298 unsigned int jack_present
: 1;
299 unsigned int master_sw
: 1;
301 /* for virtual master */
302 hda_nid_t vmaster_nid
;
303 #ifdef CONFIG_SND_HDA_POWER_SAVE
304 struct hda_loopback_check loopback
;
309 unsigned int pll_coef_idx
, pll_coef_bit
;
313 * configuration template - to be copied to the spec instance
315 struct alc_config_preset
{
316 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
319 const struct hda_verb
*init_verbs
[5];
320 unsigned int num_dacs
;
322 hda_nid_t dig_out_nid
; /* optional */
323 hda_nid_t hp_nid
; /* optional */
324 unsigned int num_adc_nids
;
326 hda_nid_t
*capsrc_nids
;
327 hda_nid_t dig_in_nid
;
328 unsigned int num_channel_mode
;
329 const struct hda_channel_mode
*channel_mode
;
331 unsigned int num_mux_defs
;
332 const struct hda_input_mux
*input_mux
;
333 void (*unsol_event
)(struct hda_codec
*, unsigned int);
334 void (*init_hook
)(struct hda_codec
*);
335 #ifdef CONFIG_SND_HDA_POWER_SAVE
336 struct hda_amp_list
*loopbacks
;
344 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
345 struct snd_ctl_elem_info
*uinfo
)
347 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
348 struct alc_spec
*spec
= codec
->spec
;
349 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
350 if (mux_idx
>= spec
->num_mux_defs
)
352 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
355 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
356 struct snd_ctl_elem_value
*ucontrol
)
358 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
359 struct alc_spec
*spec
= codec
->spec
;
360 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
362 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
366 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
367 struct snd_ctl_elem_value
*ucontrol
)
369 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
370 struct alc_spec
*spec
= codec
->spec
;
371 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
372 unsigned int mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
373 hda_nid_t nid
= spec
->capsrc_nids
?
374 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
375 return snd_hda_input_mux_put(codec
, &spec
->input_mux
[mux_idx
], ucontrol
,
376 nid
, &spec
->cur_mux
[adc_idx
]);
381 * channel mode setting
383 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
384 struct snd_ctl_elem_info
*uinfo
)
386 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
387 struct alc_spec
*spec
= codec
->spec
;
388 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
389 spec
->num_channel_mode
);
392 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
393 struct snd_ctl_elem_value
*ucontrol
)
395 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
396 struct alc_spec
*spec
= codec
->spec
;
397 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
398 spec
->num_channel_mode
,
399 spec
->multiout
.max_channels
);
402 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
403 struct snd_ctl_elem_value
*ucontrol
)
405 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
406 struct alc_spec
*spec
= codec
->spec
;
407 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
408 spec
->num_channel_mode
,
409 &spec
->multiout
.max_channels
);
410 if (err
>= 0 && spec
->need_dac_fix
)
411 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
416 * Control the mode of pin widget settings via the mixer. "pc" is used
417 * instead of "%" to avoid consequences of accidently treating the % as
418 * being part of a format specifier. Maximum allowed length of a value is
419 * 63 characters plus NULL terminator.
421 * Note: some retasking pin complexes seem to ignore requests for input
422 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
423 * are requested. Therefore order this list so that this behaviour will not
424 * cause problems when mixer clients move through the enum sequentially.
425 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
428 static char *alc_pin_mode_names
[] = {
429 "Mic 50pc bias", "Mic 80pc bias",
430 "Line in", "Line out", "Headphone out",
432 static unsigned char alc_pin_mode_values
[] = {
433 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
435 /* The control can present all 5 options, or it can limit the options based
436 * in the pin being assumed to be exclusively an input or an output pin. In
437 * addition, "input" pins may or may not process the mic bias option
438 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
439 * accept requests for bias as of chip versions up to March 2006) and/or
440 * wiring in the computer.
442 #define ALC_PIN_DIR_IN 0x00
443 #define ALC_PIN_DIR_OUT 0x01
444 #define ALC_PIN_DIR_INOUT 0x02
445 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
446 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
448 /* Info about the pin modes supported by the different pin direction modes.
449 * For each direction the minimum and maximum values are given.
451 static signed char alc_pin_mode_dir_info
[5][2] = {
452 { 0, 2 }, /* ALC_PIN_DIR_IN */
453 { 3, 4 }, /* ALC_PIN_DIR_OUT */
454 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
455 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
456 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
458 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
459 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
460 #define alc_pin_mode_n_items(_dir) \
461 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
463 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
464 struct snd_ctl_elem_info
*uinfo
)
466 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
467 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
469 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
471 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
473 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
474 item_num
= alc_pin_mode_min(dir
);
475 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
479 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
480 struct snd_ctl_elem_value
*ucontrol
)
483 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
484 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
485 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
486 long *valp
= ucontrol
->value
.integer
.value
;
487 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
488 AC_VERB_GET_PIN_WIDGET_CONTROL
,
491 /* Find enumerated value for current pinctl setting */
492 i
= alc_pin_mode_min(dir
);
493 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
495 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
499 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
500 struct snd_ctl_elem_value
*ucontrol
)
503 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
504 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
505 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
506 long val
= *ucontrol
->value
.integer
.value
;
507 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
508 AC_VERB_GET_PIN_WIDGET_CONTROL
,
511 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
512 val
= alc_pin_mode_min(dir
);
514 change
= pinctl
!= alc_pin_mode_values
[val
];
516 /* Set pin mode to that requested */
517 snd_hda_codec_write_cache(codec
, nid
, 0,
518 AC_VERB_SET_PIN_WIDGET_CONTROL
,
519 alc_pin_mode_values
[val
]);
521 /* Also enable the retasking pin's input/output as required
522 * for the requested pin mode. Enum values of 2 or less are
525 * Dynamically switching the input/output buffers probably
526 * reduces noise slightly (particularly on input) so we'll
527 * do it. However, having both input and output buffers
528 * enabled simultaneously doesn't seem to be problematic if
529 * this turns out to be necessary in the future.
532 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
533 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
534 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
537 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
538 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
539 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
546 #define ALC_PIN_MODE(xname, nid, dir) \
547 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
548 .info = alc_pin_mode_info, \
549 .get = alc_pin_mode_get, \
550 .put = alc_pin_mode_put, \
551 .private_value = nid | (dir<<16) }
553 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
554 * together using a mask with more than one bit set. This control is
555 * currently used only by the ALC260 test model. At this stage they are not
556 * needed for any "production" models.
558 #ifdef CONFIG_SND_DEBUG
559 #define alc_gpio_data_info snd_ctl_boolean_mono_info
561 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
562 struct snd_ctl_elem_value
*ucontrol
)
564 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
565 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
566 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
567 long *valp
= ucontrol
->value
.integer
.value
;
568 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
569 AC_VERB_GET_GPIO_DATA
, 0x00);
571 *valp
= (val
& mask
) != 0;
574 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
575 struct snd_ctl_elem_value
*ucontrol
)
578 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
579 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
580 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
581 long val
= *ucontrol
->value
.integer
.value
;
582 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
583 AC_VERB_GET_GPIO_DATA
,
586 /* Set/unset the masked GPIO bit(s) as needed */
587 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
592 snd_hda_codec_write_cache(codec
, nid
, 0,
593 AC_VERB_SET_GPIO_DATA
, gpio_data
);
597 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
598 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
599 .info = alc_gpio_data_info, \
600 .get = alc_gpio_data_get, \
601 .put = alc_gpio_data_put, \
602 .private_value = nid | (mask<<16) }
603 #endif /* CONFIG_SND_DEBUG */
605 /* A switch control to allow the enabling of the digital IO pins on the
606 * ALC260. This is incredibly simplistic; the intention of this control is
607 * to provide something in the test model allowing digital outputs to be
608 * identified if present. If models are found which can utilise these
609 * outputs a more complete mixer control can be devised for those models if
612 #ifdef CONFIG_SND_DEBUG
613 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
615 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
616 struct snd_ctl_elem_value
*ucontrol
)
618 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
619 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
620 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
621 long *valp
= ucontrol
->value
.integer
.value
;
622 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
623 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
625 *valp
= (val
& mask
) != 0;
628 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
629 struct snd_ctl_elem_value
*ucontrol
)
632 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
633 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
634 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
635 long val
= *ucontrol
->value
.integer
.value
;
636 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
637 AC_VERB_GET_DIGI_CONVERT_1
,
640 /* Set/unset the masked control bit(s) as needed */
641 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
646 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
651 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
652 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
653 .info = alc_spdif_ctrl_info, \
654 .get = alc_spdif_ctrl_get, \
655 .put = alc_spdif_ctrl_put, \
656 .private_value = nid | (mask<<16) }
657 #endif /* CONFIG_SND_DEBUG */
659 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
660 * Again, this is only used in the ALC26x test models to help identify when
661 * the EAPD line must be asserted for features to work.
663 #ifdef CONFIG_SND_DEBUG
664 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
666 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
667 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 *valp
= ucontrol
->value
.integer
.value
;
673 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
674 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
676 *valp
= (val
& mask
) != 0;
680 static int alc_eapd_ctrl_put(struct snd_kcontrol
*kcontrol
,
681 struct snd_ctl_elem_value
*ucontrol
)
684 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
685 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
686 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
687 long val
= *ucontrol
->value
.integer
.value
;
688 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
689 AC_VERB_GET_EAPD_BTLENABLE
,
692 /* Set/unset the masked control bit(s) as needed */
693 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
698 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
704 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
705 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
706 .info = alc_eapd_ctrl_info, \
707 .get = alc_eapd_ctrl_get, \
708 .put = alc_eapd_ctrl_put, \
709 .private_value = nid | (mask<<16) }
710 #endif /* CONFIG_SND_DEBUG */
713 * set up from the preset table
715 static void setup_preset(struct alc_spec
*spec
,
716 const struct alc_config_preset
*preset
)
720 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
721 spec
->mixers
[spec
->num_mixers
++] = preset
->mixers
[i
];
722 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
724 spec
->init_verbs
[spec
->num_init_verbs
++] =
725 preset
->init_verbs
[i
];
727 spec
->channel_mode
= preset
->channel_mode
;
728 spec
->num_channel_mode
= preset
->num_channel_mode
;
729 spec
->need_dac_fix
= preset
->need_dac_fix
;
731 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
733 spec
->multiout
.num_dacs
= preset
->num_dacs
;
734 spec
->multiout
.dac_nids
= preset
->dac_nids
;
735 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
736 spec
->multiout
.hp_nid
= preset
->hp_nid
;
738 spec
->num_mux_defs
= preset
->num_mux_defs
;
739 if (!spec
->num_mux_defs
)
740 spec
->num_mux_defs
= 1;
741 spec
->input_mux
= preset
->input_mux
;
743 spec
->num_adc_nids
= preset
->num_adc_nids
;
744 spec
->adc_nids
= preset
->adc_nids
;
745 spec
->capsrc_nids
= preset
->capsrc_nids
;
746 spec
->dig_in_nid
= preset
->dig_in_nid
;
748 spec
->unsol_event
= preset
->unsol_event
;
749 spec
->init_hook
= preset
->init_hook
;
750 #ifdef CONFIG_SND_HDA_POWER_SAVE
751 spec
->loopback
.amplist
= preset
->loopbacks
;
755 /* Enable GPIO mask and set output */
756 static struct hda_verb alc_gpio1_init_verbs
[] = {
757 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
758 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
759 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
763 static struct hda_verb alc_gpio2_init_verbs
[] = {
764 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
765 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
766 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
770 static struct hda_verb alc_gpio3_init_verbs
[] = {
771 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
772 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
773 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
778 * Fix hardware PLL issue
779 * On some codecs, the analog PLL gating control must be off while
780 * the default value is 1.
782 static void alc_fix_pll(struct hda_codec
*codec
)
784 struct alc_spec
*spec
= codec
->spec
;
789 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
791 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
792 AC_VERB_GET_PROC_COEF
, 0);
793 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
795 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
796 val
& ~(1 << spec
->pll_coef_bit
));
799 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
800 unsigned int coef_idx
, unsigned int coef_bit
)
802 struct alc_spec
*spec
= codec
->spec
;
804 spec
->pll_coef_idx
= coef_idx
;
805 spec
->pll_coef_bit
= coef_bit
;
809 static void alc_sku_automute(struct hda_codec
*codec
)
811 struct alc_spec
*spec
= codec
->spec
;
812 unsigned int present
;
813 unsigned int hp_nid
= spec
->autocfg
.hp_pins
[0];
814 unsigned int sp_nid
= spec
->autocfg
.speaker_pins
[0];
816 /* need to execute and sync at first */
817 snd_hda_codec_read(codec
, hp_nid
, 0, AC_VERB_SET_PIN_SENSE
, 0);
818 present
= snd_hda_codec_read(codec
, hp_nid
, 0,
819 AC_VERB_GET_PIN_SENSE
, 0);
820 spec
->jack_present
= (present
& 0x80000000) != 0;
821 snd_hda_codec_write(codec
, sp_nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
822 spec
->jack_present
? 0 : PIN_OUT
);
825 static void alc_mic_automute(struct hda_codec
*codec
)
827 struct alc_spec
*spec
= codec
->spec
;
828 unsigned int present
;
829 unsigned int mic_nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
830 unsigned int fmic_nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
831 unsigned int mix_nid
= spec
->capsrc_nids
[0];
832 unsigned int capsrc_idx_mic
, capsrc_idx_fmic
;
834 capsrc_idx_mic
= mic_nid
- 0x18;
835 capsrc_idx_fmic
= fmic_nid
- 0x18;
836 present
= snd_hda_codec_read(codec
, mic_nid
, 0,
837 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
838 snd_hda_codec_write(codec
, mix_nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
839 0x7000 | (capsrc_idx_mic
<< 8) | (present
? 0 : 0x80));
840 snd_hda_codec_write(codec
, mix_nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
841 0x7000 | (capsrc_idx_fmic
<< 8) | (present
? 0x80 : 0));
842 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, capsrc_idx_fmic
,
843 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
846 /* unsolicited event for HP jack sensing */
847 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
849 if (codec
->vendor_id
== 0x10ec0880)
853 if (res
== ALC880_HP_EVENT
)
854 alc_sku_automute(codec
);
856 if (res
== ALC880_MIC_EVENT
)
857 alc_mic_automute(codec
);
860 static void alc_inithook(struct hda_codec
*codec
)
862 alc_sku_automute(codec
);
863 alc_mic_automute(codec
);
866 /* additional initialization for ALC888 variants */
867 static void alc888_coef_init(struct hda_codec
*codec
)
871 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
872 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
873 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
874 if ((tmp
& 0xf0) == 2)
876 snd_hda_codec_read(codec
, 0x20, 0,
877 AC_VERB_SET_PROC_COEF
, 0x830);
880 snd_hda_codec_read(codec
, 0x20, 0,
881 AC_VERB_SET_PROC_COEF
, 0x3030);
884 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
885 * 31 ~ 16 : Manufacture ID
887 * 7 ~ 0 : Assembly ID
888 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
890 static void alc_subsystem_id(struct hda_codec
*codec
,
891 unsigned int porta
, unsigned int porte
,
894 unsigned int ass
, tmp
, i
;
896 struct alc_spec
*spec
= codec
->spec
;
898 ass
= codec
->subsystem_id
& 0xffff;
899 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
903 * 31~30 : port conetcivity
906 * 19~16 : Check sum (15:1)
911 if (codec
->vendor_id
== 0x10ec0260)
913 ass
= snd_hda_codec_read(codec
, nid
, 0,
914 AC_VERB_GET_CONFIG_DEFAULT
, 0);
915 if (!(ass
& 1) && !(ass
& 0x100000))
917 if ((ass
>> 30) != 1) /* no physical connection */
922 for (i
= 1; i
< 16; i
++) {
926 if (((ass
>> 16) & 0xf) != tmp
)
932 * 2 : 0 --> Desktop, 1 --> Laptop
933 * 3~5 : External Amplifier control
936 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
939 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
942 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
945 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
947 case 5: /* set EAPD output high */
948 switch (codec
->vendor_id
) {
950 snd_hda_codec_write(codec
, 0x0f, 0,
951 AC_VERB_SET_EAPD_BTLENABLE
, 2);
952 snd_hda_codec_write(codec
, 0x10, 0,
953 AC_VERB_SET_EAPD_BTLENABLE
, 2);
964 snd_hda_codec_write(codec
, 0x14, 0,
965 AC_VERB_SET_EAPD_BTLENABLE
, 2);
966 snd_hda_codec_write(codec
, 0x15, 0,
967 AC_VERB_SET_EAPD_BTLENABLE
, 2);
970 switch (codec
->vendor_id
) {
972 snd_hda_codec_write(codec
, 0x1a, 0,
973 AC_VERB_SET_COEF_INDEX
, 7);
974 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
975 AC_VERB_GET_PROC_COEF
, 0);
976 snd_hda_codec_write(codec
, 0x1a, 0,
977 AC_VERB_SET_COEF_INDEX
, 7);
978 snd_hda_codec_write(codec
, 0x1a, 0,
979 AC_VERB_SET_PROC_COEF
,
988 snd_hda_codec_write(codec
, 0x20, 0,
989 AC_VERB_SET_COEF_INDEX
, 7);
990 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
991 AC_VERB_GET_PROC_COEF
, 0);
992 snd_hda_codec_write(codec
, 0x20, 0,
993 AC_VERB_SET_COEF_INDEX
, 7);
994 snd_hda_codec_write(codec
, 0x20, 0,
995 AC_VERB_SET_PROC_COEF
,
999 /*alc888_coef_init(codec);*/ /* called in alc_init() */
1003 snd_hda_codec_write(codec
, 0x20, 0,
1004 AC_VERB_SET_COEF_INDEX
, 7);
1005 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
1006 AC_VERB_GET_PROC_COEF
, 0);
1007 snd_hda_codec_write(codec
, 0x20, 0,
1008 AC_VERB_SET_COEF_INDEX
, 7);
1009 snd_hda_codec_write(codec
, 0x20, 0,
1010 AC_VERB_SET_PROC_COEF
,
1018 /* is laptop or Desktop and enable the function "Mute internal speaker
1019 * when the external headphone out jack is plugged"
1021 if (!(ass
& 0x8000))
1024 * 10~8 : Jack location
1025 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1027 * 15 : 1 --> enable the function "Mute internal speaker
1028 * when the external headphone out jack is plugged"
1030 if (!spec
->autocfg
.speaker_pins
[0]) {
1031 if (spec
->autocfg
.line_out_pins
[0])
1032 spec
->autocfg
.speaker_pins
[0] =
1033 spec
->autocfg
.line_out_pins
[0];
1038 if (!spec
->autocfg
.hp_pins
[0]) {
1039 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
1041 spec
->autocfg
.hp_pins
[0] = porta
;
1043 spec
->autocfg
.hp_pins
[0] = porte
;
1045 spec
->autocfg
.hp_pins
[0] = portd
;
1049 if (spec
->autocfg
.hp_pins
[0])
1050 snd_hda_codec_write(codec
, spec
->autocfg
.hp_pins
[0], 0,
1051 AC_VERB_SET_UNSOLICITED_ENABLE
,
1052 AC_USRSP_EN
| ALC880_HP_EVENT
);
1054 if (spec
->autocfg
.input_pins
[AUTO_PIN_MIC
] &&
1055 spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
])
1056 snd_hda_codec_write(codec
,
1057 spec
->autocfg
.input_pins
[AUTO_PIN_MIC
], 0,
1058 AC_VERB_SET_UNSOLICITED_ENABLE
,
1059 AC_USRSP_EN
| ALC880_MIC_EVENT
);
1061 spec
->unsol_event
= alc_sku_unsol_event
;
1065 * Fix-up pin default configurations
1073 static void alc_fix_pincfg(struct hda_codec
*codec
,
1074 const struct snd_pci_quirk
*quirk
,
1075 const struct alc_pincfg
**pinfix
)
1077 const struct alc_pincfg
*cfg
;
1079 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
1083 cfg
= pinfix
[quirk
->value
];
1084 for (; cfg
->nid
; cfg
++) {
1087 for (i
= 0; i
< 4; i
++) {
1088 snd_hda_codec_write(codec
, cfg
->nid
, 0,
1089 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
+ i
,
1097 * ALC880 3-stack model
1099 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1100 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1101 * F-Mic = 0x1b, HP = 0x19
1104 static hda_nid_t alc880_dac_nids
[4] = {
1105 /* front, rear, clfe, rear_surr */
1106 0x02, 0x05, 0x04, 0x03
1109 static hda_nid_t alc880_adc_nids
[3] = {
1114 /* The datasheet says the node 0x07 is connected from inputs,
1115 * but it shows zero connection in the real implementation on some devices.
1116 * Note: this is a 915GAV bug, fixed on 915GLV
1118 static hda_nid_t alc880_adc_nids_alt
[2] = {
1123 #define ALC880_DIGOUT_NID 0x06
1124 #define ALC880_DIGIN_NID 0x0a
1126 static struct hda_input_mux alc880_capture_source
= {
1130 { "Front Mic", 0x3 },
1136 /* channel source setting (2/6 channel selection for 3-stack) */
1138 static struct hda_verb alc880_threestack_ch2_init
[] = {
1139 /* set line-in to input, mute it */
1140 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1141 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1142 /* set mic-in to input vref 80%, mute it */
1143 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1144 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1149 static struct hda_verb alc880_threestack_ch6_init
[] = {
1150 /* set line-in to output, unmute it */
1151 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1152 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1153 /* set mic-in to output, unmute it */
1154 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1155 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1159 static struct hda_channel_mode alc880_threestack_modes
[2] = {
1160 { 2, alc880_threestack_ch2_init
},
1161 { 6, alc880_threestack_ch6_init
},
1164 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
1165 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1166 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1167 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1168 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
1169 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1170 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1171 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1172 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1173 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1174 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1175 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1176 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1179 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
1180 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
1181 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1182 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
1185 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1186 .name
= "Channel Mode",
1187 .info
= alc_ch_mode_info
,
1188 .get
= alc_ch_mode_get
,
1189 .put
= alc_ch_mode_put
,
1194 /* capture mixer elements */
1195 static struct snd_kcontrol_new alc880_capture_mixer
[] = {
1196 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
1197 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
1198 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
1199 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
1200 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
1201 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
1203 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1204 /* The multiple "Capture Source" controls confuse alsamixer
1205 * So call somewhat different..
1207 /* .name = "Capture Source", */
1208 .name
= "Input Source",
1210 .info
= alc_mux_enum_info
,
1211 .get
= alc_mux_enum_get
,
1212 .put
= alc_mux_enum_put
,
1217 /* capture mixer elements (in case NID 0x07 not available) */
1218 static struct snd_kcontrol_new alc880_capture_alt_mixer
[] = {
1219 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1220 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1221 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
1222 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
1224 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1225 /* The multiple "Capture Source" controls confuse alsamixer
1226 * So call somewhat different..
1228 /* .name = "Capture Source", */
1229 .name
= "Input Source",
1231 .info
= alc_mux_enum_info
,
1232 .get
= alc_mux_enum_get
,
1233 .put
= alc_mux_enum_put
,
1241 * ALC880 5-stack model
1243 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1245 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1246 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1249 /* additional mixers to alc880_three_stack_mixer */
1250 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
1251 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1252 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
1256 /* channel source setting (6/8 channel selection for 5-stack) */
1258 static struct hda_verb alc880_fivestack_ch6_init
[] = {
1259 /* set line-in to input, mute it */
1260 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1261 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1266 static struct hda_verb alc880_fivestack_ch8_init
[] = {
1267 /* set line-in to output, unmute it */
1268 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1269 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1273 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
1274 { 6, alc880_fivestack_ch6_init
},
1275 { 8, alc880_fivestack_ch8_init
},
1280 * ALC880 6-stack model
1282 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1283 * Side = 0x05 (0x0f)
1284 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1285 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1288 static hda_nid_t alc880_6st_dac_nids
[4] = {
1289 /* front, rear, clfe, rear_surr */
1290 0x02, 0x03, 0x04, 0x05
1293 static struct hda_input_mux alc880_6stack_capture_source
= {
1297 { "Front Mic", 0x1 },
1303 /* fixed 8-channels */
1304 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
1308 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
1309 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1310 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1311 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1312 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1313 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1314 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1315 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1316 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1317 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1318 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1319 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1320 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1321 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1322 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1323 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1324 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1325 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1326 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1327 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1328 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1330 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1331 .name
= "Channel Mode",
1332 .info
= alc_ch_mode_info
,
1333 .get
= alc_ch_mode_get
,
1334 .put
= alc_ch_mode_put
,
1343 * W810 has rear IO for:
1346 * Center/LFE (DAC 04)
1349 * The system also has a pair of internal speakers, and a headphone jack.
1350 * These are both connected to Line2 on the codec, hence to DAC 02.
1352 * There is a variable resistor to control the speaker or headphone
1353 * volume. This is a hardware-only device without a software API.
1355 * Plugging headphones in will disable the internal speakers. This is
1356 * implemented in hardware, not via the driver using jack sense. In
1357 * a similar fashion, plugging into the rear socket marked "front" will
1358 * disable both the speakers and headphones.
1360 * For input, there's a microphone jack, and an "audio in" jack.
1361 * These may not do anything useful with this driver yet, because I
1362 * haven't setup any initialization verbs for these yet...
1365 static hda_nid_t alc880_w810_dac_nids
[3] = {
1366 /* front, rear/surround, clfe */
1370 /* fixed 6 channels */
1371 static struct hda_channel_mode alc880_w810_modes
[1] = {
1375 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1376 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
1377 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1378 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1379 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1380 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1381 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1382 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1383 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1384 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1385 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1393 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1394 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1398 static hda_nid_t alc880_z71v_dac_nids
[1] = {
1401 #define ALC880_Z71V_HP_DAC 0x03
1403 /* fixed 2 channels */
1404 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
1408 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
1409 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1410 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1411 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1412 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
1413 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1414 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1415 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1416 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1422 * ALC880 F1734 model
1424 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1425 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1428 static hda_nid_t alc880_f1734_dac_nids
[1] = {
1431 #define ALC880_F1734_HP_DAC 0x02
1433 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
1434 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1435 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1436 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1437 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1438 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1439 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1440 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1441 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1445 static struct hda_input_mux alc880_f1734_capture_source
= {
1457 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1458 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1459 * Mic = 0x18, Line = 0x1a
1462 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1463 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1465 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
1466 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1467 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1468 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1469 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1470 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1471 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1472 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1473 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1474 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1475 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1476 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1477 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1478 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1479 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1481 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1482 .name
= "Channel Mode",
1483 .info
= alc_ch_mode_info
,
1484 .get
= alc_ch_mode_get
,
1485 .put
= alc_ch_mode_put
,
1491 * ALC880 ASUS W1V model
1493 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1494 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1495 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1498 /* additional mixers to alc880_asus_mixer */
1499 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
1500 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
1501 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
1505 /* additional mixers to alc880_asus_mixer */
1506 static struct snd_kcontrol_new alc880_pcbeep_mixer
[] = {
1507 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1508 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1513 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
1514 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1515 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1516 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
1517 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
1518 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
1519 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
1520 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
1521 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1522 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1524 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1525 /* The multiple "Capture Source" controls confuse alsamixer
1526 * So call somewhat different..
1528 /* .name = "Capture Source", */
1529 .name
= "Input Source",
1531 .info
= alc_mux_enum_info
,
1532 .get
= alc_mux_enum_get
,
1533 .put
= alc_mux_enum_put
,
1539 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
1540 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1541 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1542 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1543 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1544 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1545 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1546 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1547 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1548 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1549 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1550 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1551 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1552 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1553 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1554 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1555 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1556 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1557 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1559 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1560 .name
= "Channel Mode",
1561 .info
= alc_ch_mode_info
,
1562 .get
= alc_ch_mode_get
,
1563 .put
= alc_ch_mode_put
,
1568 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
1569 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1570 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1571 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1572 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1573 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1574 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1575 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1576 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1577 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1578 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1582 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
1583 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1584 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1585 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1586 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1587 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1588 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1593 * virtual master controls
1597 * slave controls for virtual master
1599 static const char *alc_slave_vols
[] = {
1600 "Front Playback Volume",
1601 "Surround Playback Volume",
1602 "Center Playback Volume",
1603 "LFE Playback Volume",
1604 "Side Playback Volume",
1605 "Headphone Playback Volume",
1606 "Speaker Playback Volume",
1607 "Mono Playback Volume",
1608 "Line-Out Playback Volume",
1612 static const char *alc_slave_sws
[] = {
1613 "Front Playback Switch",
1614 "Surround Playback Switch",
1615 "Center Playback Switch",
1616 "LFE Playback Switch",
1617 "Side Playback Switch",
1618 "Headphone Playback Switch",
1619 "Speaker Playback Switch",
1620 "Mono Playback Switch",
1621 "IEC958 Playback Switch",
1626 * build control elements
1628 static int alc_build_controls(struct hda_codec
*codec
)
1630 struct alc_spec
*spec
= codec
->spec
;
1634 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1635 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1640 if (spec
->multiout
.dig_out_nid
) {
1641 err
= snd_hda_create_spdif_out_ctls(codec
,
1642 spec
->multiout
.dig_out_nid
);
1645 err
= snd_hda_create_spdif_share_sw(codec
,
1649 spec
->multiout
.share_spdif
= 1;
1651 if (spec
->dig_in_nid
) {
1652 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1657 /* if we have no master control, let's create it */
1658 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
1659 unsigned int vmaster_tlv
[4];
1660 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
1661 HDA_OUTPUT
, vmaster_tlv
);
1662 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
1663 vmaster_tlv
, alc_slave_vols
);
1667 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
1668 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
1669 NULL
, alc_slave_sws
);
1679 * initialize the codec volumes, etc
1683 * generic initialization of ADC, input mixers and output mixers
1685 static struct hda_verb alc880_volume_init_verbs
[] = {
1687 * Unmute ADC0-2 and set the default input to mic-in
1689 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
1690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1691 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
1692 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1693 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
1694 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1696 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1698 * Note: PASD motherboards uses the Line In 2 as the input for front
1701 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1702 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
1705 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
1706 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
1707 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
1708 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
1711 * Set up output mixers (0x0c - 0x0f)
1713 /* set vol=0 to output mixers */
1714 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1715 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1716 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1717 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1718 /* set up input amps for analog loopback */
1719 /* Amp Indices: DAC = 0, mixer = 1 */
1720 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1721 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1722 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1723 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1724 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1725 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1726 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1727 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1733 * 3-stack pin configuration:
1734 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1736 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
1738 * preset connection lists of input pins
1739 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1741 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
1742 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1743 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
1746 * Set pin mode and muting
1748 /* set front pin widgets 0x14 for output */
1749 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1750 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1751 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1752 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1753 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1754 /* Mic2 (as headphone out) for HP output */
1755 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1756 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1757 /* Line In pin widget for input */
1758 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1759 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1760 /* Line2 (as front mic) pin widget for input and vref at 80% */
1761 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1762 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1763 /* CD pin widget for input */
1764 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1770 * 5-stack pin configuration:
1771 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1772 * line-in/side = 0x1a, f-mic = 0x1b
1774 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
1776 * preset connection lists of input pins
1777 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1779 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1780 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
1783 * Set pin mode and muting
1785 /* set pin widgets 0x14-0x17 for output */
1786 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1787 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1788 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1789 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1790 /* unmute pins for output (no gain on this amp) */
1791 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1793 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1794 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1796 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1797 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1798 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1799 /* Mic2 (as headphone out) for HP output */
1800 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1801 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1802 /* Line In pin widget for input */
1803 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1804 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1805 /* Line2 (as front mic) pin widget for input and vref at 80% */
1806 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1807 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1808 /* CD pin widget for input */
1809 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1815 * W810 pin configuration:
1816 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1818 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
1819 /* hphone/speaker input selector: front DAC */
1820 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
1822 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1823 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1824 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1825 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1826 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1827 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1829 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1830 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1836 * Z71V pin configuration:
1837 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1839 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
1840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
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
},
1845 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1846 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1847 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1848 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1854 * 6-stack pin configuration:
1855 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1856 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1858 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
1859 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1861 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1862 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1863 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1864 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1865 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1866 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1867 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1868 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1870 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1871 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1872 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1873 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1874 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1875 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1876 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1877 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1878 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1884 * Uniwill pin configuration:
1885 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1888 static struct hda_verb alc880_uniwill_init_verbs
[] = {
1889 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1891 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1892 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1893 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1894 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1895 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1896 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1897 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1898 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1899 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1901 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1902 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1903 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1904 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1906 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1907 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1908 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1909 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1910 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1911 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1912 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1913 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1914 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1916 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1917 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
1924 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1926 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
1927 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1929 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1930 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1931 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1932 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1933 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1934 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1935 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1937 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1938 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1939 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1940 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1942 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1943 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1944 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1945 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1946 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1947 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1949 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1950 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
1955 static struct hda_verb alc880_beep_init_verbs
[] = {
1956 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
1960 /* toggle speaker-output according to the hp-jack state */
1961 static void alc880_uniwill_hp_automute(struct hda_codec
*codec
)
1963 unsigned int present
;
1966 present
= snd_hda_codec_read(codec
, 0x14, 0,
1967 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1968 bits
= present
? HDA_AMP_MUTE
: 0;
1969 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
1970 HDA_AMP_MUTE
, bits
);
1971 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
1972 HDA_AMP_MUTE
, bits
);
1975 /* auto-toggle front mic */
1976 static void alc880_uniwill_mic_automute(struct hda_codec
*codec
)
1978 unsigned int present
;
1981 present
= snd_hda_codec_read(codec
, 0x18, 0,
1982 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1983 bits
= present
? HDA_AMP_MUTE
: 0;
1984 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
1987 static void alc880_uniwill_automute(struct hda_codec
*codec
)
1989 alc880_uniwill_hp_automute(codec
);
1990 alc880_uniwill_mic_automute(codec
);
1993 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
1996 /* Looks like the unsol event is incompatible with the standard
1997 * definition. 4bit tag is placed at 28 bit!
1999 switch (res
>> 28) {
2000 case ALC880_HP_EVENT
:
2001 alc880_uniwill_hp_automute(codec
);
2003 case ALC880_MIC_EVENT
:
2004 alc880_uniwill_mic_automute(codec
);
2009 static void alc880_uniwill_p53_hp_automute(struct hda_codec
*codec
)
2011 unsigned int present
;
2014 present
= snd_hda_codec_read(codec
, 0x14, 0,
2015 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2016 bits
= present
? HDA_AMP_MUTE
: 0;
2017 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0, HDA_AMP_MUTE
, bits
);
2020 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
2022 unsigned int present
;
2024 present
= snd_hda_codec_read(codec
, 0x21, 0,
2025 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
2026 present
&= HDA_AMP_VOLMASK
;
2027 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
2028 HDA_AMP_VOLMASK
, present
);
2029 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
2030 HDA_AMP_VOLMASK
, present
);
2033 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
2036 /* Looks like the unsol event is incompatible with the standard
2037 * definition. 4bit tag is placed at 28 bit!
2039 if ((res
>> 28) == ALC880_HP_EVENT
)
2040 alc880_uniwill_p53_hp_automute(codec
);
2041 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
2042 alc880_uniwill_p53_dcvol_automute(codec
);
2046 * F1734 pin configuration:
2047 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2049 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
2050 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
2051 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2052 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2053 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2054 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2056 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2057 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2058 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2059 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2061 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2062 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2063 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
2064 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2066 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2067 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2068 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2069 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2071 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
2072 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
2078 * ASUS pin configuration:
2079 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2081 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
2082 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2083 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2084 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2085 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2087 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2088 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2089 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2090 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2091 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2092 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2093 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2094 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2096 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2097 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2098 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2099 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2100 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2101 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2102 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2103 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2104 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2109 /* Enable GPIO mask and set output */
2110 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2111 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2113 /* Clevo m520g init */
2114 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
2115 /* headphone output */
2116 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2118 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2119 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2121 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2122 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2124 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2125 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2126 /* Mic1 (rear panel) */
2127 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2128 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2129 /* Mic2 (front panel) */
2130 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2131 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2133 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2134 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2135 /* change to EAPD mode */
2136 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2137 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2142 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
2143 /* change to EAPD mode */
2144 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2145 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2147 /* Headphone output */
2148 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2150 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2151 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
2153 /* Line In pin widget for input */
2154 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2155 /* CD pin widget for input */
2156 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2157 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2158 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2160 /* change to EAPD mode */
2161 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2162 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
2168 * LG m1 express dual
2171 * Rear Line-In/Out (blue): 0x14
2172 * Build-in Mic-In: 0x15
2174 * HP-Out (green): 0x1b
2175 * Mic-In/Out (red): 0x19
2179 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2180 static hda_nid_t alc880_lg_dac_nids
[3] = {
2184 /* seems analog CD is not working */
2185 static struct hda_input_mux alc880_lg_capture_source
= {
2190 { "Internal Mic", 0x6 },
2194 /* 2,4,6 channel modes */
2195 static struct hda_verb alc880_lg_ch2_init
[] = {
2196 /* set line-in and mic-in to input */
2197 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2198 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2202 static struct hda_verb alc880_lg_ch4_init
[] = {
2203 /* set line-in to out and mic-in to input */
2204 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2205 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2209 static struct hda_verb alc880_lg_ch6_init
[] = {
2210 /* set line-in and mic-in to output */
2211 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2212 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2216 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
2217 { 2, alc880_lg_ch2_init
},
2218 { 4, alc880_lg_ch4_init
},
2219 { 6, alc880_lg_ch6_init
},
2222 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
2223 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2224 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
2225 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2226 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
2227 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
2228 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
2229 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
2230 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
2231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2233 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
2234 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
2235 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
2236 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
2238 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2239 .name
= "Channel Mode",
2240 .info
= alc_ch_mode_info
,
2241 .get
= alc_ch_mode_get
,
2242 .put
= alc_ch_mode_put
,
2247 static struct hda_verb alc880_lg_init_verbs
[] = {
2248 /* set capture source to mic-in */
2249 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2250 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2251 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2252 /* mute all amp mixer inputs */
2253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
2254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2255 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2256 /* line-in to input */
2257 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2258 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2260 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2261 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2263 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2264 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2265 /* mic-in to input */
2266 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2268 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2270 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
2271 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2272 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2274 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2278 /* toggle speaker-output according to the hp-jack state */
2279 static void alc880_lg_automute(struct hda_codec
*codec
)
2281 unsigned int present
;
2284 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2285 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2286 bits
= present
? HDA_AMP_MUTE
: 0;
2287 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
2288 HDA_AMP_MUTE
, bits
);
2291 static void alc880_lg_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2293 /* Looks like the unsol event is incompatible with the standard
2294 * definition. 4bit tag is placed at 28 bit!
2296 if ((res
>> 28) == 0x01)
2297 alc880_lg_automute(codec
);
2306 * Built-in Mic-In: 0x19
2312 static struct hda_input_mux alc880_lg_lw_capture_source
= {
2316 { "Internal Mic", 0x1 },
2321 #define alc880_lg_lw_modes alc880_threestack_modes
2323 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
2324 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2325 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2326 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2327 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2328 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2329 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2330 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2331 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2332 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2333 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2335 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2336 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
2337 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
2339 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2340 .name
= "Channel Mode",
2341 .info
= alc_ch_mode_info
,
2342 .get
= alc_ch_mode_get
,
2343 .put
= alc_ch_mode_put
,
2348 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
2349 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2350 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2351 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2353 /* set capture source to mic-in */
2354 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2355 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2356 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2357 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2359 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2360 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2362 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2363 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2364 /* mic-in to input */
2365 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2366 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2368 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2369 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2371 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2375 /* toggle speaker-output according to the hp-jack state */
2376 static void alc880_lg_lw_automute(struct hda_codec
*codec
)
2378 unsigned int present
;
2381 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2382 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2383 bits
= present
? HDA_AMP_MUTE
: 0;
2384 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
2385 HDA_AMP_MUTE
, bits
);
2388 static void alc880_lg_lw_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2390 /* Looks like the unsol event is incompatible with the standard
2391 * definition. 4bit tag is placed at 28 bit!
2393 if ((res
>> 28) == 0x01)
2394 alc880_lg_lw_automute(codec
);
2397 static struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
2398 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2399 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
2400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2401 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2402 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2403 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2407 static struct hda_input_mux alc880_medion_rim_capture_source
= {
2411 { "Internal Mic", 0x1 },
2415 static struct hda_verb alc880_medion_rim_init_verbs
[] = {
2416 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2418 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2419 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2421 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2422 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2423 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2424 /* Mic2 (as headphone out) for HP output */
2425 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2426 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2427 /* Internal Speaker */
2428 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2429 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2431 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2432 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2434 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2438 /* toggle speaker-output according to the hp-jack state */
2439 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
2441 unsigned int present
;
2444 present
= snd_hda_codec_read(codec
, 0x14, 0,
2445 AC_VERB_GET_PIN_SENSE
, 0)
2446 & AC_PINSENSE_PRESENCE
;
2447 bits
= present
? HDA_AMP_MUTE
: 0;
2448 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
2449 HDA_AMP_MUTE
, bits
);
2451 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
2453 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
2456 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
2459 /* Looks like the unsol event is incompatible with the standard
2460 * definition. 4bit tag is placed at 28 bit!
2462 if ((res
>> 28) == ALC880_HP_EVENT
)
2463 alc880_medion_rim_automute(codec
);
2466 #ifdef CONFIG_SND_HDA_POWER_SAVE
2467 static struct hda_amp_list alc880_loopbacks
[] = {
2468 { 0x0b, HDA_INPUT
, 0 },
2469 { 0x0b, HDA_INPUT
, 1 },
2470 { 0x0b, HDA_INPUT
, 2 },
2471 { 0x0b, HDA_INPUT
, 3 },
2472 { 0x0b, HDA_INPUT
, 4 },
2476 static struct hda_amp_list alc880_lg_loopbacks
[] = {
2477 { 0x0b, HDA_INPUT
, 1 },
2478 { 0x0b, HDA_INPUT
, 6 },
2479 { 0x0b, HDA_INPUT
, 7 },
2488 static int alc_init(struct hda_codec
*codec
)
2490 struct alc_spec
*spec
= codec
->spec
;
2494 if (codec
->vendor_id
== 0x10ec0888)
2495 alc888_coef_init(codec
);
2497 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
2498 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
2500 if (spec
->init_hook
)
2501 spec
->init_hook(codec
);
2506 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2508 struct alc_spec
*spec
= codec
->spec
;
2510 if (spec
->unsol_event
)
2511 spec
->unsol_event(codec
, res
);
2514 #ifdef CONFIG_SND_HDA_POWER_SAVE
2515 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
2517 struct alc_spec
*spec
= codec
->spec
;
2518 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
2523 * Analog playback callbacks
2525 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2526 struct hda_codec
*codec
,
2527 struct snd_pcm_substream
*substream
)
2529 struct alc_spec
*spec
= codec
->spec
;
2530 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
2534 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2535 struct hda_codec
*codec
,
2536 unsigned int stream_tag
,
2537 unsigned int format
,
2538 struct snd_pcm_substream
*substream
)
2540 struct alc_spec
*spec
= codec
->spec
;
2541 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
2542 stream_tag
, format
, substream
);
2545 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2546 struct hda_codec
*codec
,
2547 struct snd_pcm_substream
*substream
)
2549 struct alc_spec
*spec
= codec
->spec
;
2550 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2556 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2557 struct hda_codec
*codec
,
2558 struct snd_pcm_substream
*substream
)
2560 struct alc_spec
*spec
= codec
->spec
;
2561 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2564 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2565 struct hda_codec
*codec
,
2566 unsigned int stream_tag
,
2567 unsigned int format
,
2568 struct snd_pcm_substream
*substream
)
2570 struct alc_spec
*spec
= codec
->spec
;
2571 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2572 stream_tag
, format
, substream
);
2575 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2576 struct hda_codec
*codec
,
2577 struct snd_pcm_substream
*substream
)
2579 struct alc_spec
*spec
= codec
->spec
;
2580 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2586 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2587 struct hda_codec
*codec
,
2588 unsigned int stream_tag
,
2589 unsigned int format
,
2590 struct snd_pcm_substream
*substream
)
2592 struct alc_spec
*spec
= codec
->spec
;
2594 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
2595 stream_tag
, 0, format
);
2599 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2600 struct hda_codec
*codec
,
2601 struct snd_pcm_substream
*substream
)
2603 struct alc_spec
*spec
= codec
->spec
;
2605 snd_hda_codec_cleanup_stream(codec
,
2606 spec
->adc_nids
[substream
->number
+ 1]);
2613 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
2617 /* NID is set in alc_build_pcms */
2619 .open
= alc880_playback_pcm_open
,
2620 .prepare
= alc880_playback_pcm_prepare
,
2621 .cleanup
= alc880_playback_pcm_cleanup
2625 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
2629 /* NID is set in alc_build_pcms */
2632 static struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
2636 /* NID is set in alc_build_pcms */
2639 static struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
2640 .substreams
= 2, /* can be overridden */
2643 /* NID is set in alc_build_pcms */
2645 .prepare
= alc880_alt_capture_pcm_prepare
,
2646 .cleanup
= alc880_alt_capture_pcm_cleanup
2650 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
2654 /* NID is set in alc_build_pcms */
2656 .open
= alc880_dig_playback_pcm_open
,
2657 .close
= alc880_dig_playback_pcm_close
,
2658 .prepare
= alc880_dig_playback_pcm_prepare
2662 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
2666 /* NID is set in alc_build_pcms */
2669 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2670 static struct hda_pcm_stream alc_pcm_null_stream
= {
2676 static int alc_build_pcms(struct hda_codec
*codec
)
2678 struct alc_spec
*spec
= codec
->spec
;
2679 struct hda_pcm
*info
= spec
->pcm_rec
;
2682 codec
->num_pcms
= 1;
2683 codec
->pcm_info
= info
;
2685 info
->name
= spec
->stream_name_analog
;
2686 if (spec
->stream_analog_playback
) {
2687 if (snd_BUG_ON(!spec
->multiout
.dac_nids
))
2689 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
2690 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
2692 if (spec
->stream_analog_capture
) {
2693 if (snd_BUG_ON(!spec
->adc_nids
))
2695 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
2696 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
2699 if (spec
->channel_mode
) {
2700 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
2701 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
2702 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
2703 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
2708 /* SPDIF for stream index #1 */
2709 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2710 codec
->num_pcms
= 2;
2711 info
= spec
->pcm_rec
+ 1;
2712 info
->name
= spec
->stream_name_digital
;
2713 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
2714 if (spec
->multiout
.dig_out_nid
&&
2715 spec
->stream_digital_playback
) {
2716 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
2717 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2719 if (spec
->dig_in_nid
&&
2720 spec
->stream_digital_capture
) {
2721 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
2722 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2724 /* FIXME: do we need this for all Realtek codec models? */
2725 codec
->spdif_status_reset
= 1;
2728 /* If the use of more than one ADC is requested for the current
2729 * model, configure a second analog capture-only PCM.
2731 /* Additional Analaog capture for index #2 */
2732 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
2733 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
2734 codec
->num_pcms
= 3;
2735 info
= spec
->pcm_rec
+ 2;
2736 info
->name
= spec
->stream_name_analog
;
2737 if (spec
->alt_dac_nid
) {
2738 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
2739 *spec
->stream_analog_alt_playback
;
2740 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
2743 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
2744 alc_pcm_null_stream
;
2745 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
2747 if (spec
->num_adc_nids
> 1) {
2748 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
2749 *spec
->stream_analog_alt_capture
;
2750 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
2752 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
2753 spec
->num_adc_nids
- 1;
2755 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
2756 alc_pcm_null_stream
;
2757 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
2764 static void alc_free(struct hda_codec
*codec
)
2766 struct alc_spec
*spec
= codec
->spec
;
2772 if (spec
->kctl_alloc
) {
2773 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
2774 kfree(spec
->kctl_alloc
[i
].name
);
2775 kfree(spec
->kctl_alloc
);
2778 codec
->spec
= NULL
; /* to be sure */
2783 static struct hda_codec_ops alc_patch_ops
= {
2784 .build_controls
= alc_build_controls
,
2785 .build_pcms
= alc_build_pcms
,
2788 .unsol_event
= alc_unsol_event
,
2789 #ifdef CONFIG_SND_HDA_POWER_SAVE
2790 .check_power_status
= alc_check_power_status
,
2796 * Test configuration for debugging
2798 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2801 #ifdef CONFIG_SND_DEBUG
2802 static hda_nid_t alc880_test_dac_nids
[4] = {
2803 0x02, 0x03, 0x04, 0x05
2806 static struct hda_input_mux alc880_test_capture_source
= {
2815 { "Surround", 0x6 },
2819 static struct hda_channel_mode alc880_test_modes
[4] = {
2826 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
2827 struct snd_ctl_elem_info
*uinfo
)
2829 static char *texts
[] = {
2830 "N/A", "Line Out", "HP Out",
2831 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2833 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2835 uinfo
->value
.enumerated
.items
= 8;
2836 if (uinfo
->value
.enumerated
.item
>= 8)
2837 uinfo
->value
.enumerated
.item
= 7;
2838 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2842 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
2843 struct snd_ctl_elem_value
*ucontrol
)
2845 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2846 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2847 unsigned int pin_ctl
, item
= 0;
2849 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2850 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2851 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
2852 if (pin_ctl
& AC_PINCTL_HP_EN
)
2856 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
2857 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
2858 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
2859 case AC_PINCTL_VREF_50
: item
= 4; break;
2860 case AC_PINCTL_VREF_GRD
: item
= 5; break;
2861 case AC_PINCTL_VREF_80
: item
= 6; break;
2862 case AC_PINCTL_VREF_100
: item
= 7; break;
2865 ucontrol
->value
.enumerated
.item
[0] = item
;
2869 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
2870 struct snd_ctl_elem_value
*ucontrol
)
2872 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2873 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2874 static unsigned int ctls
[] = {
2875 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
2876 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
2877 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
2878 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
2879 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
2880 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
2882 unsigned int old_ctl
, new_ctl
;
2884 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2885 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2886 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
2887 if (old_ctl
!= new_ctl
) {
2889 snd_hda_codec_write_cache(codec
, nid
, 0,
2890 AC_VERB_SET_PIN_WIDGET_CONTROL
,
2892 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
2894 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
2901 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
2902 struct snd_ctl_elem_info
*uinfo
)
2904 static char *texts
[] = {
2905 "Front", "Surround", "CLFE", "Side"
2907 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2909 uinfo
->value
.enumerated
.items
= 4;
2910 if (uinfo
->value
.enumerated
.item
>= 4)
2911 uinfo
->value
.enumerated
.item
= 3;
2912 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2916 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
2917 struct snd_ctl_elem_value
*ucontrol
)
2919 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2920 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2923 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
2924 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
2928 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
2929 struct snd_ctl_elem_value
*ucontrol
)
2931 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2932 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2935 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
2936 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
2937 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
2938 snd_hda_codec_write_cache(codec
, nid
, 0,
2939 AC_VERB_SET_CONNECT_SEL
, sel
);
2945 #define PIN_CTL_TEST(xname,nid) { \
2946 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2948 .info = alc_test_pin_ctl_info, \
2949 .get = alc_test_pin_ctl_get, \
2950 .put = alc_test_pin_ctl_put, \
2951 .private_value = nid \
2954 #define PIN_SRC_TEST(xname,nid) { \
2955 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2957 .info = alc_test_pin_src_info, \
2958 .get = alc_test_pin_src_get, \
2959 .put = alc_test_pin_src_put, \
2960 .private_value = nid \
2963 static struct snd_kcontrol_new alc880_test_mixer
[] = {
2964 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2965 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2966 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
2967 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2968 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2969 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2970 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
2971 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2972 PIN_CTL_TEST("Front Pin Mode", 0x14),
2973 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2974 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2975 PIN_CTL_TEST("Side Pin Mode", 0x17),
2976 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2977 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2978 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2979 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2980 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2981 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2982 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2983 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2984 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2985 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2986 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2987 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2988 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
2989 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
2990 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2991 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2992 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
2993 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
2995 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2996 .name
= "Channel Mode",
2997 .info
= alc_ch_mode_info
,
2998 .get
= alc_ch_mode_get
,
2999 .put
= alc_ch_mode_put
,
3004 static struct hda_verb alc880_test_init_verbs
[] = {
3005 /* Unmute inputs of 0x0c - 0x0f */
3006 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3007 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3008 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3009 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3010 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3011 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3012 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3013 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3014 /* Vol output for 0x0c-0x0f */
3015 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3016 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3017 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3018 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3019 /* Set output pins 0x14-0x17 */
3020 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3021 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3022 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3023 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3024 /* Unmute output pins 0x14-0x17 */
3025 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3026 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3027 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3028 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3029 /* Set input pins 0x18-0x1c */
3030 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3031 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3032 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3033 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3034 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3035 /* Mute input pins 0x18-0x1b */
3036 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3037 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3038 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3039 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
3041 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3042 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
3043 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3044 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
3045 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3046 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
3047 /* Analog input/passthru */
3048 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3049 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3050 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3051 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3052 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3060 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
3061 [ALC880_3ST
] = "3stack",
3062 [ALC880_TCL_S700
] = "tcl",
3063 [ALC880_3ST_DIG
] = "3stack-digout",
3064 [ALC880_CLEVO
] = "clevo",
3065 [ALC880_5ST
] = "5stack",
3066 [ALC880_5ST_DIG
] = "5stack-digout",
3067 [ALC880_W810
] = "w810",
3068 [ALC880_Z71V
] = "z71v",
3069 [ALC880_6ST
] = "6stack",
3070 [ALC880_6ST_DIG
] = "6stack-digout",
3071 [ALC880_ASUS
] = "asus",
3072 [ALC880_ASUS_W1V
] = "asus-w1v",
3073 [ALC880_ASUS_DIG
] = "asus-dig",
3074 [ALC880_ASUS_DIG2
] = "asus-dig2",
3075 [ALC880_UNIWILL_DIG
] = "uniwill",
3076 [ALC880_UNIWILL_P53
] = "uniwill-p53",
3077 [ALC880_FUJITSU
] = "fujitsu",
3078 [ALC880_F1734
] = "F1734",
3080 [ALC880_LG_LW
] = "lg-lw",
3081 [ALC880_MEDION_RIM
] = "medion",
3082 #ifdef CONFIG_SND_DEBUG
3083 [ALC880_TEST
] = "test",
3085 [ALC880_AUTO
] = "auto",
3088 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
3089 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
3090 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
3091 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
3092 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
3093 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
3094 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
3095 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
3096 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
3097 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
3098 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
3099 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
3100 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
3101 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
3102 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
3103 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
3104 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
3105 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
3106 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
3107 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3108 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
3109 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
3110 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
3111 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
3112 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
3113 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
3114 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS
), /* default ASUS */
3115 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
3116 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
3117 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
3118 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
3119 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
3120 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
3121 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
3122 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
3123 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
3124 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
3125 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
3126 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
3127 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
3128 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
3129 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
3130 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
3131 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
3132 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
3133 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
3134 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
3135 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
3136 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
3137 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
3138 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL
),
3139 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
3140 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
3141 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
3142 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
3143 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
3144 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
3145 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
3146 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
3147 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
3148 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
3149 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
3150 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
3151 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
3152 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
3153 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
3154 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
3155 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
3156 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
3157 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST
), /* default Intel */
3158 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
3159 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
3164 * ALC880 codec presets
3166 static struct alc_config_preset alc880_presets
[] = {
3168 .mixers
= { alc880_three_stack_mixer
},
3169 .init_verbs
= { alc880_volume_init_verbs
,
3170 alc880_pin_3stack_init_verbs
},
3171 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3172 .dac_nids
= alc880_dac_nids
,
3173 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3174 .channel_mode
= alc880_threestack_modes
,
3176 .input_mux
= &alc880_capture_source
,
3178 [ALC880_3ST_DIG
] = {
3179 .mixers
= { alc880_three_stack_mixer
},
3180 .init_verbs
= { alc880_volume_init_verbs
,
3181 alc880_pin_3stack_init_verbs
},
3182 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3183 .dac_nids
= alc880_dac_nids
,
3184 .dig_out_nid
= ALC880_DIGOUT_NID
,
3185 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3186 .channel_mode
= alc880_threestack_modes
,
3188 .input_mux
= &alc880_capture_source
,
3190 [ALC880_TCL_S700
] = {
3191 .mixers
= { alc880_tcl_s700_mixer
},
3192 .init_verbs
= { alc880_volume_init_verbs
,
3193 alc880_pin_tcl_S700_init_verbs
,
3194 alc880_gpio2_init_verbs
},
3195 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3196 .dac_nids
= alc880_dac_nids
,
3198 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3199 .channel_mode
= alc880_2_jack_modes
,
3200 .input_mux
= &alc880_capture_source
,
3203 .mixers
= { alc880_three_stack_mixer
,
3204 alc880_five_stack_mixer
},
3205 .init_verbs
= { alc880_volume_init_verbs
,
3206 alc880_pin_5stack_init_verbs
},
3207 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3208 .dac_nids
= alc880_dac_nids
,
3209 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3210 .channel_mode
= alc880_fivestack_modes
,
3211 .input_mux
= &alc880_capture_source
,
3213 [ALC880_5ST_DIG
] = {
3214 .mixers
= { alc880_three_stack_mixer
,
3215 alc880_five_stack_mixer
},
3216 .init_verbs
= { alc880_volume_init_verbs
,
3217 alc880_pin_5stack_init_verbs
},
3218 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3219 .dac_nids
= alc880_dac_nids
,
3220 .dig_out_nid
= ALC880_DIGOUT_NID
,
3221 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3222 .channel_mode
= alc880_fivestack_modes
,
3223 .input_mux
= &alc880_capture_source
,
3226 .mixers
= { alc880_six_stack_mixer
},
3227 .init_verbs
= { alc880_volume_init_verbs
,
3228 alc880_pin_6stack_init_verbs
},
3229 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3230 .dac_nids
= alc880_6st_dac_nids
,
3231 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3232 .channel_mode
= alc880_sixstack_modes
,
3233 .input_mux
= &alc880_6stack_capture_source
,
3235 [ALC880_6ST_DIG
] = {
3236 .mixers
= { alc880_six_stack_mixer
},
3237 .init_verbs
= { alc880_volume_init_verbs
,
3238 alc880_pin_6stack_init_verbs
},
3239 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3240 .dac_nids
= alc880_6st_dac_nids
,
3241 .dig_out_nid
= ALC880_DIGOUT_NID
,
3242 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3243 .channel_mode
= alc880_sixstack_modes
,
3244 .input_mux
= &alc880_6stack_capture_source
,
3247 .mixers
= { alc880_w810_base_mixer
},
3248 .init_verbs
= { alc880_volume_init_verbs
,
3249 alc880_pin_w810_init_verbs
,
3250 alc880_gpio2_init_verbs
},
3251 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
3252 .dac_nids
= alc880_w810_dac_nids
,
3253 .dig_out_nid
= ALC880_DIGOUT_NID
,
3254 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3255 .channel_mode
= alc880_w810_modes
,
3256 .input_mux
= &alc880_capture_source
,
3259 .mixers
= { alc880_z71v_mixer
},
3260 .init_verbs
= { alc880_volume_init_verbs
,
3261 alc880_pin_z71v_init_verbs
},
3262 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
3263 .dac_nids
= alc880_z71v_dac_nids
,
3264 .dig_out_nid
= ALC880_DIGOUT_NID
,
3266 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3267 .channel_mode
= alc880_2_jack_modes
,
3268 .input_mux
= &alc880_capture_source
,
3271 .mixers
= { alc880_f1734_mixer
},
3272 .init_verbs
= { alc880_volume_init_verbs
,
3273 alc880_pin_f1734_init_verbs
},
3274 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
3275 .dac_nids
= alc880_f1734_dac_nids
,
3277 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3278 .channel_mode
= alc880_2_jack_modes
,
3279 .input_mux
= &alc880_f1734_capture_source
,
3280 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3281 .init_hook
= alc880_uniwill_p53_hp_automute
,
3284 .mixers
= { alc880_asus_mixer
},
3285 .init_verbs
= { alc880_volume_init_verbs
,
3286 alc880_pin_asus_init_verbs
,
3287 alc880_gpio1_init_verbs
},
3288 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3289 .dac_nids
= alc880_asus_dac_nids
,
3290 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3291 .channel_mode
= alc880_asus_modes
,
3293 .input_mux
= &alc880_capture_source
,
3295 [ALC880_ASUS_DIG
] = {
3296 .mixers
= { alc880_asus_mixer
},
3297 .init_verbs
= { alc880_volume_init_verbs
,
3298 alc880_pin_asus_init_verbs
,
3299 alc880_gpio1_init_verbs
},
3300 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3301 .dac_nids
= alc880_asus_dac_nids
,
3302 .dig_out_nid
= ALC880_DIGOUT_NID
,
3303 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3304 .channel_mode
= alc880_asus_modes
,
3306 .input_mux
= &alc880_capture_source
,
3308 [ALC880_ASUS_DIG2
] = {
3309 .mixers
= { alc880_asus_mixer
},
3310 .init_verbs
= { alc880_volume_init_verbs
,
3311 alc880_pin_asus_init_verbs
,
3312 alc880_gpio2_init_verbs
}, /* use GPIO2 */
3313 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3314 .dac_nids
= alc880_asus_dac_nids
,
3315 .dig_out_nid
= ALC880_DIGOUT_NID
,
3316 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3317 .channel_mode
= alc880_asus_modes
,
3319 .input_mux
= &alc880_capture_source
,
3321 [ALC880_ASUS_W1V
] = {
3322 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
3323 .init_verbs
= { alc880_volume_init_verbs
,
3324 alc880_pin_asus_init_verbs
,
3325 alc880_gpio1_init_verbs
},
3326 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3327 .dac_nids
= alc880_asus_dac_nids
,
3328 .dig_out_nid
= ALC880_DIGOUT_NID
,
3329 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3330 .channel_mode
= alc880_asus_modes
,
3332 .input_mux
= &alc880_capture_source
,
3334 [ALC880_UNIWILL_DIG
] = {
3335 .mixers
= { alc880_asus_mixer
, alc880_pcbeep_mixer
},
3336 .init_verbs
= { alc880_volume_init_verbs
,
3337 alc880_pin_asus_init_verbs
},
3338 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3339 .dac_nids
= alc880_asus_dac_nids
,
3340 .dig_out_nid
= ALC880_DIGOUT_NID
,
3341 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3342 .channel_mode
= alc880_asus_modes
,
3344 .input_mux
= &alc880_capture_source
,
3346 [ALC880_UNIWILL
] = {
3347 .mixers
= { alc880_uniwill_mixer
},
3348 .init_verbs
= { alc880_volume_init_verbs
,
3349 alc880_uniwill_init_verbs
},
3350 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3351 .dac_nids
= alc880_asus_dac_nids
,
3352 .dig_out_nid
= ALC880_DIGOUT_NID
,
3353 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3354 .channel_mode
= alc880_threestack_modes
,
3356 .input_mux
= &alc880_capture_source
,
3357 .unsol_event
= alc880_uniwill_unsol_event
,
3358 .init_hook
= alc880_uniwill_automute
,
3360 [ALC880_UNIWILL_P53
] = {
3361 .mixers
= { alc880_uniwill_p53_mixer
},
3362 .init_verbs
= { alc880_volume_init_verbs
,
3363 alc880_uniwill_p53_init_verbs
},
3364 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3365 .dac_nids
= alc880_asus_dac_nids
,
3366 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3367 .channel_mode
= alc880_threestack_modes
,
3368 .input_mux
= &alc880_capture_source
,
3369 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3370 .init_hook
= alc880_uniwill_p53_hp_automute
,
3372 [ALC880_FUJITSU
] = {
3373 .mixers
= { alc880_fujitsu_mixer
,
3374 alc880_pcbeep_mixer
, },
3375 .init_verbs
= { alc880_volume_init_verbs
,
3376 alc880_uniwill_p53_init_verbs
,
3377 alc880_beep_init_verbs
},
3378 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3379 .dac_nids
= alc880_dac_nids
,
3380 .dig_out_nid
= ALC880_DIGOUT_NID
,
3381 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3382 .channel_mode
= alc880_2_jack_modes
,
3383 .input_mux
= &alc880_capture_source
,
3384 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3385 .init_hook
= alc880_uniwill_p53_hp_automute
,
3388 .mixers
= { alc880_three_stack_mixer
},
3389 .init_verbs
= { alc880_volume_init_verbs
,
3390 alc880_pin_clevo_init_verbs
},
3391 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3392 .dac_nids
= alc880_dac_nids
,
3394 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3395 .channel_mode
= alc880_threestack_modes
,
3397 .input_mux
= &alc880_capture_source
,
3400 .mixers
= { alc880_lg_mixer
},
3401 .init_verbs
= { alc880_volume_init_verbs
,
3402 alc880_lg_init_verbs
},
3403 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
3404 .dac_nids
= alc880_lg_dac_nids
,
3405 .dig_out_nid
= ALC880_DIGOUT_NID
,
3406 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
3407 .channel_mode
= alc880_lg_ch_modes
,
3409 .input_mux
= &alc880_lg_capture_source
,
3410 .unsol_event
= alc880_lg_unsol_event
,
3411 .init_hook
= alc880_lg_automute
,
3412 #ifdef CONFIG_SND_HDA_POWER_SAVE
3413 .loopbacks
= alc880_lg_loopbacks
,
3417 .mixers
= { alc880_lg_lw_mixer
},
3418 .init_verbs
= { alc880_volume_init_verbs
,
3419 alc880_lg_lw_init_verbs
},
3420 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3421 .dac_nids
= alc880_dac_nids
,
3422 .dig_out_nid
= ALC880_DIGOUT_NID
,
3423 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
3424 .channel_mode
= alc880_lg_lw_modes
,
3425 .input_mux
= &alc880_lg_lw_capture_source
,
3426 .unsol_event
= alc880_lg_lw_unsol_event
,
3427 .init_hook
= alc880_lg_lw_automute
,
3429 [ALC880_MEDION_RIM
] = {
3430 .mixers
= { alc880_medion_rim_mixer
},
3431 .init_verbs
= { alc880_volume_init_verbs
,
3432 alc880_medion_rim_init_verbs
,
3433 alc_gpio2_init_verbs
},
3434 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3435 .dac_nids
= alc880_dac_nids
,
3436 .dig_out_nid
= ALC880_DIGOUT_NID
,
3437 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3438 .channel_mode
= alc880_2_jack_modes
,
3439 .input_mux
= &alc880_medion_rim_capture_source
,
3440 .unsol_event
= alc880_medion_rim_unsol_event
,
3441 .init_hook
= alc880_medion_rim_automute
,
3443 #ifdef CONFIG_SND_DEBUG
3445 .mixers
= { alc880_test_mixer
},
3446 .init_verbs
= { alc880_test_init_verbs
},
3447 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
3448 .dac_nids
= alc880_test_dac_nids
,
3449 .dig_out_nid
= ALC880_DIGOUT_NID
,
3450 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
3451 .channel_mode
= alc880_test_modes
,
3452 .input_mux
= &alc880_test_capture_source
,
3458 * Automatic parse of I/O pins from the BIOS configuration
3461 #define NUM_CONTROL_ALLOC 32
3462 #define NUM_VERB_ALLOC 32
3466 ALC_CTL_WIDGET_MUTE
,
3469 static struct snd_kcontrol_new alc880_control_templates
[] = {
3470 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
3471 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
3472 HDA_BIND_MUTE(NULL
, 0, 0, 0),
3475 /* add dynamic controls */
3476 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
3479 struct snd_kcontrol_new
*knew
;
3481 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
3482 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
3484 /* array + terminator */
3485 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
);
3488 if (spec
->kctl_alloc
) {
3489 memcpy(knew
, spec
->kctl_alloc
,
3490 sizeof(*knew
) * spec
->num_kctl_alloc
);
3491 kfree(spec
->kctl_alloc
);
3493 spec
->kctl_alloc
= knew
;
3494 spec
->num_kctl_alloc
= num
;
3497 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
3498 *knew
= alc880_control_templates
[type
];
3499 knew
->name
= kstrdup(name
, GFP_KERNEL
);
3502 knew
->private_value
= val
;
3503 spec
->num_kctl_used
++;
3507 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3508 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3509 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3510 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3511 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3512 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3513 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3514 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3515 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3516 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3517 #define ALC880_PIN_CD_NID 0x1c
3519 /* fill in the dac_nids table from the parsed pin configuration */
3520 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
3521 const struct auto_pin_cfg
*cfg
)
3527 memset(assigned
, 0, sizeof(assigned
));
3528 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
3530 /* check the pins hardwired to audio widget */
3531 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3532 nid
= cfg
->line_out_pins
[i
];
3533 if (alc880_is_fixed_pin(nid
)) {
3534 int idx
= alc880_fixed_pin_idx(nid
);
3535 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
3539 /* left pins can be connect to any audio widget */
3540 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3541 nid
= cfg
->line_out_pins
[i
];
3542 if (alc880_is_fixed_pin(nid
))
3544 /* search for an empty channel */
3545 for (j
= 0; j
< cfg
->line_outs
; j
++) {
3547 spec
->multiout
.dac_nids
[i
] =
3548 alc880_idx_to_dac(j
);
3554 spec
->multiout
.num_dacs
= cfg
->line_outs
;
3558 /* add playback controls from the parsed DAC table */
3559 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
3560 const struct auto_pin_cfg
*cfg
)
3563 static const char *chname
[4] = {
3564 "Front", "Surround", NULL
/*CLFE*/, "Side"
3569 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3570 if (!spec
->multiout
.dac_nids
[i
])
3572 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
3575 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3576 "Center Playback Volume",
3577 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
3581 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3582 "LFE Playback Volume",
3583 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
3587 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3588 "Center Playback Switch",
3589 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
3593 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3594 "LFE Playback Switch",
3595 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
3600 sprintf(name
, "%s Playback Volume", chname
[i
]);
3601 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3602 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
3606 sprintf(name
, "%s Playback Switch", chname
[i
]);
3607 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3608 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
3617 /* add playback controls for speaker and HP outputs */
3618 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
3628 if (alc880_is_fixed_pin(pin
)) {
3629 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
3630 /* specify the DAC as the extra output */
3631 if (!spec
->multiout
.hp_nid
)
3632 spec
->multiout
.hp_nid
= nid
;
3634 spec
->multiout
.extra_out_nid
[0] = nid
;
3635 /* control HP volume/switch on the output mixer amp */
3636 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
3637 sprintf(name
, "%s Playback Volume", pfx
);
3638 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3639 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
3642 sprintf(name
, "%s Playback Switch", pfx
);
3643 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3644 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
3647 } else if (alc880_is_multi_pin(pin
)) {
3648 /* set manual connection */
3649 /* we have only a switch on HP-out PIN */
3650 sprintf(name
, "%s Playback Switch", pfx
);
3651 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3652 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
3659 /* create input playback/capture controls for the given pin */
3660 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
3661 const char *ctlname
,
3662 int idx
, hda_nid_t mix_nid
)
3667 sprintf(name
, "%s Playback Volume", ctlname
);
3668 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3669 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3672 sprintf(name
, "%s Playback Switch", ctlname
);
3673 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3674 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3680 /* create playback/capture controls for input pins */
3681 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
3682 const struct auto_pin_cfg
*cfg
)
3684 struct hda_input_mux
*imux
= &spec
->private_imux
;
3687 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3688 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
3689 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
3690 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
3691 auto_pin_cfg_labels
[i
],
3695 imux
->items
[imux
->num_items
].label
=
3696 auto_pin_cfg_labels
[i
];
3697 imux
->items
[imux
->num_items
].index
=
3698 alc880_input_pin_idx(cfg
->input_pins
[i
]);
3705 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
3706 unsigned int pin_type
)
3708 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
3711 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
3715 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
3716 hda_nid_t nid
, int pin_type
,
3719 alc_set_pin_output(codec
, nid
, pin_type
);
3720 /* need the manual connection? */
3721 if (alc880_is_multi_pin(nid
)) {
3722 struct alc_spec
*spec
= codec
->spec
;
3723 int idx
= alc880_multi_pin_idx(nid
);
3724 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
3725 AC_VERB_SET_CONNECT_SEL
,
3726 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
3730 static int get_pin_type(int line_out_type
)
3732 if (line_out_type
== AUTO_PIN_HP_OUT
)
3738 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
3740 struct alc_spec
*spec
= codec
->spec
;
3743 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
3744 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
3745 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
3746 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
3747 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
3751 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
3753 struct alc_spec
*spec
= codec
->spec
;
3756 pin
= spec
->autocfg
.speaker_pins
[0];
3757 if (pin
) /* connect to front */
3758 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
3759 pin
= spec
->autocfg
.hp_pins
[0];
3760 if (pin
) /* connect to front */
3761 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
3764 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
3766 struct alc_spec
*spec
= codec
->spec
;
3769 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3770 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
3771 if (alc880_is_input_pin(nid
)) {
3772 snd_hda_codec_write(codec
, nid
, 0,
3773 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3774 i
<= AUTO_PIN_FRONT_MIC
?
3775 PIN_VREF80
: PIN_IN
);
3776 if (nid
!= ALC880_PIN_CD_NID
)
3777 snd_hda_codec_write(codec
, nid
, 0,
3778 AC_VERB_SET_AMP_GAIN_MUTE
,
3784 /* parse the BIOS configuration and set up the alc_spec */
3785 /* return 1 if successful, 0 if the proper config is not found,
3786 * or a negative error code
3788 static int alc880_parse_auto_config(struct hda_codec
*codec
)
3790 struct alc_spec
*spec
= codec
->spec
;
3792 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
3794 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
3798 if (!spec
->autocfg
.line_outs
)
3799 return 0; /* can't find valid BIOS pin config */
3801 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
3804 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
3807 err
= alc880_auto_create_extra_out(spec
,
3808 spec
->autocfg
.speaker_pins
[0],
3812 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
3816 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
3820 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
3822 if (spec
->autocfg
.dig_out_pin
)
3823 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
3824 if (spec
->autocfg
.dig_in_pin
)
3825 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
3827 if (spec
->kctl_alloc
)
3828 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3830 spec
->init_verbs
[spec
->num_init_verbs
++] = alc880_volume_init_verbs
;
3832 spec
->num_mux_defs
= 1;
3833 spec
->input_mux
= &spec
->private_imux
;
3838 /* additional initialization for auto-configuration model */
3839 static void alc880_auto_init(struct hda_codec
*codec
)
3841 struct alc_spec
*spec
= codec
->spec
;
3842 alc880_auto_init_multi_out(codec
);
3843 alc880_auto_init_extra_out(codec
);
3844 alc880_auto_init_analog_input(codec
);
3845 if (spec
->unsol_event
)
3846 alc_inithook(codec
);
3850 * OK, here we have finally the patch for ALC880
3853 static int patch_alc880(struct hda_codec
*codec
)
3855 struct alc_spec
*spec
;
3859 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3865 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
3868 if (board_config
< 0) {
3869 printk(KERN_INFO
"hda_codec: Unknown model for ALC880, "
3870 "trying auto-probe from BIOS...\n");
3871 board_config
= ALC880_AUTO
;
3874 if (board_config
== ALC880_AUTO
) {
3875 /* automatic parse from the BIOS config */
3876 err
= alc880_parse_auto_config(codec
);
3882 "hda_codec: Cannot set up configuration "
3883 "from BIOS. Using 3-stack mode...\n");
3884 board_config
= ALC880_3ST
;
3888 if (board_config
!= ALC880_AUTO
)
3889 setup_preset(spec
, &alc880_presets
[board_config
]);
3891 spec
->stream_name_analog
= "ALC880 Analog";
3892 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
3893 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
3894 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
3896 spec
->stream_name_digital
= "ALC880 Digital";
3897 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
3898 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
3900 if (!spec
->adc_nids
&& spec
->input_mux
) {
3901 /* check whether NID 0x07 is valid */
3902 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
3904 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
3905 if (wcap
!= AC_WID_AUD_IN
) {
3906 spec
->adc_nids
= alc880_adc_nids_alt
;
3907 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
3908 spec
->mixers
[spec
->num_mixers
] =
3909 alc880_capture_alt_mixer
;
3912 spec
->adc_nids
= alc880_adc_nids
;
3913 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
3914 spec
->mixers
[spec
->num_mixers
] = alc880_capture_mixer
;
3919 spec
->vmaster_nid
= 0x0c;
3921 codec
->patch_ops
= alc_patch_ops
;
3922 if (board_config
== ALC880_AUTO
)
3923 spec
->init_hook
= alc880_auto_init
;
3924 #ifdef CONFIG_SND_HDA_POWER_SAVE
3925 if (!spec
->loopback
.amplist
)
3926 spec
->loopback
.amplist
= alc880_loopbacks
;
3937 static hda_nid_t alc260_dac_nids
[1] = {
3942 static hda_nid_t alc260_adc_nids
[1] = {
3947 static hda_nid_t alc260_adc_nids_alt
[1] = {
3952 static hda_nid_t alc260_hp_adc_nids
[2] = {
3957 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3958 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3960 static hda_nid_t alc260_dual_adc_nids
[2] = {
3965 #define ALC260_DIGOUT_NID 0x03
3966 #define ALC260_DIGIN_NID 0x06
3968 static struct hda_input_mux alc260_capture_source
= {
3972 { "Front Mic", 0x1 },
3978 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3979 * headphone jack and the internal CD lines since these are the only pins at
3980 * which audio can appear. For flexibility, also allow the option of
3981 * recording the mixer output on the second ADC (ADC0 doesn't have a
3982 * connection to the mixer output).
3984 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
3988 { "Mic/Line", 0x0 },
3990 { "Headphone", 0x2 },
3996 { "Mic/Line", 0x0 },
3998 { "Headphone", 0x2 },
4005 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4006 * the Fujitsu S702x, but jacks are marked differently.
4008 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
4015 { "Headphone", 0x5 },
4024 { "Headphone", 0x6 },
4030 * This is just place-holder, so there's something for alc_build_pcms to look
4031 * at when it calculates the maximum number of channels. ALC260 has no mixer
4032 * element which allows changing the channel mode, so the verb list is
4035 static struct hda_channel_mode alc260_modes
[1] = {
4040 /* Mixer combinations
4042 * basic: base_output + input + pc_beep + capture
4043 * HP: base_output + input + capture_alt
4044 * HP_3013: hp_3013 + input + capture
4045 * fujitsu: fujitsu + capture
4046 * acer: acer + capture
4049 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
4050 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4051 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
4052 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4053 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
4054 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4055 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4059 static struct snd_kcontrol_new alc260_input_mixer
[] = {
4060 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4061 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4062 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4063 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4064 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4065 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4066 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
4067 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
4071 static struct snd_kcontrol_new alc260_pc_beep_mixer
[] = {
4072 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT
),
4073 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT
),
4077 /* update HP, line and mono out pins according to the master switch */
4078 static void alc260_hp_master_update(struct hda_codec
*codec
,
4079 hda_nid_t hp
, hda_nid_t line
,
4082 struct alc_spec
*spec
= codec
->spec
;
4083 unsigned int val
= spec
->master_sw
? PIN_HP
: 0;
4084 /* change HP and line-out pins */
4085 snd_hda_codec_write(codec
, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4087 snd_hda_codec_write(codec
, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4089 /* mono (speaker) depending on the HP jack sense */
4090 val
= (val
&& !spec
->jack_present
) ? PIN_OUT
: 0;
4091 snd_hda_codec_write(codec
, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4095 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
4096 struct snd_ctl_elem_value
*ucontrol
)
4098 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4099 struct alc_spec
*spec
= codec
->spec
;
4100 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
4104 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
4105 struct snd_ctl_elem_value
*ucontrol
)
4107 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4108 struct alc_spec
*spec
= codec
->spec
;
4109 int val
= !!*ucontrol
->value
.integer
.value
;
4110 hda_nid_t hp
, line
, mono
;
4112 if (val
== spec
->master_sw
)
4114 spec
->master_sw
= val
;
4115 hp
= (kcontrol
->private_value
>> 16) & 0xff;
4116 line
= (kcontrol
->private_value
>> 8) & 0xff;
4117 mono
= kcontrol
->private_value
& 0xff;
4118 alc260_hp_master_update(codec
, hp
, line
, mono
);
4122 static struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
4124 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4125 .name
= "Master Playback Switch",
4126 .info
= snd_ctl_boolean_mono_info
,
4127 .get
= alc260_hp_master_sw_get
,
4128 .put
= alc260_hp_master_sw_put
,
4129 .private_value
= (0x0f << 16) | (0x10 << 8) | 0x11
4131 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4132 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
4133 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4134 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
4135 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4137 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4141 static struct hda_verb alc260_hp_unsol_verbs
[] = {
4142 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4146 static void alc260_hp_automute(struct hda_codec
*codec
)
4148 struct alc_spec
*spec
= codec
->spec
;
4149 unsigned int present
;
4151 present
= snd_hda_codec_read(codec
, 0x10, 0,
4152 AC_VERB_GET_PIN_SENSE
, 0);
4153 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4154 alc260_hp_master_update(codec
, 0x0f, 0x10, 0x11);
4157 static void alc260_hp_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4159 if ((res
>> 26) == ALC880_HP_EVENT
)
4160 alc260_hp_automute(codec
);
4163 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
4165 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4166 .name
= "Master Playback Switch",
4167 .info
= snd_ctl_boolean_mono_info
,
4168 .get
= alc260_hp_master_sw_get
,
4169 .put
= alc260_hp_master_sw_put
,
4170 .private_value
= (0x10 << 16) | (0x15 << 8) | 0x11
4172 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4173 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
4174 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
4175 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
4176 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4177 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
4178 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4179 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
4183 static struct hda_bind_ctls alc260_dc7600_bind_master_vol
= {
4184 .ops
= &snd_hda_bind_vol
,
4186 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT
),
4187 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT
),
4188 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT
),
4193 static struct hda_bind_ctls alc260_dc7600_bind_switch
= {
4194 .ops
= &snd_hda_bind_sw
,
4196 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT
),
4197 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
4202 static struct snd_kcontrol_new alc260_hp_dc7600_mixer
[] = {
4203 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol
),
4204 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch
),
4205 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT
),
4206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
4210 static struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
4211 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4215 static void alc260_hp_3013_automute(struct hda_codec
*codec
)
4217 struct alc_spec
*spec
= codec
->spec
;
4218 unsigned int present
;
4220 present
= snd_hda_codec_read(codec
, 0x15, 0,
4221 AC_VERB_GET_PIN_SENSE
, 0);
4222 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4223 alc260_hp_master_update(codec
, 0x10, 0x15, 0x11);
4226 static void alc260_hp_3013_unsol_event(struct hda_codec
*codec
,
4229 if ((res
>> 26) == ALC880_HP_EVENT
)
4230 alc260_hp_3013_automute(codec
);
4233 static void alc260_hp_3012_automute(struct hda_codec
*codec
)
4235 unsigned int present
, bits
;
4237 present
= snd_hda_codec_read(codec
, 0x10, 0,
4238 AC_VERB_GET_PIN_SENSE
, 0) & AC_PINSENSE_PRESENCE
;
4240 bits
= present
? 0 : PIN_OUT
;
4241 snd_hda_codec_write(codec
, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4243 snd_hda_codec_write(codec
, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4245 snd_hda_codec_write(codec
, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4249 static void alc260_hp_3012_unsol_event(struct hda_codec
*codec
,
4252 if ((res
>> 26) == ALC880_HP_EVENT
)
4253 alc260_hp_3012_automute(codec
);
4256 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4257 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4259 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
4260 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4261 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
4262 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4263 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4264 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4265 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
4266 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
4267 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4268 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4269 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4270 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4271 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
4275 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4276 * versions of the ALC260 don't act on requests to enable mic bias from NID
4277 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4278 * datasheet doesn't mention this restriction. At this stage it's not clear
4279 * whether this behaviour is intentional or is a hardware bug in chip
4280 * revisions available in early 2006. Therefore for now allow the
4281 * "Headphone Jack Mode" control to span all choices, but if it turns out
4282 * that the lack of mic bias for this NID is intentional we could change the
4283 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4285 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4286 * don't appear to make the mic bias available from the "line" jack, even
4287 * though the NID used for this jack (0x14) can supply it. The theory is
4288 * that perhaps Acer have included blocking capacitors between the ALC260
4289 * and the output jack. If this turns out to be the case for all such
4290 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4291 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4293 * The C20x Tablet series have a mono internal speaker which is controlled
4294 * via the chip's Mono sum widget and pin complex, so include the necessary
4295 * controls for such models. On models without a "mono speaker" the control
4296 * won't do anything.
4298 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
4299 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4300 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
4301 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
4302 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4304 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4306 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4307 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4308 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4309 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4310 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4311 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4312 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4313 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4314 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4315 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4319 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4320 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4322 static struct snd_kcontrol_new alc260_will_mixer
[] = {
4323 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4324 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
4325 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4326 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4327 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4328 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4329 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4330 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4331 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4332 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4333 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4334 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4338 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4339 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4341 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
4342 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4343 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
4344 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4345 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4346 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4347 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
4348 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
4349 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4350 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4351 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4355 /* capture mixer elements */
4356 static struct snd_kcontrol_new alc260_capture_mixer
[] = {
4357 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT
),
4358 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT
),
4359 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT
),
4360 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT
),
4362 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4363 /* The multiple "Capture Source" controls confuse alsamixer
4364 * So call somewhat different..
4366 /* .name = "Capture Source", */
4367 .name
= "Input Source",
4369 .info
= alc_mux_enum_info
,
4370 .get
= alc_mux_enum_get
,
4371 .put
= alc_mux_enum_put
,
4376 static struct snd_kcontrol_new alc260_capture_alt_mixer
[] = {
4377 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT
),
4378 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT
),
4380 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4381 /* The multiple "Capture Source" controls confuse alsamixer
4382 * So call somewhat different..
4384 /* .name = "Capture Source", */
4385 .name
= "Input Source",
4387 .info
= alc_mux_enum_info
,
4388 .get
= alc_mux_enum_get
,
4389 .put
= alc_mux_enum_put
,
4395 * initialization verbs
4397 static struct hda_verb alc260_init_verbs
[] = {
4398 /* Line In pin widget for input */
4399 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4400 /* CD pin widget for input */
4401 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4402 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4403 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4404 /* Mic2 (front panel) pin widget for input and vref at 80% */
4405 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4406 /* LINE-2 is used for line-out in rear */
4407 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4408 /* select line-out */
4409 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
4411 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4413 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4415 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4416 /* mute capture amp left and right */
4417 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4418 /* set connection select to line in (default select for this ADC) */
4419 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4420 /* mute capture amp left and right */
4421 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4422 /* set connection select to line in (default select for this ADC) */
4423 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
4424 /* set vol=0 Line-Out mixer amp left and right */
4425 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4426 /* unmute pin widget amp left and right (no gain on this amp) */
4427 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4428 /* set vol=0 HP mixer amp left and right */
4429 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4430 /* unmute pin widget amp left and right (no gain on this amp) */
4431 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4432 /* set vol=0 Mono mixer amp left and right */
4433 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4434 /* unmute pin widget amp left and right (no gain on this amp) */
4435 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4436 /* unmute LINE-2 out pin */
4437 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4438 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4441 /* mute analog inputs */
4442 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4443 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4444 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4445 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4446 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4447 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4448 /* mute Front out path */
4449 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4450 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4451 /* mute Headphone out path */
4452 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4453 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4454 /* mute Mono out path */
4455 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4456 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4460 #if 0 /* should be identical with alc260_init_verbs? */
4461 static struct hda_verb alc260_hp_init_verbs
[] = {
4462 /* Headphone and output */
4463 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
4465 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4466 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4467 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4468 /* Mic2 (front panel) pin widget for input and vref at 80% */
4469 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4470 /* Line In pin widget for input */
4471 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4472 /* Line-2 pin widget for output */
4473 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4474 /* CD pin widget for input */
4475 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4476 /* unmute amp left and right */
4477 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
4478 /* set connection select to line in (default select for this ADC) */
4479 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4480 /* unmute Line-Out mixer amp left and right (volume = 0) */
4481 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4482 /* mute pin widget amp left and right (no gain on this amp) */
4483 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4484 /* unmute HP mixer amp left and right (volume = 0) */
4485 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4486 /* mute pin widget amp left and right (no gain on this amp) */
4487 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4488 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4491 /* mute analog inputs */
4492 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4494 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4495 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4496 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4497 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4498 /* Unmute Front out path */
4499 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4500 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4501 /* Unmute Headphone out path */
4502 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4503 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4504 /* Unmute Mono out path */
4505 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4506 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4511 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
4512 /* Line out and output */
4513 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4515 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4516 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4517 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4518 /* Mic2 (front panel) pin widget for input and vref at 80% */
4519 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4520 /* Line In pin widget for input */
4521 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4522 /* Headphone pin widget for output */
4523 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
4524 /* CD pin widget for input */
4525 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4526 /* unmute amp left and right */
4527 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
4528 /* set connection select to line in (default select for this ADC) */
4529 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4530 /* unmute Line-Out mixer amp left and right (volume = 0) */
4531 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4532 /* mute pin widget amp left and right (no gain on this amp) */
4533 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4534 /* unmute HP mixer amp left and right (volume = 0) */
4535 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4536 /* mute pin widget amp left and right (no gain on this amp) */
4537 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4538 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4541 /* mute analog inputs */
4542 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4547 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4548 /* Unmute Front out path */
4549 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4550 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4551 /* Unmute Headphone out path */
4552 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4553 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4554 /* Unmute Mono out path */
4555 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4556 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4560 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4561 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4562 * audio = 0x16, internal speaker = 0x10.
4564 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
4565 /* Disable all GPIOs */
4566 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
4567 /* Internal speaker is connected to headphone pin */
4568 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4569 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4570 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4571 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4572 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4573 /* Ensure all other unused pins are disabled and muted. */
4574 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4575 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4576 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4577 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4578 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4579 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4580 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4581 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4583 /* Disable digital (SPDIF) pins */
4584 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4585 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4587 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4588 * when acting as an output.
4590 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4592 /* Start with output sum widgets muted and their output gains at min */
4593 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4598 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4599 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4600 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4601 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4603 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4604 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4605 /* Unmute Line1 pin widget output buffer since it starts as an output.
4606 * If the pin mode is changed by the user the pin mode control will
4607 * take care of enabling the pin's input/output buffers as needed.
4608 * Therefore there's no need to enable the input buffer at this
4611 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4612 /* Unmute input buffer of pin widget used for Line-in (no equiv
4615 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4617 /* Mute capture amp left and right */
4618 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4619 /* Set ADC connection select to match default mixer setting - line
4622 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4624 /* Do the same for the second ADC: mute capture input amp and
4625 * set ADC connection to line in (on mic1 pin)
4627 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4628 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4630 /* Mute all inputs to mixer widget (even unconnected ones) */
4631 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4633 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4638 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4643 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4644 * similar laptops (adapted from Fujitsu init verbs).
4646 static struct hda_verb alc260_acer_init_verbs
[] = {
4647 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4648 * the headphone jack. Turn this on and rely on the standard mute
4649 * methods whenever the user wants to turn these outputs off.
4651 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4652 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4653 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
4654 /* Internal speaker/Headphone jack is connected to Line-out pin */
4655 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4656 /* Internal microphone/Mic jack is connected to Mic1 pin */
4657 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
4658 /* Line In jack is connected to Line1 pin */
4659 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4660 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4661 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4662 /* Ensure all other unused pins are disabled and muted. */
4663 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4664 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4665 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4666 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4667 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4668 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4669 /* Disable digital (SPDIF) pins */
4670 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4671 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4673 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4674 * bus when acting as outputs.
4676 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4677 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4679 /* Start with output sum widgets muted and their output gains at min */
4680 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4681 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4682 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4683 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4684 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4685 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4686 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4687 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4688 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4690 /* Unmute Line-out pin widget amp left and right
4691 * (no equiv mixer ctrl)
4693 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4694 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4695 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4696 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4697 * inputs. If the pin mode is changed by the user the pin mode control
4698 * will take care of enabling the pin's input/output buffers as needed.
4699 * Therefore there's no need to enable the input buffer at this
4702 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4703 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4705 /* Mute capture amp left and right */
4706 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4707 /* Set ADC connection select to match default mixer setting - mic
4710 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4712 /* Do similar with the second ADC: mute capture input amp and
4713 * set ADC connection to mic to match ALSA's default state.
4715 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4716 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4718 /* Mute all inputs to mixer widget (even unconnected ones) */
4719 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4724 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4725 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4726 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4731 static struct hda_verb alc260_will_verbs
[] = {
4732 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4733 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
4734 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
4735 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4736 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4737 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
4741 static struct hda_verb alc260_replacer_672v_verbs
[] = {
4742 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4743 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4744 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
4746 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4747 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4748 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4750 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4754 /* toggle speaker-output according to the hp-jack state */
4755 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
4757 unsigned int present
;
4759 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4760 present
= snd_hda_codec_read(codec
, 0x0f, 0,
4761 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
4763 snd_hda_codec_write_cache(codec
, 0x01, 0,
4764 AC_VERB_SET_GPIO_DATA
, 1);
4765 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4766 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4769 snd_hda_codec_write_cache(codec
, 0x01, 0,
4770 AC_VERB_SET_GPIO_DATA
, 0);
4771 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4772 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4777 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
4780 if ((res
>> 26) == ALC880_HP_EVENT
)
4781 alc260_replacer_672v_automute(codec
);
4784 static struct hda_verb alc260_hp_dc7600_verbs
[] = {
4785 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x01},
4786 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
4787 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4788 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4789 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4790 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4791 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4792 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4793 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4794 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4798 /* Test configuration for debugging, modelled after the ALC880 test
4801 #ifdef CONFIG_SND_DEBUG
4802 static hda_nid_t alc260_test_dac_nids
[1] = {
4805 static hda_nid_t alc260_test_adc_nids
[2] = {
4808 /* For testing the ALC260, each input MUX needs its own definition since
4809 * the signal assignments are different. This assumes that the first ADC
4812 static struct hda_input_mux alc260_test_capture_sources
[2] = {
4816 { "MIC1 pin", 0x0 },
4817 { "MIC2 pin", 0x1 },
4818 { "LINE1 pin", 0x2 },
4819 { "LINE2 pin", 0x3 },
4821 { "LINE-OUT pin", 0x5 },
4822 { "HP-OUT pin", 0x6 },
4828 { "MIC1 pin", 0x0 },
4829 { "MIC2 pin", 0x1 },
4830 { "LINE1 pin", 0x2 },
4831 { "LINE2 pin", 0x3 },
4834 { "LINE-OUT pin", 0x6 },
4835 { "HP-OUT pin", 0x7 },
4839 static struct snd_kcontrol_new alc260_test_mixer
[] = {
4840 /* Output driver widgets */
4841 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4842 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4843 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4844 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
4845 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4846 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
4848 /* Modes for retasking pin widgets
4849 * Note: the ALC260 doesn't seem to act on requests to enable mic
4850 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4851 * mention this restriction. At this stage it's not clear whether
4852 * this behaviour is intentional or is a hardware bug in chip
4853 * revisions available at least up until early 2006. Therefore for
4854 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4855 * choices, but if it turns out that the lack of mic bias for these
4856 * NIDs is intentional we could change their modes from
4857 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4859 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
4860 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
4861 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
4862 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
4863 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
4864 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
4866 /* Loopback mixer controls */
4867 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
4868 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
4869 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
4870 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
4871 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
4872 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
4873 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
4874 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
4875 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4876 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4877 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4878 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4879 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
4880 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
4881 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
4882 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
4884 /* Controls for GPIO pins, assuming they are configured as outputs */
4885 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4886 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4887 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4888 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4890 /* Switches to allow the digital IO pins to be enabled. The datasheet
4891 * is ambigious as to which NID is which; testing on laptops which
4892 * make this output available should provide clarification.
4894 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4895 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4897 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4898 * this output to turn on an external amplifier.
4900 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4901 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4905 static struct hda_verb alc260_test_init_verbs
[] = {
4906 /* Enable all GPIOs as outputs with an initial value of 0 */
4907 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
4908 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4909 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
4911 /* Enable retasking pins as output, initially without power amp */
4912 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4913 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4914 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4915 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4916 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4917 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4919 /* Disable digital (SPDIF) pins initially, but users can enable
4920 * them via a mixer switch. In the case of SPDIF-out, this initverb
4921 * payload also sets the generation to 0, output to be in "consumer"
4922 * PCM format, copyright asserted, no pre-emphasis and no validity
4925 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4926 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4928 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4929 * OUT1 sum bus when acting as an output.
4931 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4932 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
4933 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4934 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
4936 /* Start with output sum widgets muted and their output gains at min */
4937 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4938 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4939 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4940 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4941 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4942 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4943 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4944 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4945 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4947 /* Unmute retasking pin widget output buffers since the default
4948 * state appears to be output. As the pin mode is changed by the
4949 * user the pin mode control will take care of enabling the pin's
4950 * input/output buffers as needed.
4952 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4953 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4954 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4955 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4956 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4957 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4958 /* Also unmute the mono-out pin widget */
4959 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4961 /* Mute capture amp left and right */
4962 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4963 /* Set ADC connection select to match default mixer setting (mic1
4966 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4968 /* Do the same for the second ADC: mute capture input amp and
4969 * set ADC connection to mic1 pin
4971 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4972 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4974 /* Mute all inputs to mixer widget (even unconnected ones) */
4975 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4976 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4977 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4978 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4979 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4980 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4981 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4982 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4988 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4989 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4991 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4992 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4995 * for BIOS auto-configuration
4998 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
4999 const char *pfx
, int *vol_bits
)
5002 unsigned long vol_val
, sw_val
;
5006 if (nid
>= 0x0f && nid
< 0x11) {
5007 nid_vol
= nid
- 0x7;
5008 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
5009 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
5010 } else if (nid
== 0x11) {
5011 nid_vol
= nid
- 0x7;
5012 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
5013 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
5014 } else if (nid
>= 0x12 && nid
<= 0x15) {
5016 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
5017 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
5021 if (!(*vol_bits
& (1 << nid_vol
))) {
5022 /* first control for the volume widget */
5023 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
5024 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
);
5027 *vol_bits
|= (1 << nid_vol
);
5029 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
5030 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
);
5036 /* add playback controls from the parsed DAC table */
5037 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
5038 const struct auto_pin_cfg
*cfg
)
5044 spec
->multiout
.num_dacs
= 1;
5045 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
5046 spec
->multiout
.dac_nids
[0] = 0x02;
5048 nid
= cfg
->line_out_pins
[0];
5050 err
= alc260_add_playback_controls(spec
, nid
, "Front", &vols
);
5055 nid
= cfg
->speaker_pins
[0];
5057 err
= alc260_add_playback_controls(spec
, nid
, "Speaker", &vols
);
5062 nid
= cfg
->hp_pins
[0];
5064 err
= alc260_add_playback_controls(spec
, nid
, "Headphone",
5072 /* create playback/capture controls for input pins */
5073 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
5074 const struct auto_pin_cfg
*cfg
)
5076 struct hda_input_mux
*imux
= &spec
->private_imux
;
5079 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5080 if (cfg
->input_pins
[i
] >= 0x12) {
5081 idx
= cfg
->input_pins
[i
] - 0x12;
5082 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
5083 auto_pin_cfg_labels
[i
], idx
,
5087 imux
->items
[imux
->num_items
].label
=
5088 auto_pin_cfg_labels
[i
];
5089 imux
->items
[imux
->num_items
].index
= idx
;
5092 if (cfg
->input_pins
[i
] >= 0x0f && cfg
->input_pins
[i
] <= 0x10){
5093 idx
= cfg
->input_pins
[i
] - 0x09;
5094 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
5095 auto_pin_cfg_labels
[i
], idx
,
5099 imux
->items
[imux
->num_items
].label
=
5100 auto_pin_cfg_labels
[i
];
5101 imux
->items
[imux
->num_items
].index
= idx
;
5108 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
5109 hda_nid_t nid
, int pin_type
,
5112 alc_set_pin_output(codec
, nid
, pin_type
);
5113 /* need the manual connection? */
5115 int idx
= nid
- 0x12;
5116 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
5117 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
5121 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
5123 struct alc_spec
*spec
= codec
->spec
;
5126 alc_subsystem_id(codec
, 0x10, 0x15, 0x0f);
5127 nid
= spec
->autocfg
.line_out_pins
[0];
5129 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5130 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
5133 nid
= spec
->autocfg
.speaker_pins
[0];
5135 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
5137 nid
= spec
->autocfg
.hp_pins
[0];
5139 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
5142 #define ALC260_PIN_CD_NID 0x16
5143 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
5145 struct alc_spec
*spec
= codec
->spec
;
5148 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5149 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5151 snd_hda_codec_write(codec
, nid
, 0,
5152 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5153 i
<= AUTO_PIN_FRONT_MIC
?
5154 PIN_VREF80
: PIN_IN
);
5155 if (nid
!= ALC260_PIN_CD_NID
)
5156 snd_hda_codec_write(codec
, nid
, 0,
5157 AC_VERB_SET_AMP_GAIN_MUTE
,
5164 * generic initialization of ADC, input mixers and output mixers
5166 static struct hda_verb alc260_volume_init_verbs
[] = {
5168 * Unmute ADC0-1 and set the default input to mic-in
5170 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5171 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5172 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5173 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5175 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5177 * Note: PASD motherboards uses the Line In 2 as the input for
5178 * front panel mic (mic 2)
5180 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5181 /* mute analog inputs */
5182 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5183 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5184 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5185 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5186 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5189 * Set up output mixers (0x08 - 0x0a)
5191 /* set vol=0 to output mixers */
5192 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5193 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5194 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5195 /* set up input amps for analog loopback */
5196 /* Amp Indices: DAC = 0, mixer = 1 */
5197 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5198 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5199 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5200 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5201 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5202 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5207 static int alc260_parse_auto_config(struct hda_codec
*codec
)
5209 struct alc_spec
*spec
= codec
->spec
;
5212 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
5214 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5218 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
5221 if (!spec
->kctl_alloc
)
5222 return 0; /* can't find valid BIOS pin config */
5223 err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
5227 spec
->multiout
.max_channels
= 2;
5229 if (spec
->autocfg
.dig_out_pin
)
5230 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
5231 if (spec
->kctl_alloc
)
5232 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
5234 spec
->init_verbs
[spec
->num_init_verbs
++] = alc260_volume_init_verbs
;
5236 spec
->num_mux_defs
= 1;
5237 spec
->input_mux
= &spec
->private_imux
;
5239 /* check whether NID 0x04 is valid */
5240 wcap
= get_wcaps(codec
, 0x04);
5241 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
5242 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
5243 spec
->adc_nids
= alc260_adc_nids_alt
;
5244 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
5245 spec
->mixers
[spec
->num_mixers
] = alc260_capture_alt_mixer
;
5247 spec
->adc_nids
= alc260_adc_nids
;
5248 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
5249 spec
->mixers
[spec
->num_mixers
] = alc260_capture_mixer
;
5256 /* additional initialization for auto-configuration model */
5257 static void alc260_auto_init(struct hda_codec
*codec
)
5259 struct alc_spec
*spec
= codec
->spec
;
5260 alc260_auto_init_multi_out(codec
);
5261 alc260_auto_init_analog_input(codec
);
5262 if (spec
->unsol_event
)
5263 alc_inithook(codec
);
5266 #ifdef CONFIG_SND_HDA_POWER_SAVE
5267 static struct hda_amp_list alc260_loopbacks
[] = {
5268 { 0x07, HDA_INPUT
, 0 },
5269 { 0x07, HDA_INPUT
, 1 },
5270 { 0x07, HDA_INPUT
, 2 },
5271 { 0x07, HDA_INPUT
, 3 },
5272 { 0x07, HDA_INPUT
, 4 },
5278 * ALC260 configurations
5280 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
5281 [ALC260_BASIC
] = "basic",
5283 [ALC260_HP_3013
] = "hp-3013",
5284 [ALC260_HP_DC7600
] = "hp-dc7600",
5285 [ALC260_FUJITSU_S702X
] = "fujitsu",
5286 [ALC260_ACER
] = "acer",
5287 [ALC260_WILL
] = "will",
5288 [ALC260_REPLACER_672V
] = "replacer",
5289 #ifdef CONFIG_SND_DEBUG
5290 [ALC260_TEST
] = "test",
5292 [ALC260_AUTO
] = "auto",
5295 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
5296 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
5297 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
5298 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
5299 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013
),
5300 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
5301 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013
),
5302 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600
),
5303 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
5304 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
5305 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
5306 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
5307 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
5308 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
5309 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
5310 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
5311 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
5312 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
5313 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
5317 static struct alc_config_preset alc260_presets
[] = {
5319 .mixers
= { alc260_base_output_mixer
,
5321 alc260_pc_beep_mixer
,
5322 alc260_capture_mixer
},
5323 .init_verbs
= { alc260_init_verbs
},
5324 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5325 .dac_nids
= alc260_dac_nids
,
5326 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5327 .adc_nids
= alc260_adc_nids
,
5328 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5329 .channel_mode
= alc260_modes
,
5330 .input_mux
= &alc260_capture_source
,
5333 .mixers
= { alc260_hp_output_mixer
,
5335 alc260_capture_alt_mixer
},
5336 .init_verbs
= { alc260_init_verbs
,
5337 alc260_hp_unsol_verbs
},
5338 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5339 .dac_nids
= alc260_dac_nids
,
5340 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
5341 .adc_nids
= alc260_hp_adc_nids
,
5342 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5343 .channel_mode
= alc260_modes
,
5344 .input_mux
= &alc260_capture_source
,
5345 .unsol_event
= alc260_hp_unsol_event
,
5346 .init_hook
= alc260_hp_automute
,
5348 [ALC260_HP_DC7600
] = {
5349 .mixers
= { alc260_hp_dc7600_mixer
,
5351 alc260_capture_alt_mixer
},
5352 .init_verbs
= { alc260_init_verbs
,
5353 alc260_hp_dc7600_verbs
},
5354 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5355 .dac_nids
= alc260_dac_nids
,
5356 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
5357 .adc_nids
= alc260_hp_adc_nids
,
5358 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5359 .channel_mode
= alc260_modes
,
5360 .input_mux
= &alc260_capture_source
,
5361 .unsol_event
= alc260_hp_3012_unsol_event
,
5362 .init_hook
= alc260_hp_3012_automute
,
5364 [ALC260_HP_3013
] = {
5365 .mixers
= { alc260_hp_3013_mixer
,
5367 alc260_capture_alt_mixer
},
5368 .init_verbs
= { alc260_hp_3013_init_verbs
,
5369 alc260_hp_3013_unsol_verbs
},
5370 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5371 .dac_nids
= alc260_dac_nids
,
5372 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
5373 .adc_nids
= alc260_hp_adc_nids
,
5374 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5375 .channel_mode
= alc260_modes
,
5376 .input_mux
= &alc260_capture_source
,
5377 .unsol_event
= alc260_hp_3013_unsol_event
,
5378 .init_hook
= alc260_hp_3013_automute
,
5380 [ALC260_FUJITSU_S702X
] = {
5381 .mixers
= { alc260_fujitsu_mixer
,
5382 alc260_capture_mixer
},
5383 .init_verbs
= { alc260_fujitsu_init_verbs
},
5384 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5385 .dac_nids
= alc260_dac_nids
,
5386 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5387 .adc_nids
= alc260_dual_adc_nids
,
5388 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5389 .channel_mode
= alc260_modes
,
5390 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
5391 .input_mux
= alc260_fujitsu_capture_sources
,
5394 .mixers
= { alc260_acer_mixer
,
5395 alc260_capture_mixer
},
5396 .init_verbs
= { alc260_acer_init_verbs
},
5397 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5398 .dac_nids
= alc260_dac_nids
,
5399 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5400 .adc_nids
= alc260_dual_adc_nids
,
5401 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5402 .channel_mode
= alc260_modes
,
5403 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
5404 .input_mux
= alc260_acer_capture_sources
,
5407 .mixers
= { alc260_will_mixer
,
5408 alc260_capture_mixer
},
5409 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
5410 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5411 .dac_nids
= alc260_dac_nids
,
5412 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5413 .adc_nids
= alc260_adc_nids
,
5414 .dig_out_nid
= ALC260_DIGOUT_NID
,
5415 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5416 .channel_mode
= alc260_modes
,
5417 .input_mux
= &alc260_capture_source
,
5419 [ALC260_REPLACER_672V
] = {
5420 .mixers
= { alc260_replacer_672v_mixer
,
5421 alc260_capture_mixer
},
5422 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
5423 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5424 .dac_nids
= alc260_dac_nids
,
5425 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5426 .adc_nids
= alc260_adc_nids
,
5427 .dig_out_nid
= ALC260_DIGOUT_NID
,
5428 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5429 .channel_mode
= alc260_modes
,
5430 .input_mux
= &alc260_capture_source
,
5431 .unsol_event
= alc260_replacer_672v_unsol_event
,
5432 .init_hook
= alc260_replacer_672v_automute
,
5434 #ifdef CONFIG_SND_DEBUG
5436 .mixers
= { alc260_test_mixer
,
5437 alc260_capture_mixer
},
5438 .init_verbs
= { alc260_test_init_verbs
},
5439 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
5440 .dac_nids
= alc260_test_dac_nids
,
5441 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
5442 .adc_nids
= alc260_test_adc_nids
,
5443 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5444 .channel_mode
= alc260_modes
,
5445 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
5446 .input_mux
= alc260_test_capture_sources
,
5451 static int patch_alc260(struct hda_codec
*codec
)
5453 struct alc_spec
*spec
;
5454 int err
, board_config
;
5456 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5462 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
5465 if (board_config
< 0) {
5466 snd_printd(KERN_INFO
"hda_codec: Unknown model for ALC260, "
5467 "trying auto-probe from BIOS...\n");
5468 board_config
= ALC260_AUTO
;
5471 if (board_config
== ALC260_AUTO
) {
5472 /* automatic parse from the BIOS config */
5473 err
= alc260_parse_auto_config(codec
);
5479 "hda_codec: Cannot set up configuration "
5480 "from BIOS. Using base mode...\n");
5481 board_config
= ALC260_BASIC
;
5485 if (board_config
!= ALC260_AUTO
)
5486 setup_preset(spec
, &alc260_presets
[board_config
]);
5488 spec
->stream_name_analog
= "ALC260 Analog";
5489 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
5490 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
5492 spec
->stream_name_digital
= "ALC260 Digital";
5493 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
5494 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
5496 spec
->vmaster_nid
= 0x08;
5498 codec
->patch_ops
= alc_patch_ops
;
5499 if (board_config
== ALC260_AUTO
)
5500 spec
->init_hook
= alc260_auto_init
;
5501 #ifdef CONFIG_SND_HDA_POWER_SAVE
5502 if (!spec
->loopback
.amplist
)
5503 spec
->loopback
.amplist
= alc260_loopbacks
;
5513 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5514 * configuration. Each pin widget can choose any input DACs and a mixer.
5515 * Each ADC is connected from a mixer of all inputs. This makes possible
5516 * 6-channel independent captures.
5518 * In addition, an independent DAC for the multi-playback (not used in this
5521 #define ALC882_DIGOUT_NID 0x06
5522 #define ALC882_DIGIN_NID 0x0a
5524 static struct hda_channel_mode alc882_ch_modes
[1] = {
5528 static hda_nid_t alc882_dac_nids
[4] = {
5529 /* front, rear, clfe, rear_surr */
5530 0x02, 0x03, 0x04, 0x05
5533 /* identical with ALC880 */
5534 #define alc882_adc_nids alc880_adc_nids
5535 #define alc882_adc_nids_alt alc880_adc_nids_alt
5537 static hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
5538 static hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
5541 /* FIXME: should be a matrix-type input source selection */
5543 static struct hda_input_mux alc882_capture_source
= {
5547 { "Front Mic", 0x1 },
5552 #define alc882_mux_enum_info alc_mux_enum_info
5553 #define alc882_mux_enum_get alc_mux_enum_get
5555 static int alc882_mux_enum_put(struct snd_kcontrol
*kcontrol
,
5556 struct snd_ctl_elem_value
*ucontrol
)
5558 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5559 struct alc_spec
*spec
= codec
->spec
;
5560 const struct hda_input_mux
*imux
= spec
->input_mux
;
5561 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
5562 hda_nid_t nid
= spec
->capsrc_nids
?
5563 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
5564 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
5565 unsigned int i
, idx
;
5567 idx
= ucontrol
->value
.enumerated
.item
[0];
5568 if (idx
>= imux
->num_items
)
5569 idx
= imux
->num_items
- 1;
5570 if (*cur_val
== idx
)
5572 for (i
= 0; i
< imux
->num_items
; i
++) {
5573 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
5574 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
5575 imux
->items
[i
].index
,
5585 static struct hda_verb alc882_3ST_ch2_init
[] = {
5586 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5587 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5588 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5589 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5596 static struct hda_verb alc882_3ST_ch6_init
[] = {
5597 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5598 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5599 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
5600 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5601 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5602 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5606 static struct hda_channel_mode alc882_3ST_6ch_modes
[2] = {
5607 { 2, alc882_3ST_ch2_init
},
5608 { 6, alc882_3ST_ch6_init
},
5614 static struct hda_verb alc882_sixstack_ch6_init
[] = {
5615 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
5616 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5617 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5618 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5625 static struct hda_verb alc882_sixstack_ch8_init
[] = {
5626 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5627 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5628 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5629 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5633 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
5634 { 6, alc882_sixstack_ch6_init
},
5635 { 8, alc882_sixstack_ch8_init
},
5639 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5645 static struct hda_verb alc885_mbp_ch2_init
[] = {
5646 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5647 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5648 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5655 static struct hda_verb alc885_mbp_ch6_init
[] = {
5656 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5657 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5658 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5659 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5660 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5664 static struct hda_channel_mode alc885_mbp_6ch_modes
[2] = {
5665 { 2, alc885_mbp_ch2_init
},
5666 { 6, alc885_mbp_ch6_init
},
5670 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5671 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5673 static struct snd_kcontrol_new alc882_base_mixer
[] = {
5674 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5675 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5676 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5677 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5678 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5679 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5680 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5681 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5682 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
5683 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
5684 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5685 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5686 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5687 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5688 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5689 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5690 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5691 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5692 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5693 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5694 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5695 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5696 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5700 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
5701 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
5702 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
5703 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT
),
5704 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
5705 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5706 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
5708 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
5709 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT
),
5710 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
5713 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
5714 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5715 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5716 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5717 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5718 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5719 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5720 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5721 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5722 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5723 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5724 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5728 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
5729 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5730 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5731 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5732 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5733 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5734 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5735 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5736 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5737 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5738 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5739 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5740 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5741 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5745 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5746 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5748 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
5749 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5750 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5751 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5752 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
5753 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5754 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5755 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5756 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5757 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
5758 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
5759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5760 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5761 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5765 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
5766 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5767 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5768 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5769 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5770 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5771 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5772 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5774 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5775 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5776 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5777 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5781 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
5783 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5784 .name
= "Channel Mode",
5785 .info
= alc_ch_mode_info
,
5786 .get
= alc_ch_mode_get
,
5787 .put
= alc_ch_mode_put
,
5792 static struct hda_verb alc882_init_verbs
[] = {
5793 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5794 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5795 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5796 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5798 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5799 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5800 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5802 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5803 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5804 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5806 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5807 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5808 {0x0f, 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 /* Rear Pin: output 1 (0x0d) */
5815 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5816 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5817 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5818 /* CLFE Pin: output 2 (0x0e) */
5819 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5820 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5821 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
5822 /* Side Pin: output 3 (0x0f) */
5823 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5824 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5825 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
5826 /* Mic (rear) pin: input vref at 80% */
5827 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5828 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5829 /* Front Mic pin: input vref at 80% */
5830 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5831 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5832 /* Line In pin: input */
5833 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5834 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5835 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5836 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5837 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5838 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5839 /* CD pin widget for input */
5840 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5842 /* FIXME: use matrix-type input source selection */
5843 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5844 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5845 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5846 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5847 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5848 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5850 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5851 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5852 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5853 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5855 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5856 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5857 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5858 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5859 /* ADC1: mute amp left and right */
5860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5861 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5862 /* ADC2: mute amp left and right */
5863 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5864 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5865 /* ADC3: mute amp left and right */
5866 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5867 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5872 static struct hda_verb alc882_eapd_verbs
[] = {
5873 /* change to EAPD mode */
5874 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
5875 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
5880 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
5881 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5882 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5883 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
5884 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5885 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5886 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5887 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5891 static struct hda_verb alc882_macpro_init_verbs
[] = {
5892 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5893 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5895 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5896 /* Front Pin: output 0 (0x0c) */
5897 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5898 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5899 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5900 /* Front Mic pin: input vref at 80% */
5901 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5902 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5903 /* Speaker: output */
5904 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5905 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5906 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
5907 /* Headphone output (output 0 - 0x0c) */
5908 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5909 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5910 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5912 /* FIXME: use matrix-type input source selection */
5913 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5914 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5915 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5916 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5917 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5918 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5920 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5921 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5922 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5923 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5925 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5926 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5927 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5928 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5929 /* ADC1: mute amp left and right */
5930 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5931 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5932 /* ADC2: mute amp left and right */
5933 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5934 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5935 /* ADC3: mute amp left and right */
5936 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5937 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5942 /* Macbook Pro rev3 */
5943 static struct hda_verb alc885_mbp3_init_verbs
[] = {
5944 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5946 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5947 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5949 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5950 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5951 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5952 /* Front Pin: output 0 (0x0c) */
5953 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5954 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5955 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5956 /* HP Pin: output 0 (0x0d) */
5957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
5958 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5959 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5960 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5961 /* Mic (rear) pin: input vref at 80% */
5962 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5963 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5964 /* Front Mic pin: input vref at 80% */
5965 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5966 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5967 /* Line In pin: use output 1 when in LineOut mode */
5968 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5969 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5970 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
5972 /* FIXME: use matrix-type input source selection */
5973 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5974 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5975 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5976 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5977 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5978 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5980 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5981 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5982 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5983 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5985 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5986 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5987 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5988 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5989 /* ADC1: mute amp left and right */
5990 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5991 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5992 /* ADC2: mute amp left and right */
5993 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5994 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5995 /* ADC3: mute amp left and right */
5996 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5997 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6002 /* iMac 24 mixer. */
6003 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
6004 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
6005 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
6009 /* iMac 24 init verbs. */
6010 static struct hda_verb alc885_imac24_init_verbs
[] = {
6011 /* Internal speakers: output 0 (0x0c) */
6012 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6013 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6014 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
6015 /* Internal speakers: output 0 (0x0c) */
6016 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6017 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6018 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
6019 /* Headphone: output 0 (0x0c) */
6020 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6021 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6022 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
6023 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6024 /* Front Mic: input vref at 80% */
6025 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6026 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6030 /* Toggle speaker-output according to the hp-jack state */
6031 static void alc885_imac24_automute(struct hda_codec
*codec
)
6033 unsigned int present
;
6035 present
= snd_hda_codec_read(codec
, 0x14, 0,
6036 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6037 snd_hda_codec_amp_stereo(codec
, 0x18, HDA_OUTPUT
, 0,
6038 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6039 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_OUTPUT
, 0,
6040 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6043 /* Processes unsolicited events. */
6044 static void alc885_imac24_unsol_event(struct hda_codec
*codec
,
6047 /* Headphone insertion or removal. */
6048 if ((res
>> 26) == ALC880_HP_EVENT
)
6049 alc885_imac24_automute(codec
);
6052 static void alc885_mbp3_automute(struct hda_codec
*codec
)
6054 unsigned int present
;
6056 present
= snd_hda_codec_read(codec
, 0x15, 0,
6057 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6058 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
6059 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6060 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
6061 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
6064 static void alc885_mbp3_unsol_event(struct hda_codec
*codec
,
6067 /* Headphone insertion or removal. */
6068 if ((res
>> 26) == ALC880_HP_EVENT
)
6069 alc885_mbp3_automute(codec
);
6073 static struct hda_verb alc882_targa_verbs
[] = {
6074 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6077 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6078 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6080 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6081 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6082 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6084 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6085 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
6086 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
6087 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
6091 /* toggle speaker-output according to the hp-jack state */
6092 static void alc882_targa_automute(struct hda_codec
*codec
)
6094 unsigned int present
;
6096 present
= snd_hda_codec_read(codec
, 0x14, 0,
6097 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6098 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
6099 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6100 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
6104 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
6106 /* Looks like the unsol event is incompatible with the standard
6107 * definition. 4bit tag is placed at 26 bit!
6109 if (((res
>> 26) == ALC880_HP_EVENT
)) {
6110 alc882_targa_automute(codec
);
6114 static struct hda_verb alc882_asus_a7j_verbs
[] = {
6115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6118 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6119 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6120 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6122 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6123 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6124 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6126 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6127 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6128 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6132 static struct hda_verb alc882_asus_a7m_verbs
[] = {
6133 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6134 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6136 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6137 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6138 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6140 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6141 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6142 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6144 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6145 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6146 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6150 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
6152 unsigned int gpiostate
, gpiomask
, gpiodir
;
6154 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6155 AC_VERB_GET_GPIO_DATA
, 0);
6158 gpiostate
|= (1 << pin
);
6160 gpiostate
&= ~(1 << pin
);
6162 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6163 AC_VERB_GET_GPIO_MASK
, 0);
6164 gpiomask
|= (1 << pin
);
6166 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6167 AC_VERB_GET_GPIO_DIRECTION
, 0);
6168 gpiodir
|= (1 << pin
);
6171 snd_hda_codec_write(codec
, codec
->afg
, 0,
6172 AC_VERB_SET_GPIO_MASK
, gpiomask
);
6173 snd_hda_codec_write(codec
, codec
->afg
, 0,
6174 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
6178 snd_hda_codec_write(codec
, codec
->afg
, 0,
6179 AC_VERB_SET_GPIO_DATA
, gpiostate
);
6182 /* set up GPIO at initialization */
6183 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
6185 alc882_gpio_mute(codec
, 0, 0);
6186 alc882_gpio_mute(codec
, 1, 0);
6189 /* set up GPIO and update auto-muting at initialization */
6190 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
6192 alc885_macpro_init_hook(codec
);
6193 alc885_imac24_automute(codec
);
6197 * generic initialization of ADC, input mixers and output mixers
6199 static struct hda_verb alc882_auto_init_verbs
[] = {
6201 * Unmute ADC0-2 and set the default input to mic-in
6203 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6204 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6205 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6206 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6207 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6208 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6210 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6212 * Note: PASD motherboards uses the Line In 2 as the input for
6213 * front panel mic (mic 2)
6215 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6216 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6217 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6218 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6219 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6220 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6223 * Set up output mixers (0x0c - 0x0f)
6225 /* set vol=0 to output mixers */
6226 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6227 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6228 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6229 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6230 /* set up input amps for analog loopback */
6231 /* Amp Indices: DAC = 0, mixer = 1 */
6232 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6233 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6234 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6235 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6236 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6237 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6238 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6239 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6240 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6241 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6243 /* FIXME: use matrix-type input source selection */
6244 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6245 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6246 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6247 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6248 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6249 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6251 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6252 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6253 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6254 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6256 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6257 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6258 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6259 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6264 /* capture mixer elements */
6265 static struct snd_kcontrol_new alc882_capture_alt_mixer
[] = {
6266 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6267 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6268 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6269 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6271 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6272 /* The multiple "Capture Source" controls confuse alsamixer
6273 * So call somewhat different..
6275 /* .name = "Capture Source", */
6276 .name
= "Input Source",
6278 .info
= alc882_mux_enum_info
,
6279 .get
= alc882_mux_enum_get
,
6280 .put
= alc882_mux_enum_put
,
6285 static struct snd_kcontrol_new alc882_capture_mixer
[] = {
6286 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
6287 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
6288 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
6289 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
6290 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
6291 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
6293 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6294 /* The multiple "Capture Source" controls confuse alsamixer
6295 * So call somewhat different..
6297 /* .name = "Capture Source", */
6298 .name
= "Input Source",
6300 .info
= alc882_mux_enum_info
,
6301 .get
= alc882_mux_enum_get
,
6302 .put
= alc882_mux_enum_put
,
6307 #ifdef CONFIG_SND_HDA_POWER_SAVE
6308 #define alc882_loopbacks alc880_loopbacks
6311 /* pcm configuration: identiacal with ALC880 */
6312 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6313 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6314 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6315 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6318 * configuration and preset
6320 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
6321 [ALC882_3ST_DIG
] = "3stack-dig",
6322 [ALC882_6ST_DIG
] = "6stack-dig",
6323 [ALC882_ARIMA
] = "arima",
6324 [ALC882_W2JC
] = "w2jc",
6325 [ALC882_TARGA
] = "targa",
6326 [ALC882_ASUS_A7J
] = "asus-a7j",
6327 [ALC882_ASUS_A7M
] = "asus-a7m",
6328 [ALC885_MACPRO
] = "macpro",
6329 [ALC885_MBP3
] = "mbp3",
6330 [ALC885_IMAC24
] = "imac24",
6331 [ALC882_AUTO
] = "auto",
6334 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
6335 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
6336 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
6337 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
6338 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
6339 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
6340 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
6341 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
6342 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
6343 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
6344 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
6345 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
6346 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA
),
6350 static struct alc_config_preset alc882_presets
[] = {
6351 [ALC882_3ST_DIG
] = {
6352 .mixers
= { alc882_base_mixer
},
6353 .init_verbs
= { alc882_init_verbs
},
6354 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6355 .dac_nids
= alc882_dac_nids
,
6356 .dig_out_nid
= ALC882_DIGOUT_NID
,
6357 .dig_in_nid
= ALC882_DIGIN_NID
,
6358 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6359 .channel_mode
= alc882_ch_modes
,
6361 .input_mux
= &alc882_capture_source
,
6363 [ALC882_6ST_DIG
] = {
6364 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
6365 .init_verbs
= { alc882_init_verbs
},
6366 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6367 .dac_nids
= alc882_dac_nids
,
6368 .dig_out_nid
= ALC882_DIGOUT_NID
,
6369 .dig_in_nid
= ALC882_DIGIN_NID
,
6370 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
6371 .channel_mode
= alc882_sixstack_modes
,
6372 .input_mux
= &alc882_capture_source
,
6375 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
6376 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
},
6377 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6378 .dac_nids
= alc882_dac_nids
,
6379 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
6380 .channel_mode
= alc882_sixstack_modes
,
6381 .input_mux
= &alc882_capture_source
,
6384 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
6385 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
6386 alc880_gpio1_init_verbs
},
6387 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6388 .dac_nids
= alc882_dac_nids
,
6389 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
6390 .channel_mode
= alc880_threestack_modes
,
6392 .input_mux
= &alc882_capture_source
,
6393 .dig_out_nid
= ALC882_DIGOUT_NID
,
6396 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
6397 .init_verbs
= { alc885_mbp3_init_verbs
,
6398 alc880_gpio1_init_verbs
},
6399 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6400 .dac_nids
= alc882_dac_nids
,
6401 .channel_mode
= alc885_mbp_6ch_modes
,
6402 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_6ch_modes
),
6403 .input_mux
= &alc882_capture_source
,
6404 .dig_out_nid
= ALC882_DIGOUT_NID
,
6405 .dig_in_nid
= ALC882_DIGIN_NID
,
6406 .unsol_event
= alc885_mbp3_unsol_event
,
6407 .init_hook
= alc885_mbp3_automute
,
6410 .mixers
= { alc882_macpro_mixer
},
6411 .init_verbs
= { alc882_macpro_init_verbs
},
6412 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6413 .dac_nids
= alc882_dac_nids
,
6414 .dig_out_nid
= ALC882_DIGOUT_NID
,
6415 .dig_in_nid
= ALC882_DIGIN_NID
,
6416 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6417 .channel_mode
= alc882_ch_modes
,
6418 .input_mux
= &alc882_capture_source
,
6419 .init_hook
= alc885_macpro_init_hook
,
6422 .mixers
= { alc885_imac24_mixer
},
6423 .init_verbs
= { alc885_imac24_init_verbs
},
6424 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6425 .dac_nids
= alc882_dac_nids
,
6426 .dig_out_nid
= ALC882_DIGOUT_NID
,
6427 .dig_in_nid
= ALC882_DIGIN_NID
,
6428 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6429 .channel_mode
= alc882_ch_modes
,
6430 .input_mux
= &alc882_capture_source
,
6431 .unsol_event
= alc885_imac24_unsol_event
,
6432 .init_hook
= alc885_imac24_init_hook
,
6435 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
,
6436 alc882_capture_mixer
},
6437 .init_verbs
= { alc882_init_verbs
, alc882_targa_verbs
},
6438 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6439 .dac_nids
= alc882_dac_nids
,
6440 .dig_out_nid
= ALC882_DIGOUT_NID
,
6441 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
6442 .adc_nids
= alc882_adc_nids
,
6443 .capsrc_nids
= alc882_capsrc_nids
,
6444 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
6445 .channel_mode
= alc882_3ST_6ch_modes
,
6447 .input_mux
= &alc882_capture_source
,
6448 .unsol_event
= alc882_targa_unsol_event
,
6449 .init_hook
= alc882_targa_automute
,
6451 [ALC882_ASUS_A7J
] = {
6452 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
,
6453 alc882_capture_mixer
},
6454 .init_verbs
= { alc882_init_verbs
, alc882_asus_a7j_verbs
},
6455 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6456 .dac_nids
= alc882_dac_nids
,
6457 .dig_out_nid
= ALC882_DIGOUT_NID
,
6458 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
6459 .adc_nids
= alc882_adc_nids
,
6460 .capsrc_nids
= alc882_capsrc_nids
,
6461 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
6462 .channel_mode
= alc882_3ST_6ch_modes
,
6464 .input_mux
= &alc882_capture_source
,
6466 [ALC882_ASUS_A7M
] = {
6467 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
6468 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
6469 alc880_gpio1_init_verbs
,
6470 alc882_asus_a7m_verbs
},
6471 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6472 .dac_nids
= alc882_dac_nids
,
6473 .dig_out_nid
= ALC882_DIGOUT_NID
,
6474 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
6475 .channel_mode
= alc880_threestack_modes
,
6477 .input_mux
= &alc882_capture_source
,
6486 PINFIX_ABIT_AW9D_MAX
6489 static struct alc_pincfg alc882_abit_aw9d_pinfix
[] = {
6490 { 0x15, 0x01080104 }, /* side */
6491 { 0x16, 0x01011012 }, /* rear */
6492 { 0x17, 0x01016011 }, /* clfe */
6496 static const struct alc_pincfg
*alc882_pin_fixes
[] = {
6497 [PINFIX_ABIT_AW9D_MAX
] = alc882_abit_aw9d_pinfix
,
6500 static struct snd_pci_quirk alc882_pinfix_tbl
[] = {
6501 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
6506 * BIOS auto configuration
6508 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
6509 hda_nid_t nid
, int pin_type
,
6513 struct alc_spec
*spec
= codec
->spec
;
6516 alc_set_pin_output(codec
, nid
, pin_type
);
6517 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
6520 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
6521 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
6525 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
6527 struct alc_spec
*spec
= codec
->spec
;
6530 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
6531 for (i
= 0; i
<= HDA_SIDE
; i
++) {
6532 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
6533 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
6535 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
6540 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
6542 struct alc_spec
*spec
= codec
->spec
;
6545 pin
= spec
->autocfg
.hp_pins
[0];
6546 if (pin
) /* connect to front */
6548 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
6549 pin
= spec
->autocfg
.speaker_pins
[0];
6551 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
6554 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6555 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6557 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
6559 struct alc_spec
*spec
= codec
->spec
;
6562 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
6563 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
6568 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6569 unsigned int pincap
;
6570 pincap
= snd_hda_param_read(codec
, nid
, AC_PAR_PIN_CAP
);
6571 if ((pincap
>> AC_PINCAP_VREF_SHIFT
) &
6575 snd_hda_codec_write(codec
, nid
, 0,
6576 AC_VERB_SET_PIN_WIDGET_CONTROL
, vref
);
6577 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
6578 snd_hda_codec_write(codec
, nid
, 0,
6579 AC_VERB_SET_AMP_GAIN_MUTE
,
6584 static void alc882_auto_init_input_src(struct hda_codec
*codec
)
6586 struct alc_spec
*spec
= codec
->spec
;
6587 const struct hda_input_mux
*imux
= spec
->input_mux
;
6590 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
6591 hda_nid_t conn_list
[HDA_MAX_NUM_INPUTS
];
6592 hda_nid_t nid
= spec
->capsrc_nids
[c
];
6593 int conns
, mute
, idx
, item
;
6595 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
6596 ARRAY_SIZE(conn_list
));
6599 for (idx
= 0; idx
< conns
; idx
++) {
6600 /* if the current connection is the selected one,
6601 * unmute it as default - otherwise mute it
6603 mute
= AMP_IN_MUTE(idx
);
6604 for (item
= 0; item
< imux
->num_items
; item
++) {
6605 if (imux
->items
[item
].index
== idx
) {
6606 if (spec
->cur_mux
[c
] == item
)
6607 mute
= AMP_IN_UNMUTE(idx
);
6611 snd_hda_codec_write(codec
, nid
, 0,
6612 AC_VERB_SET_AMP_GAIN_MUTE
, mute
);
6617 /* add mic boosts if needed */
6618 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
6620 struct alc_spec
*spec
= codec
->spec
;
6624 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
6625 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
6626 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6628 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6632 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
6633 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
6634 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6636 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6643 /* almost identical with ALC880 parser... */
6644 static int alc882_parse_auto_config(struct hda_codec
*codec
)
6646 struct alc_spec
*spec
= codec
->spec
;
6647 int err
= alc880_parse_auto_config(codec
);
6652 return 0; /* no config found */
6654 err
= alc_auto_add_mic_boost(codec
);
6658 /* hack - override the init verbs */
6659 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
6661 return 1; /* config found */
6664 /* additional initialization for auto-configuration model */
6665 static void alc882_auto_init(struct hda_codec
*codec
)
6667 struct alc_spec
*spec
= codec
->spec
;
6668 alc882_auto_init_multi_out(codec
);
6669 alc882_auto_init_hp_out(codec
);
6670 alc882_auto_init_analog_input(codec
);
6671 alc882_auto_init_input_src(codec
);
6672 if (spec
->unsol_event
)
6673 alc_inithook(codec
);
6676 static int patch_alc883(struct hda_codec
*codec
); /* called in patch_alc882() */
6678 static int patch_alc882(struct hda_codec
*codec
)
6680 struct alc_spec
*spec
;
6681 int err
, board_config
;
6683 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6689 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
6693 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
6694 /* Pick up systems that don't supply PCI SSID */
6695 switch (codec
->subsystem_id
) {
6696 case 0x106b0c00: /* Mac Pro */
6697 board_config
= ALC885_MACPRO
;
6699 case 0x106b1000: /* iMac 24 */
6700 case 0x106b2800: /* AppleTV */
6701 board_config
= ALC885_IMAC24
;
6703 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6704 case 0x106b00a4: /* MacbookPro4,1 */
6705 case 0x106b2c00: /* Macbook Pro rev3 */
6706 case 0x106b3600: /* Macbook 3.1 */
6707 board_config
= ALC885_MBP3
;
6710 /* ALC889A is handled better as ALC888-compatible */
6711 if (codec
->revision_id
== 0x100101 ||
6712 codec
->revision_id
== 0x100103) {
6714 return patch_alc883(codec
);
6716 printk(KERN_INFO
"hda_codec: Unknown model for ALC882, "
6717 "trying auto-probe from BIOS...\n");
6718 board_config
= ALC882_AUTO
;
6722 alc_fix_pincfg(codec
, alc882_pinfix_tbl
, alc882_pin_fixes
);
6724 if (board_config
== ALC882_AUTO
) {
6725 /* automatic parse from the BIOS config */
6726 err
= alc882_parse_auto_config(codec
);
6732 "hda_codec: Cannot set up configuration "
6733 "from BIOS. Using base mode...\n");
6734 board_config
= ALC882_3ST_DIG
;
6738 if (board_config
!= ALC882_AUTO
)
6739 setup_preset(spec
, &alc882_presets
[board_config
]);
6741 if (codec
->vendor_id
== 0x10ec0885) {
6742 spec
->stream_name_analog
= "ALC885 Analog";
6743 spec
->stream_name_digital
= "ALC885 Digital";
6745 spec
->stream_name_analog
= "ALC882 Analog";
6746 spec
->stream_name_digital
= "ALC882 Digital";
6749 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
6750 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
6751 /* FIXME: setup DAC5 */
6752 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6753 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
6755 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
6756 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
6758 if (!spec
->adc_nids
&& spec
->input_mux
) {
6759 /* check whether NID 0x07 is valid */
6760 unsigned int wcap
= get_wcaps(codec
, 0x07);
6762 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
6763 if (wcap
!= AC_WID_AUD_IN
) {
6764 spec
->adc_nids
= alc882_adc_nids_alt
;
6765 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
6766 spec
->capsrc_nids
= alc882_capsrc_nids_alt
;
6767 spec
->mixers
[spec
->num_mixers
] =
6768 alc882_capture_alt_mixer
;
6771 spec
->adc_nids
= alc882_adc_nids
;
6772 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
6773 spec
->capsrc_nids
= alc882_capsrc_nids
;
6774 spec
->mixers
[spec
->num_mixers
] = alc882_capture_mixer
;
6779 spec
->vmaster_nid
= 0x0c;
6781 codec
->patch_ops
= alc_patch_ops
;
6782 if (board_config
== ALC882_AUTO
)
6783 spec
->init_hook
= alc882_auto_init
;
6784 #ifdef CONFIG_SND_HDA_POWER_SAVE
6785 if (!spec
->loopback
.amplist
)
6786 spec
->loopback
.amplist
= alc882_loopbacks
;
6795 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6796 * configuration. Each pin widget can choose any input DACs and a mixer.
6797 * Each ADC is connected from a mixer of all inputs. This makes possible
6798 * 6-channel independent captures.
6800 * In addition, an independent DAC for the multi-playback (not used in this
6803 #define ALC883_DIGOUT_NID 0x06
6804 #define ALC883_DIGIN_NID 0x0a
6806 static hda_nid_t alc883_dac_nids
[4] = {
6807 /* front, rear, clfe, rear_surr */
6808 0x02, 0x03, 0x04, 0x05
6811 static hda_nid_t alc883_adc_nids
[2] = {
6816 static hda_nid_t alc883_capsrc_nids
[2] = { 0x23, 0x22 };
6819 /* FIXME: should be a matrix-type input source selection */
6821 static struct hda_input_mux alc883_capture_source
= {
6825 { "Front Mic", 0x1 },
6831 static struct hda_input_mux alc883_3stack_6ch_intel
= {
6835 { "Front Mic", 0x0 },
6841 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
6849 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
6859 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
6867 static struct hda_input_mux alc883_lenovo_sky_capture_source
= {
6871 { "Front Mic", 0x1 },
6876 static struct hda_input_mux alc883_asus_eee1601_capture_source
= {
6884 #define alc883_mux_enum_info alc_mux_enum_info
6885 #define alc883_mux_enum_get alc_mux_enum_get
6886 /* ALC883 has the ALC882-type input selection */
6887 #define alc883_mux_enum_put alc882_mux_enum_put
6892 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
6899 static struct hda_verb alc883_3ST_ch2_init
[] = {
6900 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6901 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6902 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6903 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6910 static struct hda_verb alc883_3ST_ch4_init
[] = {
6911 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6912 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6913 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6914 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6915 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6922 static struct hda_verb alc883_3ST_ch6_init
[] = {
6923 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6924 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6925 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6926 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6927 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6928 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6932 static struct hda_channel_mode alc883_3ST_6ch_modes
[3] = {
6933 { 2, alc883_3ST_ch2_init
},
6934 { 4, alc883_3ST_ch4_init
},
6935 { 6, alc883_3ST_ch6_init
},
6941 static struct hda_verb alc883_3ST_ch2_intel_init
[] = {
6942 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6943 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6944 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6945 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6952 static struct hda_verb alc883_3ST_ch4_intel_init
[] = {
6953 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6954 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6955 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6956 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6957 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6964 static struct hda_verb alc883_3ST_ch6_intel_init
[] = {
6965 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6966 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6967 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6968 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6969 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6970 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6974 static struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
6975 { 2, alc883_3ST_ch2_intel_init
},
6976 { 4, alc883_3ST_ch4_intel_init
},
6977 { 6, alc883_3ST_ch6_intel_init
},
6983 static struct hda_verb alc883_sixstack_ch6_init
[] = {
6984 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6985 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6986 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6987 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6994 static struct hda_verb alc883_sixstack_ch8_init
[] = {
6995 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6996 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6997 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6998 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7002 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
7003 { 6, alc883_sixstack_ch6_init
},
7004 { 8, alc883_sixstack_ch8_init
},
7007 static struct hda_verb alc883_medion_eapd_verbs
[] = {
7008 /* eanable EAPD on medion laptop */
7009 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
7010 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
7014 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7015 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7018 static struct snd_kcontrol_new alc883_base_mixer
[] = {
7019 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7020 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7021 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7022 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7023 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7024 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7025 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7026 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7027 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
7028 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
7029 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7030 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7031 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7032 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7033 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7034 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7035 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7036 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7037 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7038 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7039 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7040 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7041 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7042 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7043 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7044 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7045 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7047 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7048 /* .name = "Capture Source", */
7049 .name
= "Input Source",
7051 .info
= alc883_mux_enum_info
,
7052 .get
= alc883_mux_enum_get
,
7053 .put
= alc883_mux_enum_put
,
7058 static struct snd_kcontrol_new alc883_mitac_mixer
[] = {
7059 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7060 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7061 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7062 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7063 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7064 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7065 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7067 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7069 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7070 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7071 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7072 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7073 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7074 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7075 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7077 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7078 /* .name = "Capture Source", */
7079 .name
= "Input Source",
7081 .info
= alc883_mux_enum_info
,
7082 .get
= alc883_mux_enum_get
,
7083 .put
= alc883_mux_enum_put
,
7088 static struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
7089 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7090 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
7091 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7092 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
7093 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7094 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7096 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7097 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
7098 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7099 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7100 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7101 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7102 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7104 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7105 /* .name = "Capture Source", */
7106 .name
= "Input Source",
7108 .info
= alc883_mux_enum_info
,
7109 .get
= alc883_mux_enum_get
,
7110 .put
= alc883_mux_enum_put
,
7115 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
7116 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7117 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
7118 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7119 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
7120 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7121 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7122 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7123 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7124 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
7125 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7126 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7127 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7128 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7129 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7131 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7132 /* .name = "Capture Source", */
7133 .name
= "Input Source",
7135 .info
= alc883_mux_enum_info
,
7136 .get
= alc883_mux_enum_get
,
7137 .put
= alc883_mux_enum_put
,
7142 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
7143 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7144 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7145 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7146 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7147 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7148 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7149 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7150 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7151 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7153 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7154 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7155 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7156 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7157 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7158 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7159 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7160 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7161 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7163 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7164 /* .name = "Capture Source", */
7165 .name
= "Input Source",
7167 .info
= alc883_mux_enum_info
,
7168 .get
= alc883_mux_enum_get
,
7169 .put
= alc883_mux_enum_put
,
7174 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
7175 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7176 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7177 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7178 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7179 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7180 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7181 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7182 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7184 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7185 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7186 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7187 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7189 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7190 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7191 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7192 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7193 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7194 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7195 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, 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_3ST_6ch_intel_mixer
[] = {
7211 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7212 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7213 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7214 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7215 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7217 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7218 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7219 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7220 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7221 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7222 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7223 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7224 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7225 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7226 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
7227 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7228 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7229 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT
),
7230 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7231 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7232 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7233 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7234 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7235 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7236 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7238 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7239 /* .name = "Capture Source", */
7240 .name
= "Input Source",
7242 .info
= alc883_mux_enum_info
,
7243 .get
= alc883_mux_enum_get
,
7244 .put
= alc883_mux_enum_put
,
7249 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
7250 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7251 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7252 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7253 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7254 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7255 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7256 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7257 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7258 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7259 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7260 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7261 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7262 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7263 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7264 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7265 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7266 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7267 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7268 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7269 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7270 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7271 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7272 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7275 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7276 /* .name = "Capture Source", */
7277 .name
= "Input Source",
7279 .info
= alc883_mux_enum_info
,
7280 .get
= alc883_mux_enum_get
,
7281 .put
= alc883_mux_enum_put
,
7286 static struct snd_kcontrol_new alc883_tagra_mixer
[] = {
7287 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7288 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7289 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7290 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7291 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7292 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7293 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7294 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7295 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7296 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7297 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7298 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7299 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7300 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7301 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7302 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7303 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7304 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7305 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7306 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7308 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7309 /* .name = "Capture Source", */
7310 .name
= "Input Source",
7312 .info
= alc883_mux_enum_info
,
7313 .get
= alc883_mux_enum_get
,
7314 .put
= alc883_mux_enum_put
,
7319 static struct snd_kcontrol_new alc883_tagra_2ch_mixer
[] = {
7320 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7321 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7322 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7323 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7324 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7325 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7326 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7327 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7328 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7329 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
7330 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7331 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7332 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7333 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7334 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7336 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7337 /* .name = "Capture Source", */
7338 .name
= "Input Source",
7340 .info
= alc883_mux_enum_info
,
7341 .get
= alc883_mux_enum_get
,
7342 .put
= alc883_mux_enum_put
,
7347 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
7348 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7349 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7350 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7351 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
7352 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7353 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7354 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7355 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7356 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7357 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7359 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7360 /* .name = "Capture Source", */
7361 .name
= "Input Source",
7363 .info
= alc883_mux_enum_info
,
7364 .get
= alc883_mux_enum_get
,
7365 .put
= alc883_mux_enum_put
,
7370 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
7371 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7372 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
7373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7374 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7375 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7378 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7379 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7380 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7381 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7382 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7383 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7385 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7386 /* .name = "Capture Source", */
7387 .name
= "Input Source",
7389 .info
= alc883_mux_enum_info
,
7390 .get
= alc883_mux_enum_get
,
7391 .put
= alc883_mux_enum_put
,
7396 static struct snd_kcontrol_new alc883_medion_md2_mixer
[] = {
7397 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7398 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7399 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7400 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7401 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7402 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7403 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7404 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7405 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7406 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7407 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7408 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7409 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7411 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7412 /* .name = "Capture Source", */
7413 .name
= "Input Source",
7415 .info
= alc883_mux_enum_info
,
7416 .get
= alc883_mux_enum_get
,
7417 .put
= alc883_mux_enum_put
,
7422 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
7423 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7424 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7425 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7426 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7427 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7429 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7430 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7431 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7432 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7433 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7434 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7436 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7437 /* .name = "Capture Source", */
7438 .name
= "Input Source",
7440 .info
= alc883_mux_enum_info
,
7441 .get
= alc883_mux_enum_get
,
7442 .put
= alc883_mux_enum_put
,
7447 static struct snd_kcontrol_new alc888_lenovo_sky_mixer
[] = {
7448 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7449 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7450 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
7451 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
7452 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7453 0x0d, 1, 0x0, HDA_OUTPUT
),
7454 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
7455 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
7456 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
7457 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
7458 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
7459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7460 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT
),
7461 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7462 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7463 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7464 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7466 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7467 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7468 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7469 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7470 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7471 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7472 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7473 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7474 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7476 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7477 /* .name = "Capture Source", */
7478 .name
= "Input Source",
7480 .info
= alc883_mux_enum_info
,
7481 .get
= alc883_mux_enum_get
,
7482 .put
= alc883_mux_enum_put
,
7487 static struct hda_bind_ctls alc883_bind_cap_vol
= {
7488 .ops
= &snd_hda_bind_vol
,
7490 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
7491 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
7496 static struct hda_bind_ctls alc883_bind_cap_switch
= {
7497 .ops
= &snd_hda_bind_sw
,
7499 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT
),
7500 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT
),
7505 static struct snd_kcontrol_new alc883_asus_eee1601_mixer
[] = {
7506 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7507 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7508 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7509 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7510 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7511 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7512 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7513 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7514 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol
),
7515 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch
),
7517 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7518 /* .name = "Capture Source", */
7519 .name
= "Input Source",
7521 .info
= alc883_mux_enum_info
,
7522 .get
= alc883_mux_enum_get
,
7523 .put
= alc883_mux_enum_put
,
7528 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
7530 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7531 .name
= "Channel Mode",
7532 .info
= alc_ch_mode_info
,
7533 .get
= alc_ch_mode_get
,
7534 .put
= alc_ch_mode_put
,
7539 static struct hda_verb alc883_init_verbs
[] = {
7540 /* ADC1: mute amp left and right */
7541 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7542 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7543 /* ADC2: mute amp left and right */
7544 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7545 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7546 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7548 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7549 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7551 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7552 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7553 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7555 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7556 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7557 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7559 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7560 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7561 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7563 /* mute analog input loopbacks */
7564 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7565 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7566 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7567 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7570 /* Front Pin: output 0 (0x0c) */
7571 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7572 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7573 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7574 /* Rear Pin: output 1 (0x0d) */
7575 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7576 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7577 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7578 /* CLFE Pin: output 2 (0x0e) */
7579 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7580 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7581 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
7582 /* Side Pin: output 3 (0x0f) */
7583 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7584 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7585 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
7586 /* Mic (rear) pin: input vref at 80% */
7587 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7588 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7589 /* Front Mic pin: input vref at 80% */
7590 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7591 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7592 /* Line In pin: input */
7593 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7594 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7595 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7596 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7597 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7598 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7599 /* CD pin widget for input */
7600 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7602 /* FIXME: use matrix-type input source selection */
7603 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7605 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7606 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7607 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7608 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7610 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7611 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7612 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7613 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7617 /* toggle speaker-output according to the hp-jack state */
7618 static void alc883_mitac_hp_automute(struct hda_codec
*codec
)
7620 unsigned int present
;
7622 present
= snd_hda_codec_read(codec
, 0x15, 0,
7623 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7624 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7625 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7626 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
7627 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7630 /* auto-toggle front mic */
7632 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7634 unsigned int present;
7637 present = snd_hda_codec_read(codec, 0x18, 0,
7638 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7639 bits = present ? HDA_AMP_MUTE : 0;
7640 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7644 static void alc883_mitac_automute(struct hda_codec
*codec
)
7646 alc883_mitac_hp_automute(codec
);
7647 /* alc883_mitac_mic_automute(codec); */
7650 static void alc883_mitac_unsol_event(struct hda_codec
*codec
,
7653 switch (res
>> 26) {
7654 case ALC880_HP_EVENT
:
7655 alc883_mitac_hp_automute(codec
);
7657 case ALC880_MIC_EVENT
:
7658 /* alc883_mitac_mic_automute(codec); */
7663 static struct hda_verb alc883_mitac_verbs
[] = {
7665 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7666 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7668 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
7669 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7671 /* enable unsolicited event */
7672 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7673 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7678 static struct hda_verb alc883_clevo_m720_verbs
[] = {
7680 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7681 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7683 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
7684 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7686 /* enable unsolicited event */
7687 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7688 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
7693 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
7695 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7696 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7698 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7699 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7701 /* enable unsolicited event */
7702 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7707 static struct hda_verb alc883_tagra_verbs
[] = {
7708 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7709 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7711 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7712 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7714 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
7715 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
7716 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
7718 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7719 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
7720 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
7721 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
7726 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
7727 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7728 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
7729 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
7733 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
7734 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7735 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7736 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7737 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7741 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
7742 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7744 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7745 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
7746 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7750 static struct hda_verb alc883_haier_w66_verbs
[] = {
7751 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7754 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7756 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7757 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7758 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7759 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7763 static struct hda_verb alc888_lenovo_sky_verbs
[] = {
7764 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7765 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7766 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7767 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7768 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7769 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7770 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
7771 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7775 static struct hda_verb alc888_3st_hp_verbs
[] = {
7776 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
7777 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
7778 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
7782 static struct hda_verb alc888_6st_dell_verbs
[] = {
7783 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7787 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
7788 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7789 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7790 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7791 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7795 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
7796 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7797 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7798 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7799 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7803 static struct hda_channel_mode alc888_3st_hp_modes
[2] = {
7804 { 2, alc888_3st_hp_2ch_init
},
7805 { 6, alc888_3st_hp_6ch_init
},
7808 /* toggle front-jack and RCA according to the hp-jack state */
7809 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
7811 unsigned int present
;
7813 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7814 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7815 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7816 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7817 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7818 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7821 /* toggle RCA according to the front-jack state */
7822 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
7824 unsigned int present
;
7826 present
= snd_hda_codec_read(codec
, 0x14, 0,
7827 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7828 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7829 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7832 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
7835 if ((res
>> 26) == ALC880_HP_EVENT
)
7836 alc888_lenovo_ms7195_front_automute(codec
);
7837 if ((res
>> 26) == ALC880_FRONT_EVENT
)
7838 alc888_lenovo_ms7195_rca_automute(codec
);
7841 static struct hda_verb alc883_medion_md2_verbs
[] = {
7842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7843 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7845 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7847 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7851 /* toggle speaker-output according to the hp-jack state */
7852 static void alc883_medion_md2_automute(struct hda_codec
*codec
)
7854 unsigned int present
;
7856 present
= snd_hda_codec_read(codec
, 0x14, 0,
7857 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7858 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7859 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7862 static void alc883_medion_md2_unsol_event(struct hda_codec
*codec
,
7865 if ((res
>> 26) == ALC880_HP_EVENT
)
7866 alc883_medion_md2_automute(codec
);
7869 /* toggle speaker-output according to the hp-jack state */
7870 static void alc883_tagra_automute(struct hda_codec
*codec
)
7872 unsigned int present
;
7875 present
= snd_hda_codec_read(codec
, 0x14, 0,
7876 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7877 bits
= present
? HDA_AMP_MUTE
: 0;
7878 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
7879 HDA_AMP_MUTE
, bits
);
7880 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
7884 static void alc883_tagra_unsol_event(struct hda_codec
*codec
, unsigned int res
)
7886 if ((res
>> 26) == ALC880_HP_EVENT
)
7887 alc883_tagra_automute(codec
);
7890 /* toggle speaker-output according to the hp-jack state */
7891 static void alc883_clevo_m720_hp_automute(struct hda_codec
*codec
)
7893 unsigned int present
;
7896 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0)
7897 & AC_PINSENSE_PRESENCE
;
7898 bits
= present
? HDA_AMP_MUTE
: 0;
7899 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7900 HDA_AMP_MUTE
, bits
);
7903 static void alc883_clevo_m720_mic_automute(struct hda_codec
*codec
)
7905 unsigned int present
;
7907 present
= snd_hda_codec_read(codec
, 0x18, 0,
7908 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7909 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
7910 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7913 static void alc883_clevo_m720_automute(struct hda_codec
*codec
)
7915 alc883_clevo_m720_hp_automute(codec
);
7916 alc883_clevo_m720_mic_automute(codec
);
7919 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
7922 switch (res
>> 26) {
7923 case ALC880_HP_EVENT
:
7924 alc883_clevo_m720_hp_automute(codec
);
7926 case ALC880_MIC_EVENT
:
7927 alc883_clevo_m720_mic_automute(codec
);
7932 /* toggle speaker-output according to the hp-jack state */
7933 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec
*codec
)
7935 unsigned int present
;
7938 present
= snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_GET_PIN_SENSE
, 0)
7939 & AC_PINSENSE_PRESENCE
;
7940 bits
= present
? HDA_AMP_MUTE
: 0;
7941 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7942 HDA_AMP_MUTE
, bits
);
7945 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec
*codec
,
7948 if ((res
>> 26) == ALC880_HP_EVENT
)
7949 alc883_2ch_fujitsu_pi2515_automute(codec
);
7952 static void alc883_haier_w66_automute(struct hda_codec
*codec
)
7954 unsigned int present
;
7957 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7958 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7959 bits
= present
? 0x80 : 0;
7960 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7964 static void alc883_haier_w66_unsol_event(struct hda_codec
*codec
,
7967 if ((res
>> 26) == ALC880_HP_EVENT
)
7968 alc883_haier_w66_automute(codec
);
7971 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
7973 unsigned int present
;
7976 present
= snd_hda_codec_read(codec
, 0x14, 0,
7977 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7978 bits
= present
? HDA_AMP_MUTE
: 0;
7979 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7980 HDA_AMP_MUTE
, bits
);
7983 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
7985 unsigned int present
;
7988 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7989 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7990 bits
= present
? HDA_AMP_MUTE
: 0;
7991 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7992 HDA_AMP_MUTE
, bits
);
7993 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7994 HDA_AMP_MUTE
, bits
);
7997 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
8000 if ((res
>> 26) == ALC880_HP_EVENT
)
8001 alc883_lenovo_101e_all_automute(codec
);
8002 if ((res
>> 26) == ALC880_FRONT_EVENT
)
8003 alc883_lenovo_101e_ispeaker_automute(codec
);
8006 /* toggle speaker-output according to the hp-jack state */
8007 static void alc883_acer_aspire_automute(struct hda_codec
*codec
)
8009 unsigned int present
;
8011 present
= snd_hda_codec_read(codec
, 0x14, 0,
8012 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8013 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8014 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8015 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
8016 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8019 static void alc883_acer_aspire_unsol_event(struct hda_codec
*codec
,
8022 if ((res
>> 26) == ALC880_HP_EVENT
)
8023 alc883_acer_aspire_automute(codec
);
8026 static struct hda_verb alc883_acer_eapd_verbs
[] = {
8027 /* HP Pin: output 0 (0x0c) */
8028 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8030 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8031 /* Front Pin: output 0 (0x0c) */
8032 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8033 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8034 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8035 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
8036 /* eanable EAPD on medion laptop */
8037 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8038 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
8039 /* enable unsolicited event */
8040 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8044 static void alc888_6st_dell_front_automute(struct hda_codec
*codec
)
8046 unsigned int present
;
8048 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8049 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8050 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8051 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8052 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8053 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8054 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
8055 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8056 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
8057 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
8060 static void alc888_6st_dell_unsol_event(struct hda_codec
*codec
,
8063 switch (res
>> 26) {
8064 case ALC880_HP_EVENT
:
8065 printk("hp_event\n");
8066 alc888_6st_dell_front_automute(codec
);
8071 static void alc888_lenovo_sky_front_automute(struct hda_codec
*codec
)
8074 unsigned int present
;
8076 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
8077 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8078 AC_VERB_GET_PIN_SENSE
, 0);
8079 present
= (present
& 0x80000000) != 0;
8081 /* mute internal speaker */
8082 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8083 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8084 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8085 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8086 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
8087 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8088 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
8089 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8090 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_OUTPUT
, 0,
8091 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8093 /* unmute internal speaker if necessary */
8094 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
8095 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8096 HDA_AMP_MUTE
, mute
);
8097 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8098 HDA_AMP_MUTE
, mute
);
8099 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
8100 HDA_AMP_MUTE
, mute
);
8101 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
8102 HDA_AMP_MUTE
, mute
);
8103 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_OUTPUT
, 0,
8104 HDA_AMP_MUTE
, mute
);
8108 static void alc883_lenovo_sky_unsol_event(struct hda_codec
*codec
,
8111 if ((res
>> 26) == ALC880_HP_EVENT
)
8112 alc888_lenovo_sky_front_automute(codec
);
8116 * generic initialization of ADC, input mixers and output mixers
8118 static struct hda_verb alc883_auto_init_verbs
[] = {
8120 * Unmute ADC0-2 and set the default input to mic-in
8122 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8123 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8124 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8125 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8127 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8129 * Note: PASD motherboards uses the Line In 2 as the input for
8130 * front panel mic (mic 2)
8132 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8137 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8140 * Set up output mixers (0x0c - 0x0f)
8142 /* set vol=0 to output mixers */
8143 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8144 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8145 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8146 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8147 /* set up input amps for analog loopback */
8148 /* Amp Indices: DAC = 0, mixer = 1 */
8149 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8150 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8151 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8152 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8153 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8154 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8155 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8156 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8157 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8158 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8160 /* FIXME: use matrix-type input source selection */
8161 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8163 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8164 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8165 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8166 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8167 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
8169 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8170 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8171 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
8172 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8173 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
8178 /* capture mixer elements */
8179 static struct snd_kcontrol_new alc883_capture_mixer
[] = {
8180 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
8181 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
8182 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
8183 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
8185 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8186 /* The multiple "Capture Source" controls confuse alsamixer
8187 * So call somewhat different..
8189 /* .name = "Capture Source", */
8190 .name
= "Input Source",
8192 .info
= alc882_mux_enum_info
,
8193 .get
= alc882_mux_enum_get
,
8194 .put
= alc882_mux_enum_put
,
8199 static struct hda_verb alc888_asus_m90v_verbs
[] = {
8200 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8201 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8202 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8203 /* enable unsolicited event */
8204 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8205 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
8209 static void alc883_nb_mic_automute(struct hda_codec
*codec
)
8211 unsigned int present
;
8213 present
= snd_hda_codec_read(codec
, 0x18, 0,
8214 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
8215 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
8216 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
8217 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
8218 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
8221 static void alc883_M90V_speaker_automute(struct hda_codec
*codec
)
8223 unsigned int present
;
8226 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8227 AC_VERB_GET_PIN_SENSE
, 0)
8228 & AC_PINSENSE_PRESENCE
;
8229 bits
= present
? 0 : PIN_OUT
;
8230 snd_hda_codec_write(codec
, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
8232 snd_hda_codec_write(codec
, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
8234 snd_hda_codec_write(codec
, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
8238 static void alc883_mode2_unsol_event(struct hda_codec
*codec
,
8241 switch (res
>> 26) {
8242 case ALC880_HP_EVENT
:
8243 alc883_M90V_speaker_automute(codec
);
8245 case ALC880_MIC_EVENT
:
8246 alc883_nb_mic_automute(codec
);
8251 static void alc883_mode2_inithook(struct hda_codec
*codec
)
8253 alc883_M90V_speaker_automute(codec
);
8254 alc883_nb_mic_automute(codec
);
8257 static struct hda_verb alc888_asus_eee1601_verbs
[] = {
8258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8259 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8260 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8261 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8262 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8263 {0x20, AC_VERB_SET_COEF_INDEX
, 0x0b},
8264 {0x20, AC_VERB_SET_PROC_COEF
, 0x0838},
8265 /* enable unsolicited event */
8266 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8270 static void alc883_eee1601_speaker_automute(struct hda_codec
*codec
)
8272 unsigned int present
;
8275 present
= snd_hda_codec_read(codec
, 0x14, 0,
8276 AC_VERB_GET_PIN_SENSE
, 0)
8277 & AC_PINSENSE_PRESENCE
;
8278 bits
= present
? 0 : PIN_OUT
;
8279 snd_hda_codec_write(codec
, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
8283 static void alc883_eee1601_unsol_event(struct hda_codec
*codec
,
8286 switch (res
>> 26) {
8287 case ALC880_HP_EVENT
:
8288 alc883_eee1601_speaker_automute(codec
);
8293 static void alc883_eee1601_inithook(struct hda_codec
*codec
)
8295 alc883_eee1601_speaker_automute(codec
);
8298 #ifdef CONFIG_SND_HDA_POWER_SAVE
8299 #define alc883_loopbacks alc880_loopbacks
8302 /* pcm configuration: identiacal with ALC880 */
8303 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8304 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8305 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8306 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8307 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8310 * configuration and preset
8312 static const char *alc883_models
[ALC883_MODEL_LAST
] = {
8313 [ALC883_3ST_2ch_DIG
] = "3stack-dig",
8314 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
8315 [ALC883_3ST_6ch
] = "3stack-6ch",
8316 [ALC883_6ST_DIG
] = "6stack-dig",
8317 [ALC883_TARGA_DIG
] = "targa-dig",
8318 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
8319 [ALC883_ACER
] = "acer",
8320 [ALC883_ACER_ASPIRE
] = "acer-aspire",
8321 [ALC883_MEDION
] = "medion",
8322 [ALC883_MEDION_MD2
] = "medion-md2",
8323 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
8324 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
8325 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
8326 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
8327 [ALC888_LENOVO_SKY
] = "lenovo-sky",
8328 [ALC883_HAIER_W66
] = "haier-w66",
8329 [ALC888_3ST_HP
] = "3stack-hp",
8330 [ALC888_6ST_DELL
] = "6stack-dell",
8331 [ALC883_MITAC
] = "mitac",
8332 [ALC883_CLEVO_M720
] = "clevo-m720",
8333 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
8334 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
8335 [ALC883_AUTO
] = "auto",
8338 static struct snd_pci_quirk alc883_cfg_tbl
[] = {
8339 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG
),
8340 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
8341 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
8342 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
8343 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE
),
8344 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER
), /* default Acer */
8345 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
8346 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
8347 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
8348 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
8349 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
8350 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V
),
8351 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
8352 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601
),
8353 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
8354 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG
),
8355 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
8356 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
8357 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL
),
8358 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
8359 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG
),
8360 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
8361 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
8362 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
8363 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG
),
8364 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
8365 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
8366 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
8367 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
8368 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
8369 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
8370 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
8371 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
8372 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
8373 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
8374 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
8375 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
8376 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
8377 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
8378 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
8379 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
8380 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
8381 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
8382 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
8383 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
8384 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
8385 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD
),
8386 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
8387 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
8388 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515
),
8389 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
8390 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
8391 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
8392 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
8393 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY
),
8394 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2
),
8395 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
8396 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
8397 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
8398 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
8399 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch
),
8403 static struct alc_config_preset alc883_presets
[] = {
8404 [ALC883_3ST_2ch_DIG
] = {
8405 .mixers
= { alc883_3ST_2ch_mixer
},
8406 .init_verbs
= { alc883_init_verbs
},
8407 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8408 .dac_nids
= alc883_dac_nids
,
8409 .dig_out_nid
= ALC883_DIGOUT_NID
,
8410 .dig_in_nid
= ALC883_DIGIN_NID
,
8411 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8412 .channel_mode
= alc883_3ST_2ch_modes
,
8413 .input_mux
= &alc883_capture_source
,
8415 [ALC883_3ST_6ch_DIG
] = {
8416 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8417 .init_verbs
= { alc883_init_verbs
},
8418 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8419 .dac_nids
= alc883_dac_nids
,
8420 .dig_out_nid
= ALC883_DIGOUT_NID
,
8421 .dig_in_nid
= ALC883_DIGIN_NID
,
8422 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8423 .channel_mode
= alc883_3ST_6ch_modes
,
8425 .input_mux
= &alc883_capture_source
,
8427 [ALC883_3ST_6ch
] = {
8428 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8429 .init_verbs
= { alc883_init_verbs
},
8430 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8431 .dac_nids
= alc883_dac_nids
,
8432 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8433 .channel_mode
= alc883_3ST_6ch_modes
,
8435 .input_mux
= &alc883_capture_source
,
8437 [ALC883_3ST_6ch_INTEL
] = {
8438 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
8439 .init_verbs
= { alc883_init_verbs
},
8440 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8441 .dac_nids
= alc883_dac_nids
,
8442 .dig_out_nid
= ALC883_DIGOUT_NID
,
8443 .dig_in_nid
= ALC883_DIGIN_NID
,
8444 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
8445 .channel_mode
= alc883_3ST_6ch_intel_modes
,
8447 .input_mux
= &alc883_3stack_6ch_intel
,
8449 [ALC883_6ST_DIG
] = {
8450 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
8451 .init_verbs
= { alc883_init_verbs
},
8452 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8453 .dac_nids
= alc883_dac_nids
,
8454 .dig_out_nid
= ALC883_DIGOUT_NID
,
8455 .dig_in_nid
= ALC883_DIGIN_NID
,
8456 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8457 .channel_mode
= alc883_sixstack_modes
,
8458 .input_mux
= &alc883_capture_source
,
8460 [ALC883_TARGA_DIG
] = {
8461 .mixers
= { alc883_tagra_mixer
, alc883_chmode_mixer
},
8462 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
8463 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8464 .dac_nids
= alc883_dac_nids
,
8465 .dig_out_nid
= ALC883_DIGOUT_NID
,
8466 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8467 .channel_mode
= alc883_3ST_6ch_modes
,
8469 .input_mux
= &alc883_capture_source
,
8470 .unsol_event
= alc883_tagra_unsol_event
,
8471 .init_hook
= alc883_tagra_automute
,
8473 [ALC883_TARGA_2ch_DIG
] = {
8474 .mixers
= { alc883_tagra_2ch_mixer
},
8475 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
8476 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8477 .dac_nids
= alc883_dac_nids
,
8478 .dig_out_nid
= ALC883_DIGOUT_NID
,
8479 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8480 .channel_mode
= alc883_3ST_2ch_modes
,
8481 .input_mux
= &alc883_capture_source
,
8482 .unsol_event
= alc883_tagra_unsol_event
,
8483 .init_hook
= alc883_tagra_automute
,
8486 .mixers
= { alc883_base_mixer
},
8487 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8488 * and the headphone jack. Turn this on and rely on the
8489 * standard mute methods whenever the user wants to turn
8490 * these outputs off.
8492 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
8493 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8494 .dac_nids
= alc883_dac_nids
,
8495 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8496 .channel_mode
= alc883_3ST_2ch_modes
,
8497 .input_mux
= &alc883_capture_source
,
8499 [ALC883_ACER_ASPIRE
] = {
8500 .mixers
= { alc883_acer_aspire_mixer
},
8501 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
8502 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8503 .dac_nids
= alc883_dac_nids
,
8504 .dig_out_nid
= ALC883_DIGOUT_NID
,
8505 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8506 .channel_mode
= alc883_3ST_2ch_modes
,
8507 .input_mux
= &alc883_capture_source
,
8508 .unsol_event
= alc883_acer_aspire_unsol_event
,
8509 .init_hook
= alc883_acer_aspire_automute
,
8512 .mixers
= { alc883_fivestack_mixer
,
8513 alc883_chmode_mixer
},
8514 .init_verbs
= { alc883_init_verbs
,
8515 alc883_medion_eapd_verbs
},
8516 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8517 .dac_nids
= alc883_dac_nids
,
8518 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8519 .channel_mode
= alc883_sixstack_modes
,
8520 .input_mux
= &alc883_capture_source
,
8522 [ALC883_MEDION_MD2
] = {
8523 .mixers
= { alc883_medion_md2_mixer
},
8524 .init_verbs
= { alc883_init_verbs
, alc883_medion_md2_verbs
},
8525 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8526 .dac_nids
= alc883_dac_nids
,
8527 .dig_out_nid
= ALC883_DIGOUT_NID
,
8528 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8529 .channel_mode
= alc883_3ST_2ch_modes
,
8530 .input_mux
= &alc883_capture_source
,
8531 .unsol_event
= alc883_medion_md2_unsol_event
,
8532 .init_hook
= alc883_medion_md2_automute
,
8534 [ALC883_LAPTOP_EAPD
] = {
8535 .mixers
= { alc883_base_mixer
},
8536 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
8537 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8538 .dac_nids
= alc883_dac_nids
,
8539 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8540 .channel_mode
= alc883_3ST_2ch_modes
,
8541 .input_mux
= &alc883_capture_source
,
8543 [ALC883_CLEVO_M720
] = {
8544 .mixers
= { alc883_clevo_m720_mixer
},
8545 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_verbs
},
8546 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8547 .dac_nids
= alc883_dac_nids
,
8548 .dig_out_nid
= ALC883_DIGOUT_NID
,
8549 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8550 .channel_mode
= alc883_3ST_2ch_modes
,
8551 .input_mux
= &alc883_capture_source
,
8552 .unsol_event
= alc883_clevo_m720_unsol_event
,
8553 .init_hook
= alc883_clevo_m720_automute
,
8555 [ALC883_LENOVO_101E_2ch
] = {
8556 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
8557 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
8558 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8559 .dac_nids
= alc883_dac_nids
,
8560 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8561 .channel_mode
= alc883_3ST_2ch_modes
,
8562 .input_mux
= &alc883_lenovo_101e_capture_source
,
8563 .unsol_event
= alc883_lenovo_101e_unsol_event
,
8564 .init_hook
= alc883_lenovo_101e_all_automute
,
8566 [ALC883_LENOVO_NB0763
] = {
8567 .mixers
= { alc883_lenovo_nb0763_mixer
},
8568 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
8569 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8570 .dac_nids
= alc883_dac_nids
,
8571 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8572 .channel_mode
= alc883_3ST_2ch_modes
,
8574 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
8575 .unsol_event
= alc883_medion_md2_unsol_event
,
8576 .init_hook
= alc883_medion_md2_automute
,
8578 [ALC888_LENOVO_MS7195_DIG
] = {
8579 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8580 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
8581 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8582 .dac_nids
= alc883_dac_nids
,
8583 .dig_out_nid
= ALC883_DIGOUT_NID
,
8584 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8585 .channel_mode
= alc883_3ST_6ch_modes
,
8587 .input_mux
= &alc883_capture_source
,
8588 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
8589 .init_hook
= alc888_lenovo_ms7195_front_automute
,
8591 [ALC883_HAIER_W66
] = {
8592 .mixers
= { alc883_tagra_2ch_mixer
},
8593 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
8594 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8595 .dac_nids
= alc883_dac_nids
,
8596 .dig_out_nid
= ALC883_DIGOUT_NID
,
8597 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8598 .channel_mode
= alc883_3ST_2ch_modes
,
8599 .input_mux
= &alc883_capture_source
,
8600 .unsol_event
= alc883_haier_w66_unsol_event
,
8601 .init_hook
= alc883_haier_w66_automute
,
8604 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8605 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
8606 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8607 .dac_nids
= alc883_dac_nids
,
8608 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
8609 .channel_mode
= alc888_3st_hp_modes
,
8611 .input_mux
= &alc883_capture_source
,
8613 [ALC888_6ST_DELL
] = {
8614 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
8615 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
8616 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8617 .dac_nids
= alc883_dac_nids
,
8618 .dig_out_nid
= ALC883_DIGOUT_NID
,
8619 .dig_in_nid
= ALC883_DIGIN_NID
,
8620 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8621 .channel_mode
= alc883_sixstack_modes
,
8622 .input_mux
= &alc883_capture_source
,
8623 .unsol_event
= alc888_6st_dell_unsol_event
,
8624 .init_hook
= alc888_6st_dell_front_automute
,
8627 .mixers
= { alc883_mitac_mixer
},
8628 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
8629 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8630 .dac_nids
= alc883_dac_nids
,
8631 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8632 .channel_mode
= alc883_3ST_2ch_modes
,
8633 .input_mux
= &alc883_capture_source
,
8634 .unsol_event
= alc883_mitac_unsol_event
,
8635 .init_hook
= alc883_mitac_automute
,
8637 [ALC883_FUJITSU_PI2515
] = {
8638 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
8639 .init_verbs
= { alc883_init_verbs
,
8640 alc883_2ch_fujitsu_pi2515_verbs
},
8641 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8642 .dac_nids
= alc883_dac_nids
,
8643 .dig_out_nid
= ALC883_DIGOUT_NID
,
8644 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8645 .channel_mode
= alc883_3ST_2ch_modes
,
8646 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
8647 .unsol_event
= alc883_2ch_fujitsu_pi2515_unsol_event
,
8648 .init_hook
= alc883_2ch_fujitsu_pi2515_automute
,
8650 [ALC888_LENOVO_SKY
] = {
8651 .mixers
= { alc888_lenovo_sky_mixer
, alc883_chmode_mixer
},
8652 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_sky_verbs
},
8653 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8654 .dac_nids
= alc883_dac_nids
,
8655 .dig_out_nid
= ALC883_DIGOUT_NID
,
8656 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
8657 .adc_nids
= alc883_adc_nids
,
8658 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8659 .channel_mode
= alc883_sixstack_modes
,
8661 .input_mux
= &alc883_lenovo_sky_capture_source
,
8662 .unsol_event
= alc883_lenovo_sky_unsol_event
,
8663 .init_hook
= alc888_lenovo_sky_front_automute
,
8665 [ALC888_ASUS_M90V
] = {
8666 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8667 .init_verbs
= { alc883_init_verbs
, alc888_asus_m90v_verbs
},
8668 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8669 .dac_nids
= alc883_dac_nids
,
8670 .dig_out_nid
= ALC883_DIGOUT_NID
,
8671 .dig_in_nid
= ALC883_DIGIN_NID
,
8672 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8673 .channel_mode
= alc883_3ST_6ch_modes
,
8675 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
8676 .unsol_event
= alc883_mode2_unsol_event
,
8677 .init_hook
= alc883_mode2_inithook
,
8679 [ALC888_ASUS_EEE1601
] = {
8680 .mixers
= { alc883_asus_eee1601_mixer
},
8681 .init_verbs
= { alc883_init_verbs
, alc888_asus_eee1601_verbs
},
8682 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8683 .dac_nids
= alc883_dac_nids
,
8684 .dig_out_nid
= ALC883_DIGOUT_NID
,
8685 .dig_in_nid
= ALC883_DIGIN_NID
,
8686 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8687 .channel_mode
= alc883_3ST_2ch_modes
,
8689 .input_mux
= &alc883_asus_eee1601_capture_source
,
8690 .unsol_event
= alc883_eee1601_unsol_event
,
8691 .init_hook
= alc883_eee1601_inithook
,
8697 * BIOS auto configuration
8699 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
8700 hda_nid_t nid
, int pin_type
,
8704 struct alc_spec
*spec
= codec
->spec
;
8707 alc_set_pin_output(codec
, nid
, pin_type
);
8708 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
8711 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
8712 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
8716 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
8718 struct alc_spec
*spec
= codec
->spec
;
8721 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
8722 for (i
= 0; i
<= HDA_SIDE
; i
++) {
8723 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
8724 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
8726 alc883_auto_set_output_and_unmute(codec
, nid
, pin_type
,
8731 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
8733 struct alc_spec
*spec
= codec
->spec
;
8736 pin
= spec
->autocfg
.hp_pins
[0];
8737 if (pin
) /* connect to front */
8739 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
8740 pin
= spec
->autocfg
.speaker_pins
[0];
8742 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
8745 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8746 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8748 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
8750 struct alc_spec
*spec
= codec
->spec
;
8753 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
8754 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
8755 if (alc883_is_input_pin(nid
)) {
8756 snd_hda_codec_write(codec
, nid
, 0,
8757 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8758 (i
<= AUTO_PIN_FRONT_MIC
?
8759 PIN_VREF80
: PIN_IN
));
8760 if (nid
!= ALC883_PIN_CD_NID
)
8761 snd_hda_codec_write(codec
, nid
, 0,
8762 AC_VERB_SET_AMP_GAIN_MUTE
,
8768 #define alc883_auto_init_input_src alc882_auto_init_input_src
8770 /* almost identical with ALC880 parser... */
8771 static int alc883_parse_auto_config(struct hda_codec
*codec
)
8773 struct alc_spec
*spec
= codec
->spec
;
8774 int err
= alc880_parse_auto_config(codec
);
8779 return 0; /* no config found */
8781 err
= alc_auto_add_mic_boost(codec
);
8785 /* hack - override the init verbs */
8786 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
8787 spec
->mixers
[spec
->num_mixers
] = alc883_capture_mixer
;
8790 return 1; /* config found */
8793 /* additional initialization for auto-configuration model */
8794 static void alc883_auto_init(struct hda_codec
*codec
)
8796 struct alc_spec
*spec
= codec
->spec
;
8797 alc883_auto_init_multi_out(codec
);
8798 alc883_auto_init_hp_out(codec
);
8799 alc883_auto_init_analog_input(codec
);
8800 alc883_auto_init_input_src(codec
);
8801 if (spec
->unsol_event
)
8802 alc_inithook(codec
);
8805 static int patch_alc883(struct hda_codec
*codec
)
8807 struct alc_spec
*spec
;
8808 int err
, board_config
;
8810 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
8816 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
8818 board_config
= snd_hda_check_board_config(codec
, ALC883_MODEL_LAST
,
8821 if (board_config
< 0) {
8822 printk(KERN_INFO
"hda_codec: Unknown model for ALC883, "
8823 "trying auto-probe from BIOS...\n");
8824 board_config
= ALC883_AUTO
;
8827 if (board_config
== ALC883_AUTO
) {
8828 /* automatic parse from the BIOS config */
8829 err
= alc883_parse_auto_config(codec
);
8835 "hda_codec: Cannot set up configuration "
8836 "from BIOS. Using base mode...\n");
8837 board_config
= ALC883_3ST_2ch_DIG
;
8841 if (board_config
!= ALC883_AUTO
)
8842 setup_preset(spec
, &alc883_presets
[board_config
]);
8844 switch (codec
->vendor_id
) {
8846 if (codec
->revision_id
== 0x100101) {
8847 spec
->stream_name_analog
= "ALC1200 Analog";
8848 spec
->stream_name_digital
= "ALC1200 Digital";
8850 spec
->stream_name_analog
= "ALC888 Analog";
8851 spec
->stream_name_digital
= "ALC888 Digital";
8855 spec
->stream_name_analog
= "ALC889 Analog";
8856 spec
->stream_name_digital
= "ALC889 Digital";
8859 spec
->stream_name_analog
= "ALC883 Analog";
8860 spec
->stream_name_digital
= "ALC883 Digital";
8864 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
8865 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
8866 spec
->stream_analog_alt_capture
= &alc883_pcm_analog_alt_capture
;
8868 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
8869 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
8871 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
8872 spec
->adc_nids
= alc883_adc_nids
;
8873 spec
->capsrc_nids
= alc883_capsrc_nids
;
8875 spec
->vmaster_nid
= 0x0c;
8877 codec
->patch_ops
= alc_patch_ops
;
8878 if (board_config
== ALC883_AUTO
)
8879 spec
->init_hook
= alc883_auto_init
;
8881 #ifdef CONFIG_SND_HDA_POWER_SAVE
8882 if (!spec
->loopback
.amplist
)
8883 spec
->loopback
.amplist
= alc883_loopbacks
;
8893 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8894 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8896 #define alc262_dac_nids alc260_dac_nids
8897 #define alc262_adc_nids alc882_adc_nids
8898 #define alc262_adc_nids_alt alc882_adc_nids_alt
8899 #define alc262_capsrc_nids alc882_capsrc_nids
8900 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8902 #define alc262_modes alc260_modes
8903 #define alc262_capture_source alc882_capture_source
8905 static hda_nid_t alc262_dmic_adc_nids
[1] = {
8910 static hda_nid_t alc262_dmic_capsrc_nids
[1] = { 0x22 };
8912 static struct snd_kcontrol_new alc262_base_mixer
[] = {
8913 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8914 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8915 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8916 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8917 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8918 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8919 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8920 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8921 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8922 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8923 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8924 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8925 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8926 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8927 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
8928 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8929 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8930 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
8934 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
8935 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8936 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8937 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8938 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8939 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8940 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8943 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8944 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8945 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8946 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8947 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8948 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8949 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8950 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8954 /* update HP, line and mono-out pins according to the master switch */
8955 static void alc262_hp_master_update(struct hda_codec
*codec
)
8957 struct alc_spec
*spec
= codec
->spec
;
8958 int val
= spec
->master_sw
;
8961 snd_hda_codec_write_cache(codec
, 0x1b, 0,
8962 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8964 snd_hda_codec_write_cache(codec
, 0x15, 0,
8965 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8967 /* mono (speaker) depending on the HP jack sense */
8968 val
= val
&& !spec
->jack_present
;
8969 snd_hda_codec_write_cache(codec
, 0x16, 0,
8970 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8974 static void alc262_hp_bpc_automute(struct hda_codec
*codec
)
8976 struct alc_spec
*spec
= codec
->spec
;
8977 unsigned int presence
;
8978 presence
= snd_hda_codec_read(codec
, 0x1b, 0,
8979 AC_VERB_GET_PIN_SENSE
, 0);
8980 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
8981 alc262_hp_master_update(codec
);
8984 static void alc262_hp_bpc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
8986 if ((res
>> 26) != ALC880_HP_EVENT
)
8988 alc262_hp_bpc_automute(codec
);
8991 static void alc262_hp_wildwest_automute(struct hda_codec
*codec
)
8993 struct alc_spec
*spec
= codec
->spec
;
8994 unsigned int presence
;
8995 presence
= snd_hda_codec_read(codec
, 0x15, 0,
8996 AC_VERB_GET_PIN_SENSE
, 0);
8997 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
8998 alc262_hp_master_update(codec
);
9001 static void alc262_hp_wildwest_unsol_event(struct hda_codec
*codec
,
9004 if ((res
>> 26) != ALC880_HP_EVENT
)
9006 alc262_hp_wildwest_automute(codec
);
9009 static int alc262_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
9010 struct snd_ctl_elem_value
*ucontrol
)
9012 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9013 struct alc_spec
*spec
= codec
->spec
;
9014 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
9018 static int alc262_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
9019 struct snd_ctl_elem_value
*ucontrol
)
9021 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9022 struct alc_spec
*spec
= codec
->spec
;
9023 int val
= !!*ucontrol
->value
.integer
.value
;
9025 if (val
== spec
->master_sw
)
9027 spec
->master_sw
= val
;
9028 alc262_hp_master_update(codec
);
9032 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
9034 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9035 .name
= "Master Playback Switch",
9036 .info
= snd_ctl_boolean_mono_info
,
9037 .get
= alc262_hp_master_sw_get
,
9038 .put
= alc262_hp_master_sw_put
,
9040 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9041 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9042 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9043 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9045 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9048 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9049 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9050 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9051 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9052 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
9053 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9054 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9055 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9056 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9057 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
9058 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
9059 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
9060 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
9064 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
9066 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9067 .name
= "Master Playback Switch",
9068 .info
= snd_ctl_boolean_mono_info
,
9069 .get
= alc262_hp_master_sw_get
,
9070 .put
= alc262_hp_master_sw_put
,
9072 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9073 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9074 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9075 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9076 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9078 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9080 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
9081 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
9082 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT
),
9083 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9084 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9085 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9086 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9087 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
9088 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
9092 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
9093 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9094 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9095 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT
),
9099 /* mute/unmute internal speaker according to the hp jack and mute state */
9100 static void alc262_hp_t5735_automute(struct hda_codec
*codec
, int force
)
9102 struct alc_spec
*spec
= codec
->spec
;
9104 if (force
|| !spec
->sense_updated
) {
9105 unsigned int present
;
9106 present
= snd_hda_codec_read(codec
, 0x15, 0,
9107 AC_VERB_GET_PIN_SENSE
, 0);
9108 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
9109 spec
->sense_updated
= 1;
9111 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0, HDA_AMP_MUTE
,
9112 spec
->jack_present
? HDA_AMP_MUTE
: 0);
9115 static void alc262_hp_t5735_unsol_event(struct hda_codec
*codec
,
9118 if ((res
>> 26) != ALC880_HP_EVENT
)
9120 alc262_hp_t5735_automute(codec
, 1);
9123 static void alc262_hp_t5735_init_hook(struct hda_codec
*codec
)
9125 alc262_hp_t5735_automute(codec
, 1);
9128 static struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
9129 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9130 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9131 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9132 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9139 static struct hda_verb alc262_hp_t5735_verbs
[] = {
9140 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9141 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9143 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9147 static struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
9148 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9149 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
9150 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
9151 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
9152 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9153 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9157 static struct hda_verb alc262_hp_rp5700_verbs
[] = {
9158 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9159 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9160 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9161 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9162 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
9163 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9164 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9165 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9166 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
9167 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
9171 static struct hda_input_mux alc262_hp_rp5700_capture_source
= {
9178 /* bind hp and internal speaker mute (with plug check) */
9179 static int alc262_sony_master_sw_put(struct snd_kcontrol
*kcontrol
,
9180 struct snd_ctl_elem_value
*ucontrol
)
9182 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9183 long *valp
= ucontrol
->value
.integer
.value
;
9186 /* change hp mute */
9187 change
= snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
9189 valp
[0] ? 0 : HDA_AMP_MUTE
);
9190 change
|= snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
9192 valp
[1] ? 0 : HDA_AMP_MUTE
);
9194 /* change speaker according to HP jack state */
9195 struct alc_spec
*spec
= codec
->spec
;
9197 if (spec
->jack_present
)
9198 mute
= HDA_AMP_MUTE
;
9200 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0,
9202 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9203 HDA_AMP_MUTE
, mute
);
9208 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
9209 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9211 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9212 .name
= "Master Playback Switch",
9213 .info
= snd_hda_mixer_amp_switch_info
,
9214 .get
= snd_hda_mixer_amp_switch_get
,
9215 .put
= alc262_sony_master_sw_put
,
9216 .private_value
= HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
9218 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9219 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9220 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9221 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9225 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
9226 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9227 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9228 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9229 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9230 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9231 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9232 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9236 #define alc262_capture_mixer alc882_capture_mixer
9237 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9240 * generic initialization of ADC, input mixers and output mixers
9242 static struct hda_verb alc262_init_verbs
[] = {
9244 * Unmute ADC0-2 and set the default input to mic-in
9246 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9247 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9248 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9249 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9250 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9251 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9253 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9255 * Note: PASD motherboards uses the Line In 2 as the input for
9256 * front panel mic (mic 2)
9258 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9259 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9260 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9261 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9262 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9263 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9266 * Set up output mixers (0x0c - 0x0e)
9268 /* set vol=0 to output mixers */
9269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9270 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9271 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9272 /* set up input amps for analog loopback */
9273 /* Amp Indices: DAC = 0, mixer = 1 */
9274 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9275 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9276 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9277 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9278 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9279 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9281 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
9282 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
9283 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
9284 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9286 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9288 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
9289 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
9290 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
9291 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
9292 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
9294 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9295 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
9297 /* FIXME: use matrix-type input source selection */
9298 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9299 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9302 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9303 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9318 static struct hda_verb alc262_eapd_verbs
[] = {
9319 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
9320 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
9324 static struct hda_verb alc262_hippo_unsol_verbs
[] = {
9325 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9330 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
9331 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
9332 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9333 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
9335 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9336 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9340 static struct hda_verb alc262_sony_unsol_verbs
[] = {
9341 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
9342 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9343 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
9345 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9346 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9350 static struct hda_input_mux alc262_dmic_capture_source
= {
9353 { "Int DMic", 0x9 },
9358 static struct snd_kcontrol_new alc262_toshiba_s06_mixer
[] = {
9359 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9360 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9361 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9362 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9363 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9364 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
9365 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
9367 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9368 /* The multiple "Capture Source" controls confuse alsamixer
9369 * So call somewhat different..
9371 /* .name = "Capture Source", */
9372 .name
= "Input Source",
9374 .info
= alc_mux_enum_info
,
9375 .get
= alc_mux_enum_get
,
9376 .put
= alc_mux_enum_put
,
9381 static struct hda_verb alc262_toshiba_s06_verbs
[] = {
9382 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
9383 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9384 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9385 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9386 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x09},
9387 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9388 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
9389 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9393 static void alc262_dmic_automute(struct hda_codec
*codec
)
9395 unsigned int present
;
9397 present
= snd_hda_codec_read(codec
, 0x18, 0,
9398 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
9399 snd_hda_codec_write(codec
, 0x22, 0,
9400 AC_VERB_SET_CONNECT_SEL
, present
? 0x0 : 0x09);
9403 /* toggle speaker-output according to the hp-jack state */
9404 static void alc262_toshiba_s06_speaker_automute(struct hda_codec
*codec
)
9406 unsigned int present
;
9409 present
= snd_hda_codec_read(codec
, 0x15, 0,
9410 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
9411 bits
= present
? 0 : PIN_OUT
;
9412 snd_hda_codec_write(codec
, 0x14, 0,
9413 AC_VERB_SET_PIN_WIDGET_CONTROL
, bits
);
9418 /* unsolicited event for HP jack sensing */
9419 static void alc262_toshiba_s06_unsol_event(struct hda_codec
*codec
,
9422 if ((res
>> 26) == ALC880_HP_EVENT
)
9423 alc262_toshiba_s06_speaker_automute(codec
);
9424 if ((res
>> 26) == ALC880_MIC_EVENT
)
9425 alc262_dmic_automute(codec
);
9429 static void alc262_toshiba_s06_init_hook(struct hda_codec
*codec
)
9431 alc262_toshiba_s06_speaker_automute(codec
);
9432 alc262_dmic_automute(codec
);
9435 /* mute/unmute internal speaker according to the hp jack and mute state */
9436 static void alc262_hippo_automute(struct hda_codec
*codec
)
9438 struct alc_spec
*spec
= codec
->spec
;
9440 unsigned int present
;
9442 /* need to execute and sync at first */
9443 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
9444 present
= snd_hda_codec_read(codec
, 0x15, 0,
9445 AC_VERB_GET_PIN_SENSE
, 0);
9446 spec
->jack_present
= (present
& 0x80000000) != 0;
9447 if (spec
->jack_present
) {
9448 /* mute internal speaker */
9449 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9450 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9452 /* unmute internal speaker if necessary */
9453 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
9454 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9455 HDA_AMP_MUTE
, mute
);
9459 /* unsolicited event for HP jack sensing */
9460 static void alc262_hippo_unsol_event(struct hda_codec
*codec
,
9463 if ((res
>> 26) != ALC880_HP_EVENT
)
9465 alc262_hippo_automute(codec
);
9468 static void alc262_hippo1_automute(struct hda_codec
*codec
)
9471 unsigned int present
;
9473 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
9474 present
= snd_hda_codec_read(codec
, 0x1b, 0,
9475 AC_VERB_GET_PIN_SENSE
, 0);
9476 present
= (present
& 0x80000000) != 0;
9478 /* mute internal speaker */
9479 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9480 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9482 /* unmute internal speaker if necessary */
9483 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
9484 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9485 HDA_AMP_MUTE
, mute
);
9489 /* unsolicited event for HP jack sensing */
9490 static void alc262_hippo1_unsol_event(struct hda_codec
*codec
,
9493 if ((res
>> 26) != ALC880_HP_EVENT
)
9495 alc262_hippo1_automute(codec
);
9501 * 0x16 = internal speaker
9502 * 0x18 = external mic
9505 static struct snd_kcontrol_new alc262_nec_mixer
[] = {
9506 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
9507 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT
),
9509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9510 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9511 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9513 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
9514 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9518 static struct hda_verb alc262_nec_verbs
[] = {
9519 /* Unmute Speaker */
9520 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9523 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9524 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9526 /* External mic to headphone */
9527 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9528 /* External mic to speaker */
9529 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9535 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
9536 * 0x1b = port replicator headphone out
9539 #define ALC_HP_EVENT 0x37
9541 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
9542 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
9543 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9544 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
9545 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9549 static struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
9550 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
9551 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9555 static struct hda_input_mux alc262_fujitsu_capture_source
= {
9564 static struct hda_input_mux alc262_HP_capture_source
= {
9568 { "Front Mic", 0x1 },
9575 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
9579 { "Front Mic", 0x2 },
9585 /* mute/unmute internal speaker according to the hp jacks and mute state */
9586 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
9588 struct alc_spec
*spec
= codec
->spec
;
9591 if (force
|| !spec
->sense_updated
) {
9592 unsigned int present
;
9593 /* need to execute and sync at first */
9594 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
9595 /* check laptop HP jack */
9596 present
= snd_hda_codec_read(codec
, 0x14, 0,
9597 AC_VERB_GET_PIN_SENSE
, 0);
9598 /* need to execute and sync at first */
9599 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
9600 /* check docking HP jack */
9601 present
|= snd_hda_codec_read(codec
, 0x1b, 0,
9602 AC_VERB_GET_PIN_SENSE
, 0);
9603 if (present
& AC_PINSENSE_PRESENCE
)
9604 spec
->jack_present
= 1;
9606 spec
->jack_present
= 0;
9607 spec
->sense_updated
= 1;
9609 /* unmute internal speaker only if both HPs are unplugged and
9610 * master switch is on
9612 if (spec
->jack_present
)
9613 mute
= HDA_AMP_MUTE
;
9615 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
9616 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9617 HDA_AMP_MUTE
, mute
);
9620 /* unsolicited event for HP jack sensing */
9621 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
9624 if ((res
>> 26) != ALC_HP_EVENT
)
9626 alc262_fujitsu_automute(codec
, 1);
9629 static void alc262_fujitsu_init_hook(struct hda_codec
*codec
)
9631 alc262_fujitsu_automute(codec
, 1);
9634 /* bind volumes of both NID 0x0c and 0x0d */
9635 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
9636 .ops
= &snd_hda_bind_vol
,
9638 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
9639 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
9644 /* mute/unmute internal speaker according to the hp jack and mute state */
9645 static void alc262_lenovo_3000_automute(struct hda_codec
*codec
, int force
)
9647 struct alc_spec
*spec
= codec
->spec
;
9650 if (force
|| !spec
->sense_updated
) {
9651 unsigned int present_int_hp
;
9652 /* need to execute and sync at first */
9653 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
9654 present_int_hp
= snd_hda_codec_read(codec
, 0x1b, 0,
9655 AC_VERB_GET_PIN_SENSE
, 0);
9656 spec
->jack_present
= (present_int_hp
& 0x80000000) != 0;
9657 spec
->sense_updated
= 1;
9659 if (spec
->jack_present
) {
9660 /* mute internal speaker */
9661 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9662 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9663 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9664 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9666 /* unmute internal speaker if necessary */
9667 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
9668 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9669 HDA_AMP_MUTE
, mute
);
9670 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9671 HDA_AMP_MUTE
, mute
);
9675 /* unsolicited event for HP jack sensing */
9676 static void alc262_lenovo_3000_unsol_event(struct hda_codec
*codec
,
9679 if ((res
>> 26) != ALC_HP_EVENT
)
9681 alc262_lenovo_3000_automute(codec
, 1);
9684 /* bind hp and internal speaker mute (with plug check) */
9685 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
9686 struct snd_ctl_elem_value
*ucontrol
)
9688 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9689 long *valp
= ucontrol
->value
.integer
.value
;
9692 change
= snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9694 valp
? 0 : HDA_AMP_MUTE
);
9695 change
|= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
9697 valp
? 0 : HDA_AMP_MUTE
);
9700 alc262_fujitsu_automute(codec
, 0);
9704 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
9705 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
9707 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9708 .name
= "Master Playback Switch",
9709 .info
= snd_hda_mixer_amp_switch_info
,
9710 .get
= snd_hda_mixer_amp_switch_get
,
9711 .put
= alc262_fujitsu_master_sw_put
,
9712 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
9714 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9715 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9716 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT
),
9717 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT
),
9718 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9721 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
9722 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9723 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9727 /* bind hp and internal speaker mute (with plug check) */
9728 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol
*kcontrol
,
9729 struct snd_ctl_elem_value
*ucontrol
)
9731 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9732 long *valp
= ucontrol
->value
.integer
.value
;
9735 change
= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
9737 valp
? 0 : HDA_AMP_MUTE
);
9740 alc262_lenovo_3000_automute(codec
, 0);
9744 static struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
9745 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
9747 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9748 .name
= "Master Playback Switch",
9749 .info
= snd_hda_mixer_amp_switch_info
,
9750 .get
= snd_hda_mixer_amp_switch_get
,
9751 .put
= alc262_lenovo_3000_master_sw_put
,
9752 .private_value
= HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
9754 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9755 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9756 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9757 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9758 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9759 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
9760 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9761 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9765 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer
[] = {
9766 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
9768 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9769 .name
= "Master Playback Switch",
9770 .info
= snd_hda_mixer_amp_switch_info
,
9771 .get
= snd_hda_mixer_amp_switch_get
,
9772 .put
= alc262_sony_master_sw_put
,
9773 .private_value
= HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
9775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9776 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9777 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9778 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9779 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9780 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
9784 /* additional init verbs for Benq laptops */
9785 static struct hda_verb alc262_EAPD_verbs
[] = {
9786 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9787 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
9791 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
9792 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9793 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9795 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9796 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
9800 /* Samsung Q1 Ultra Vista model setup */
9801 static struct snd_kcontrol_new alc262_ultra_mixer
[] = {
9802 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9803 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
9804 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9805 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9806 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
9807 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT
),
9811 static struct hda_verb alc262_ultra_verbs
[] = {
9813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9815 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9817 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9818 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9819 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9820 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9822 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9823 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9824 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9825 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9826 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9828 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9830 /* ADC, choose mic */
9831 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9832 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9833 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9834 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9835 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9836 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9837 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9838 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9839 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
9840 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
9844 /* mute/unmute internal speaker according to the hp jack and mute state */
9845 static void alc262_ultra_automute(struct hda_codec
*codec
)
9847 struct alc_spec
*spec
= codec
->spec
;
9851 /* auto-mute only when HP is used as HP */
9852 if (!spec
->cur_mux
[0]) {
9853 unsigned int present
;
9854 /* need to execute and sync at first */
9855 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
9856 present
= snd_hda_codec_read(codec
, 0x15, 0,
9857 AC_VERB_GET_PIN_SENSE
, 0);
9858 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
9859 if (spec
->jack_present
)
9860 mute
= HDA_AMP_MUTE
;
9862 /* mute/unmute internal speaker */
9863 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9864 HDA_AMP_MUTE
, mute
);
9865 /* mute/unmute HP */
9866 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9867 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
9870 /* unsolicited event for HP jack sensing */
9871 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
9874 if ((res
>> 26) != ALC880_HP_EVENT
)
9876 alc262_ultra_automute(codec
);
9879 static struct hda_input_mux alc262_ultra_capture_source
= {
9883 { "Headphone", 0x7 },
9887 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
9888 struct snd_ctl_elem_value
*ucontrol
)
9890 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9891 struct alc_spec
*spec
= codec
->spec
;
9894 ret
= alc882_mux_enum_put(kcontrol
, ucontrol
);
9897 /* reprogram the HP pin as mic or HP according to the input source */
9898 snd_hda_codec_write_cache(codec
, 0x15, 0,
9899 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9900 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
9901 alc262_ultra_automute(codec
); /* mute/unmute HP */
9905 static struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
9906 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
9907 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
9909 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9910 .name
= "Capture Source",
9911 .info
= alc882_mux_enum_info
,
9912 .get
= alc882_mux_enum_get
,
9913 .put
= alc262_ultra_mux_enum_put
,
9918 /* add playback controls from the parsed DAC table */
9919 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
9920 const struct auto_pin_cfg
*cfg
)
9925 spec
->multiout
.num_dacs
= 1; /* only use one dac */
9926 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
9927 spec
->multiout
.dac_nids
[0] = 2;
9929 nid
= cfg
->line_out_pins
[0];
9931 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9932 "Front Playback Volume",
9933 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
));
9936 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9937 "Front Playback Switch",
9938 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
9943 nid
= cfg
->speaker_pins
[0];
9946 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9947 "Speaker Playback Volume",
9948 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9952 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9953 "Speaker Playback Switch",
9954 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
9959 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9960 "Speaker Playback Switch",
9961 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
9967 nid
= cfg
->hp_pins
[0];
9969 /* spec->multiout.hp_nid = 2; */
9971 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9972 "Headphone Playback Volume",
9973 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9977 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9978 "Headphone Playback Switch",
9979 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
9984 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9985 "Headphone Playback Switch",
9986 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
9995 /* identical with ALC880 */
9996 #define alc262_auto_create_analog_input_ctls \
9997 alc880_auto_create_analog_input_ctls
10000 * generic initialization of ADC, input mixers and output mixers
10002 static struct hda_verb alc262_volume_init_verbs
[] = {
10004 * Unmute ADC0-2 and set the default input to mic-in
10006 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
10007 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10008 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
10009 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10010 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10011 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10013 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10015 * Note: PASD motherboards uses the Line In 2 as the input for
10016 * front panel mic (mic 2)
10018 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10019 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10026 * Set up output mixers (0x0c - 0x0f)
10028 /* set vol=0 to output mixers */
10029 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10030 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10031 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10033 /* set up input amps for analog loopback */
10034 /* Amp Indices: DAC = 0, mixer = 1 */
10035 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10036 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10037 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10038 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10039 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10040 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10042 /* FIXME: use matrix-type input source selection */
10043 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10044 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10045 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10046 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10047 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10048 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10050 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10051 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10052 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10053 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10055 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10056 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
10057 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
10058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
10063 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
10065 * Unmute ADC0-2 and set the default input to mic-in
10067 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
10068 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10069 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
10070 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10071 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10074 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10076 * Note: PASD motherboards uses the Line In 2 as the input for
10077 * front panel mic (mic 2)
10079 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10080 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10081 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10083 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10084 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10085 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
10086 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
10089 * Set up output mixers (0x0c - 0x0e)
10091 /* set vol=0 to output mixers */
10092 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10093 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10094 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10096 /* set up input amps for analog loopback */
10097 /* Amp Indices: DAC = 0, mixer = 1 */
10098 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10099 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10100 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10101 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10102 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10103 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10105 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10106 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10107 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10109 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10110 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10112 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
10113 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10115 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10116 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10117 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10118 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10119 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10121 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
10122 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10123 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10124 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
10125 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10126 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10129 /* FIXME: use matrix-type input source selection */
10130 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10131 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10132 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10133 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
10134 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
10135 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
10137 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10138 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
10139 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
10140 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
10142 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10143 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
10144 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
10145 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
10147 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10152 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
10154 * Unmute ADC0-2 and set the default input to mic-in
10156 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
10157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10158 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
10159 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10160 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10161 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10163 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10165 * Note: PASD motherboards uses the Line In 2 as the input for front
10166 * panel mic (mic 2)
10168 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10169 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10170 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10171 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10172 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10173 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10174 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
10175 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
10176 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
10178 * Set up output mixers (0x0c - 0x0e)
10180 /* set vol=0 to output mixers */
10181 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10182 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10183 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10185 /* set up input amps for analog loopback */
10186 /* Amp Indices: DAC = 0, mixer = 1 */
10187 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10188 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10189 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10190 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10191 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10192 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10195 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
10196 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
10197 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
10198 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
10199 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
10200 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
10201 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
10203 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10204 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10206 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
10207 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
10209 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10210 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10211 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10212 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
10213 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10214 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
10216 /* FIXME: use matrix-type input source selection */
10217 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10218 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10219 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10220 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
10221 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
10222 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
10223 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
10224 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10225 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
10227 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10228 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
10229 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
10230 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
10231 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
10232 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10233 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
10235 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
10236 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
10237 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
10238 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
10239 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
10240 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10241 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
10243 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10248 static struct hda_verb alc262_toshiba_rx1_unsol_verbs
[] = {
10250 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Front Speaker */
10251 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10252 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
10254 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* MIC jack */
10255 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
10256 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
10257 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0) },
10259 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP jack */
10260 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10261 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10266 #ifdef CONFIG_SND_HDA_POWER_SAVE
10267 #define alc262_loopbacks alc880_loopbacks
10270 /* pcm configuration: identiacal with ALC880 */
10271 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10272 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10273 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10274 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10277 * BIOS auto configuration
10279 static int alc262_parse_auto_config(struct hda_codec
*codec
)
10281 struct alc_spec
*spec
= codec
->spec
;
10283 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
10285 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10289 if (!spec
->autocfg
.line_outs
)
10290 return 0; /* can't find valid BIOS pin config */
10291 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
10294 err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
10298 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
10300 if (spec
->autocfg
.dig_out_pin
)
10301 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
10302 if (spec
->autocfg
.dig_in_pin
)
10303 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
10305 if (spec
->kctl_alloc
)
10306 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
10308 spec
->init_verbs
[spec
->num_init_verbs
++] = alc262_volume_init_verbs
;
10309 spec
->num_mux_defs
= 1;
10310 spec
->input_mux
= &spec
->private_imux
;
10312 err
= alc_auto_add_mic_boost(codec
);
10319 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10320 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10321 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10322 #define alc262_auto_init_input_src alc882_auto_init_input_src
10325 /* init callback for auto-configuration model -- overriding the default init */
10326 static void alc262_auto_init(struct hda_codec
*codec
)
10328 struct alc_spec
*spec
= codec
->spec
;
10329 alc262_auto_init_multi_out(codec
);
10330 alc262_auto_init_hp_out(codec
);
10331 alc262_auto_init_analog_input(codec
);
10332 alc262_auto_init_input_src(codec
);
10333 if (spec
->unsol_event
)
10334 alc_inithook(codec
);
10338 * configuration and preset
10340 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
10341 [ALC262_BASIC
] = "basic",
10342 [ALC262_HIPPO
] = "hippo",
10343 [ALC262_HIPPO_1
] = "hippo_1",
10344 [ALC262_FUJITSU
] = "fujitsu",
10345 [ALC262_HP_BPC
] = "hp-bpc",
10346 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
10347 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
10348 [ALC262_HP_RP5700
] = "hp-rp5700",
10349 [ALC262_BENQ_ED8
] = "benq",
10350 [ALC262_BENQ_T31
] = "benq-t31",
10351 [ALC262_SONY_ASSAMD
] = "sony-assamd",
10352 [ALC262_TOSHIBA_S06
] = "toshiba-s06",
10353 [ALC262_TOSHIBA_RX1
] = "toshiba-rx1",
10354 [ALC262_ULTRA
] = "ultra",
10355 [ALC262_LENOVO_3000
] = "lenovo-3000",
10356 [ALC262_NEC
] = "nec",
10357 [ALC262_AUTO
] = "auto",
10360 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
10361 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
10362 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC
),
10363 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC
),
10364 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC
),
10365 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC
),
10366 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC
),
10367 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC
),
10368 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC
),
10369 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC
),
10370 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC
),
10371 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
10372 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
10373 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
10374 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
10375 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
10376 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
10377 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
10378 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
10379 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
10380 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
10381 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
10382 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10383 ALC262_HP_TC_T5735
),
10384 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
10385 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
10386 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
10387 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
10388 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
10389 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD
),
10390 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10391 ALC262_TOSHIBA_RX1
),
10392 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06
),
10393 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
10394 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
10395 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA
),
10396 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA
),
10397 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
10398 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
10399 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
10400 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
10404 static struct alc_config_preset alc262_presets
[] = {
10406 .mixers
= { alc262_base_mixer
},
10407 .init_verbs
= { alc262_init_verbs
},
10408 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10409 .dac_nids
= alc262_dac_nids
,
10411 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10412 .channel_mode
= alc262_modes
,
10413 .input_mux
= &alc262_capture_source
,
10416 .mixers
= { alc262_base_mixer
},
10417 .init_verbs
= { alc262_init_verbs
, alc262_hippo_unsol_verbs
},
10418 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10419 .dac_nids
= alc262_dac_nids
,
10421 .dig_out_nid
= ALC262_DIGOUT_NID
,
10422 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10423 .channel_mode
= alc262_modes
,
10424 .input_mux
= &alc262_capture_source
,
10425 .unsol_event
= alc262_hippo_unsol_event
,
10426 .init_hook
= alc262_hippo_automute
,
10428 [ALC262_HIPPO_1
] = {
10429 .mixers
= { alc262_hippo1_mixer
},
10430 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
10431 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10432 .dac_nids
= alc262_dac_nids
,
10434 .dig_out_nid
= ALC262_DIGOUT_NID
,
10435 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10436 .channel_mode
= alc262_modes
,
10437 .input_mux
= &alc262_capture_source
,
10438 .unsol_event
= alc262_hippo1_unsol_event
,
10439 .init_hook
= alc262_hippo1_automute
,
10441 [ALC262_FUJITSU
] = {
10442 .mixers
= { alc262_fujitsu_mixer
},
10443 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
10444 alc262_fujitsu_unsol_verbs
},
10445 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10446 .dac_nids
= alc262_dac_nids
,
10448 .dig_out_nid
= ALC262_DIGOUT_NID
,
10449 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10450 .channel_mode
= alc262_modes
,
10451 .input_mux
= &alc262_fujitsu_capture_source
,
10452 .unsol_event
= alc262_fujitsu_unsol_event
,
10453 .init_hook
= alc262_fujitsu_init_hook
,
10455 [ALC262_HP_BPC
] = {
10456 .mixers
= { alc262_HP_BPC_mixer
},
10457 .init_verbs
= { alc262_HP_BPC_init_verbs
},
10458 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10459 .dac_nids
= alc262_dac_nids
,
10461 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10462 .channel_mode
= alc262_modes
,
10463 .input_mux
= &alc262_HP_capture_source
,
10464 .unsol_event
= alc262_hp_bpc_unsol_event
,
10465 .init_hook
= alc262_hp_bpc_automute
,
10467 [ALC262_HP_BPC_D7000_WF
] = {
10468 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
10469 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
10470 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10471 .dac_nids
= alc262_dac_nids
,
10473 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10474 .channel_mode
= alc262_modes
,
10475 .input_mux
= &alc262_HP_D7000_capture_source
,
10476 .unsol_event
= alc262_hp_wildwest_unsol_event
,
10477 .init_hook
= alc262_hp_wildwest_automute
,
10479 [ALC262_HP_BPC_D7000_WL
] = {
10480 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
10481 alc262_HP_BPC_WildWest_option_mixer
},
10482 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
10483 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10484 .dac_nids
= alc262_dac_nids
,
10486 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10487 .channel_mode
= alc262_modes
,
10488 .input_mux
= &alc262_HP_D7000_capture_source
,
10489 .unsol_event
= alc262_hp_wildwest_unsol_event
,
10490 .init_hook
= alc262_hp_wildwest_automute
,
10492 [ALC262_HP_TC_T5735
] = {
10493 .mixers
= { alc262_hp_t5735_mixer
},
10494 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
10495 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10496 .dac_nids
= alc262_dac_nids
,
10498 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10499 .channel_mode
= alc262_modes
,
10500 .input_mux
= &alc262_capture_source
,
10501 .unsol_event
= alc262_hp_t5735_unsol_event
,
10502 .init_hook
= alc262_hp_t5735_init_hook
,
10504 [ALC262_HP_RP5700
] = {
10505 .mixers
= { alc262_hp_rp5700_mixer
},
10506 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
10507 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10508 .dac_nids
= alc262_dac_nids
,
10509 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10510 .channel_mode
= alc262_modes
,
10511 .input_mux
= &alc262_hp_rp5700_capture_source
,
10513 [ALC262_BENQ_ED8
] = {
10514 .mixers
= { alc262_base_mixer
},
10515 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
10516 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10517 .dac_nids
= alc262_dac_nids
,
10519 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10520 .channel_mode
= alc262_modes
,
10521 .input_mux
= &alc262_capture_source
,
10523 [ALC262_SONY_ASSAMD
] = {
10524 .mixers
= { alc262_sony_mixer
},
10525 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
10526 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10527 .dac_nids
= alc262_dac_nids
,
10529 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10530 .channel_mode
= alc262_modes
,
10531 .input_mux
= &alc262_capture_source
,
10532 .unsol_event
= alc262_hippo_unsol_event
,
10533 .init_hook
= alc262_hippo_automute
,
10535 [ALC262_BENQ_T31
] = {
10536 .mixers
= { alc262_benq_t31_mixer
},
10537 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
, alc262_hippo_unsol_verbs
},
10538 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10539 .dac_nids
= alc262_dac_nids
,
10541 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10542 .channel_mode
= alc262_modes
,
10543 .input_mux
= &alc262_capture_source
,
10544 .unsol_event
= alc262_hippo_unsol_event
,
10545 .init_hook
= alc262_hippo_automute
,
10548 .mixers
= { alc262_ultra_mixer
, alc262_ultra_capture_mixer
},
10549 .init_verbs
= { alc262_ultra_verbs
},
10550 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10551 .dac_nids
= alc262_dac_nids
,
10552 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10553 .channel_mode
= alc262_modes
,
10554 .input_mux
= &alc262_ultra_capture_source
,
10555 .adc_nids
= alc262_adc_nids
, /* ADC0 */
10556 .capsrc_nids
= alc262_capsrc_nids
,
10557 .num_adc_nids
= 1, /* single ADC */
10558 .unsol_event
= alc262_ultra_unsol_event
,
10559 .init_hook
= alc262_ultra_automute
,
10561 [ALC262_LENOVO_3000
] = {
10562 .mixers
= { alc262_lenovo_3000_mixer
},
10563 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
10564 alc262_lenovo_3000_unsol_verbs
},
10565 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10566 .dac_nids
= alc262_dac_nids
,
10568 .dig_out_nid
= ALC262_DIGOUT_NID
,
10569 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10570 .channel_mode
= alc262_modes
,
10571 .input_mux
= &alc262_fujitsu_capture_source
,
10572 .unsol_event
= alc262_lenovo_3000_unsol_event
,
10575 .mixers
= { alc262_nec_mixer
},
10576 .init_verbs
= { alc262_nec_verbs
},
10577 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10578 .dac_nids
= alc262_dac_nids
,
10580 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10581 .channel_mode
= alc262_modes
,
10582 .input_mux
= &alc262_capture_source
,
10584 [ALC262_TOSHIBA_S06
] = {
10585 .mixers
= { alc262_toshiba_s06_mixer
},
10586 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_s06_verbs
,
10587 alc262_eapd_verbs
},
10588 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10589 .capsrc_nids
= alc262_dmic_capsrc_nids
,
10590 .dac_nids
= alc262_dac_nids
,
10591 .adc_nids
= alc262_dmic_adc_nids
, /* ADC0 */
10592 .dig_out_nid
= ALC262_DIGOUT_NID
,
10593 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10594 .channel_mode
= alc262_modes
,
10595 .input_mux
= &alc262_dmic_capture_source
,
10596 .unsol_event
= alc262_toshiba_s06_unsol_event
,
10597 .init_hook
= alc262_toshiba_s06_init_hook
,
10599 [ALC262_TOSHIBA_RX1
] = {
10600 .mixers
= { alc262_toshiba_rx1_mixer
},
10601 .init_verbs
= { alc262_init_verbs
, alc262_toshiba_rx1_unsol_verbs
},
10602 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
10603 .dac_nids
= alc262_dac_nids
,
10605 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
10606 .channel_mode
= alc262_modes
,
10607 .input_mux
= &alc262_capture_source
,
10608 .unsol_event
= alc262_hippo_unsol_event
,
10609 .init_hook
= alc262_hippo_automute
,
10613 static int patch_alc262(struct hda_codec
*codec
)
10615 struct alc_spec
*spec
;
10619 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
10623 codec
->spec
= spec
;
10625 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10630 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
10631 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
10632 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
10633 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
10637 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
10639 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
10643 if (board_config
< 0) {
10644 printk(KERN_INFO
"hda_codec: Unknown model for ALC262, "
10645 "trying auto-probe from BIOS...\n");
10646 board_config
= ALC262_AUTO
;
10649 if (board_config
== ALC262_AUTO
) {
10650 /* automatic parse from the BIOS config */
10651 err
= alc262_parse_auto_config(codec
);
10657 "hda_codec: Cannot set up configuration "
10658 "from BIOS. Using base mode...\n");
10659 board_config
= ALC262_BASIC
;
10663 if (board_config
!= ALC262_AUTO
)
10664 setup_preset(spec
, &alc262_presets
[board_config
]);
10666 spec
->stream_name_analog
= "ALC262 Analog";
10667 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
10668 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
10670 spec
->stream_name_digital
= "ALC262 Digital";
10671 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
10672 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
10674 if (!spec
->adc_nids
&& spec
->input_mux
) {
10675 /* check whether NID 0x07 is valid */
10676 unsigned int wcap
= get_wcaps(codec
, 0x07);
10679 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
10680 if (wcap
!= AC_WID_AUD_IN
) {
10681 spec
->adc_nids
= alc262_adc_nids_alt
;
10682 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids_alt
);
10683 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
10684 spec
->mixers
[spec
->num_mixers
] =
10685 alc262_capture_alt_mixer
;
10686 spec
->num_mixers
++;
10688 spec
->adc_nids
= alc262_adc_nids
;
10689 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids
);
10690 spec
->capsrc_nids
= alc262_capsrc_nids
;
10691 spec
->mixers
[spec
->num_mixers
] = alc262_capture_mixer
;
10692 spec
->num_mixers
++;
10696 spec
->vmaster_nid
= 0x0c;
10698 codec
->patch_ops
= alc_patch_ops
;
10699 if (board_config
== ALC262_AUTO
)
10700 spec
->init_hook
= alc262_auto_init
;
10701 #ifdef CONFIG_SND_HDA_POWER_SAVE
10702 if (!spec
->loopback
.amplist
)
10703 spec
->loopback
.amplist
= alc262_loopbacks
;
10710 * ALC268 channel source setting (2 channel)
10712 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10713 #define alc268_modes alc260_modes
10715 static hda_nid_t alc268_dac_nids
[2] = {
10720 static hda_nid_t alc268_adc_nids
[2] = {
10725 static hda_nid_t alc268_adc_nids_alt
[1] = {
10730 static hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
10732 static struct snd_kcontrol_new alc268_base_mixer
[] = {
10733 /* output mixer control */
10734 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
10735 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10736 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
10737 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10738 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10739 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10740 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
10744 /* bind Beep switches of both NID 0x0f and 0x10 */
10745 static struct hda_bind_ctls alc268_bind_beep_sw
= {
10746 .ops
= &snd_hda_bind_sw
,
10748 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
10749 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
10754 static struct snd_kcontrol_new alc268_beep_mixer
[] = {
10755 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
10756 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
10760 static struct hda_verb alc268_eapd_verbs
[] = {
10761 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10762 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10766 /* Toshiba specific */
10767 #define alc268_toshiba_automute alc262_hippo_automute
10769 static struct hda_verb alc268_toshiba_verbs
[] = {
10770 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10774 static struct hda_input_mux alc268_acer_lc_capture_source
= {
10782 /* Acer specific */
10783 /* bind volumes of both NID 0x02 and 0x03 */
10784 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
10785 .ops
= &snd_hda_bind_vol
,
10787 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
10788 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
10793 /* mute/unmute internal speaker according to the hp jack and mute state */
10794 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
10796 struct alc_spec
*spec
= codec
->spec
;
10799 if (force
|| !spec
->sense_updated
) {
10800 unsigned int present
;
10801 present
= snd_hda_codec_read(codec
, 0x14, 0,
10802 AC_VERB_GET_PIN_SENSE
, 0);
10803 spec
->jack_present
= (present
& 0x80000000) != 0;
10804 spec
->sense_updated
= 1;
10806 if (spec
->jack_present
)
10807 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
10808 else /* unmute internal speaker if necessary */
10809 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
10810 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
10811 HDA_AMP_MUTE
, mute
);
10815 /* bind hp and internal speaker mute (with plug check) */
10816 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
10817 struct snd_ctl_elem_value
*ucontrol
)
10819 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10820 long *valp
= ucontrol
->value
.integer
.value
;
10823 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
10825 valp
[0] ? 0 : HDA_AMP_MUTE
);
10826 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
10828 valp
[1] ? 0 : HDA_AMP_MUTE
);
10830 alc268_acer_automute(codec
, 0);
10834 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer
[] = {
10835 /* output mixer control */
10836 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
10838 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10839 .name
= "Master Playback Switch",
10840 .info
= snd_hda_mixer_amp_switch_info
,
10841 .get
= snd_hda_mixer_amp_switch_get
,
10842 .put
= alc268_acer_master_sw_put
,
10843 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
10845 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT
),
10849 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
10850 /* output mixer control */
10851 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
10853 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10854 .name
= "Master Playback Switch",
10855 .info
= snd_hda_mixer_amp_switch_info
,
10856 .get
= snd_hda_mixer_amp_switch_get
,
10857 .put
= alc268_acer_master_sw_put
,
10858 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
10860 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10861 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
10862 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
10866 static struct hda_verb alc268_acer_aspire_one_verbs
[] = {
10867 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10868 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10869 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10870 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
10871 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x06},
10872 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, 0xa017},
10876 static struct hda_verb alc268_acer_verbs
[] = {
10877 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
10878 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10879 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10880 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10881 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10882 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10883 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10887 /* unsolicited event for HP jack sensing */
10888 static void alc268_toshiba_unsol_event(struct hda_codec
*codec
,
10891 if ((res
>> 26) != ALC880_HP_EVENT
)
10893 alc268_toshiba_automute(codec
);
10896 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
10899 if ((res
>> 26) != ALC880_HP_EVENT
)
10901 alc268_acer_automute(codec
, 1);
10904 static void alc268_acer_init_hook(struct hda_codec
*codec
)
10906 alc268_acer_automute(codec
, 1);
10909 /* toggle speaker-output according to the hp-jack state */
10910 static void alc268_aspire_one_speaker_automute(struct hda_codec
*codec
)
10912 unsigned int present
;
10913 unsigned char bits
;
10915 present
= snd_hda_codec_read(codec
, 0x15, 0,
10916 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
10917 bits
= present
? AMP_IN_MUTE(0) : 0;
10918 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 0,
10919 AMP_IN_MUTE(0), bits
);
10920 snd_hda_codec_amp_stereo(codec
, 0x0f, HDA_INPUT
, 1,
10921 AMP_IN_MUTE(0), bits
);
10925 static void alc268_acer_mic_automute(struct hda_codec
*codec
)
10927 unsigned int present
;
10929 present
= snd_hda_codec_read(codec
, 0x18, 0,
10930 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
10931 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_CONNECT_SEL
,
10932 present
? 0x0 : 0x6);
10935 static void alc268_acer_lc_unsol_event(struct hda_codec
*codec
,
10938 if ((res
>> 26) == ALC880_HP_EVENT
)
10939 alc268_aspire_one_speaker_automute(codec
);
10940 if ((res
>> 26) == ALC880_MIC_EVENT
)
10941 alc268_acer_mic_automute(codec
);
10944 static void alc268_acer_lc_init_hook(struct hda_codec
*codec
)
10946 alc268_aspire_one_speaker_automute(codec
);
10947 alc268_acer_mic_automute(codec
);
10950 static struct snd_kcontrol_new alc268_dell_mixer
[] = {
10951 /* output mixer control */
10952 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10953 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10954 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10955 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10956 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10957 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
10961 static struct hda_verb alc268_dell_verbs
[] = {
10962 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10964 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10968 /* mute/unmute internal speaker according to the hp jack and mute state */
10969 static void alc268_dell_automute(struct hda_codec
*codec
)
10971 unsigned int present
;
10974 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0);
10975 if (present
& 0x80000000)
10976 mute
= HDA_AMP_MUTE
;
10978 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
10979 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10980 HDA_AMP_MUTE
, mute
);
10983 static void alc268_dell_unsol_event(struct hda_codec
*codec
,
10986 if ((res
>> 26) != ALC880_HP_EVENT
)
10988 alc268_dell_automute(codec
);
10991 #define alc268_dell_init_hook alc268_dell_automute
10993 static struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
10994 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
10995 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10996 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
10997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10998 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10999 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
11000 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
11001 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
11005 static struct hda_verb alc267_quanta_il1_verbs
[] = {
11006 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11007 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
11011 static void alc267_quanta_il1_hp_automute(struct hda_codec
*codec
)
11013 unsigned int present
;
11015 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0)
11016 & AC_PINSENSE_PRESENCE
;
11017 snd_hda_codec_write(codec
, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
11018 present
? 0 : PIN_OUT
);
11021 static void alc267_quanta_il1_mic_automute(struct hda_codec
*codec
)
11023 unsigned int present
;
11025 present
= snd_hda_codec_read(codec
, 0x18, 0,
11026 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11027 snd_hda_codec_write(codec
, 0x23, 0,
11028 AC_VERB_SET_CONNECT_SEL
,
11029 present
? 0x00 : 0x01);
11032 static void alc267_quanta_il1_automute(struct hda_codec
*codec
)
11034 alc267_quanta_il1_hp_automute(codec
);
11035 alc267_quanta_il1_mic_automute(codec
);
11038 static void alc267_quanta_il1_unsol_event(struct hda_codec
*codec
,
11041 switch (res
>> 26) {
11042 case ALC880_HP_EVENT
:
11043 alc267_quanta_il1_hp_automute(codec
);
11045 case ALC880_MIC_EVENT
:
11046 alc267_quanta_il1_mic_automute(codec
);
11052 * generic initialization of ADC, input mixers and output mixers
11054 static struct hda_verb alc268_base_init_verbs
[] = {
11055 /* Unmute DAC0-1 and set vol = 0 */
11056 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11057 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11058 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11059 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11060 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11061 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11064 * Set up output mixers (0x0c - 0x0e)
11066 /* set vol=0 to output mixers */
11067 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11068 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11069 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11070 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
11072 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11073 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11075 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11076 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
11077 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
11078 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11079 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11080 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11081 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11082 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11084 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11085 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11086 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11087 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11088 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11089 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11090 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11092 /* set PCBEEP vol = 0, mute connections */
11093 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11094 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11095 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11097 /* Unmute Selector 23h,24h and set the default input to mic-in */
11099 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
11100 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11101 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
11102 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11108 * generic initialization of ADC, input mixers and output mixers
11110 static struct hda_verb alc268_volume_init_verbs
[] = {
11111 /* set output DAC */
11112 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11113 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11114 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11115 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11117 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11118 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
11119 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11120 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11121 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
11123 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11124 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11125 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11126 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11127 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11129 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11130 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11131 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11132 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11134 /* set PCBEEP vol = 0, mute connections */
11135 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11136 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11137 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11142 #define alc268_mux_enum_info alc_mux_enum_info
11143 #define alc268_mux_enum_get alc_mux_enum_get
11144 #define alc268_mux_enum_put alc_mux_enum_put
11146 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
11147 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
11148 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
11150 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11151 /* The multiple "Capture Source" controls confuse alsamixer
11152 * So call somewhat different..
11154 /* .name = "Capture Source", */
11155 .name
= "Input Source",
11157 .info
= alc268_mux_enum_info
,
11158 .get
= alc268_mux_enum_get
,
11159 .put
= alc268_mux_enum_put
,
11164 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
11165 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
11166 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
11167 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
11168 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
11170 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11171 /* The multiple "Capture Source" controls confuse alsamixer
11172 * So call somewhat different..
11174 /* .name = "Capture Source", */
11175 .name
= "Input Source",
11177 .info
= alc268_mux_enum_info
,
11178 .get
= alc268_mux_enum_get
,
11179 .put
= alc268_mux_enum_put
,
11184 static struct hda_input_mux alc268_capture_source
= {
11188 { "Front Mic", 0x1 },
11194 static struct hda_input_mux alc268_acer_capture_source
= {
11198 { "Internal Mic", 0x6 },
11203 #ifdef CONFIG_SND_DEBUG
11204 static struct snd_kcontrol_new alc268_test_mixer
[] = {
11205 /* Volume widgets */
11206 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11207 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
11208 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
11209 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
11210 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
11211 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
11212 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
11213 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
11214 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
11215 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
11216 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
11217 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
11218 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
11219 /* The below appears problematic on some hardwares */
11220 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11221 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
11222 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
11223 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
11224 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
11226 /* Modes for retasking pin widgets */
11227 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
11228 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
11229 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
11230 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
11232 /* Controls for GPIO pins, assuming they are configured as outputs */
11233 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11234 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11235 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11236 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11238 /* Switches to allow the digital SPDIF output pin to be enabled.
11239 * The ALC268 does not have an SPDIF input.
11241 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11243 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11244 * this output to turn on an external amplifier.
11246 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11247 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11253 /* create input playback/capture controls for the given pin */
11254 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
11255 const char *ctlname
, int idx
)
11260 sprintf(name
, "%s Playback Volume", ctlname
);
11262 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
11263 HDA_COMPOSE_AMP_VAL(0x02, 3, idx
,
11267 } else if (nid
== 0x15) {
11268 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
11269 HDA_COMPOSE_AMP_VAL(0x03, 3, idx
,
11275 sprintf(name
, "%s Playback Switch", ctlname
);
11276 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
11277 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
11283 /* add playback controls from the parsed DAC table */
11284 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
11285 const struct auto_pin_cfg
*cfg
)
11290 spec
->multiout
.num_dacs
= 2; /* only use one dac */
11291 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
11292 spec
->multiout
.dac_nids
[0] = 2;
11293 spec
->multiout
.dac_nids
[1] = 3;
11295 nid
= cfg
->line_out_pins
[0];
11297 alc268_new_analog_output(spec
, nid
, "Front", 0);
11299 nid
= cfg
->speaker_pins
[0];
11301 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11302 "Speaker Playback Volume",
11303 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
11307 nid
= cfg
->hp_pins
[0];
11309 alc268_new_analog_output(spec
, nid
, "Headphone", 0);
11311 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
11313 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11314 "Mono Playback Switch",
11315 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_INPUT
));
11322 /* create playback/capture controls for input pins */
11323 static int alc268_auto_create_analog_input_ctls(struct alc_spec
*spec
,
11324 const struct auto_pin_cfg
*cfg
)
11326 struct hda_input_mux
*imux
= &spec
->private_imux
;
11329 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
11330 switch(cfg
->input_pins
[i
]) {
11332 idx1
= 0; /* Mic 1 */
11335 idx1
= 1; /* Mic 2 */
11338 idx1
= 2; /* Line In */
11345 idx1
= 6; /* digital mics */
11350 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
11351 imux
->items
[imux
->num_items
].index
= idx1
;
11357 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
11359 struct alc_spec
*spec
= codec
->spec
;
11360 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
11361 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
11362 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
11363 unsigned int dac_vol1
, dac_vol2
;
11366 snd_hda_codec_write(codec
, speaker_nid
, 0,
11367 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
11368 snd_hda_codec_write(codec
, 0x0f, 0,
11369 AC_VERB_SET_AMP_GAIN_MUTE
,
11371 snd_hda_codec_write(codec
, 0x10, 0,
11372 AC_VERB_SET_AMP_GAIN_MUTE
,
11375 snd_hda_codec_write(codec
, 0x0f, 0,
11376 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
11377 snd_hda_codec_write(codec
, 0x10, 0,
11378 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
11381 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
11382 if (line_nid
== 0x14)
11383 dac_vol2
= AMP_OUT_ZERO
;
11384 else if (line_nid
== 0x15)
11385 dac_vol1
= AMP_OUT_ZERO
;
11386 if (hp_nid
== 0x14)
11387 dac_vol2
= AMP_OUT_ZERO
;
11388 else if (hp_nid
== 0x15)
11389 dac_vol1
= AMP_OUT_ZERO
;
11390 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
11391 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
11392 spec
->autocfg
.line_out_pins
[2] != 0x16)
11393 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
11395 snd_hda_codec_write(codec
, 0x02, 0,
11396 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
11397 snd_hda_codec_write(codec
, 0x03, 0,
11398 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
11401 /* pcm configuration: identiacal with ALC880 */
11402 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11403 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11404 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11405 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11408 * BIOS auto configuration
11410 static int alc268_parse_auto_config(struct hda_codec
*codec
)
11412 struct alc_spec
*spec
= codec
->spec
;
11414 static hda_nid_t alc268_ignore
[] = { 0 };
11416 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
11420 if (!spec
->autocfg
.line_outs
)
11421 return 0; /* can't find valid BIOS pin config */
11423 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
11426 err
= alc268_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
11430 spec
->multiout
.max_channels
= 2;
11432 /* digital only support output */
11433 if (spec
->autocfg
.dig_out_pin
)
11434 spec
->multiout
.dig_out_nid
= ALC268_DIGOUT_NID
;
11436 if (spec
->kctl_alloc
)
11437 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
11439 if (spec
->autocfg
.speaker_pins
[0] != 0x1d)
11440 spec
->mixers
[spec
->num_mixers
++] = alc268_beep_mixer
;
11442 spec
->init_verbs
[spec
->num_init_verbs
++] = alc268_volume_init_verbs
;
11443 spec
->num_mux_defs
= 1;
11444 spec
->input_mux
= &spec
->private_imux
;
11446 err
= alc_auto_add_mic_boost(codec
);
11453 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
11454 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
11455 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
11457 /* init callback for auto-configuration model -- overriding the default init */
11458 static void alc268_auto_init(struct hda_codec
*codec
)
11460 struct alc_spec
*spec
= codec
->spec
;
11461 alc268_auto_init_multi_out(codec
);
11462 alc268_auto_init_hp_out(codec
);
11463 alc268_auto_init_mono_speaker_out(codec
);
11464 alc268_auto_init_analog_input(codec
);
11465 if (spec
->unsol_event
)
11466 alc_inithook(codec
);
11470 * configuration and preset
11472 static const char *alc268_models
[ALC268_MODEL_LAST
] = {
11473 [ALC267_QUANTA_IL1
] = "quanta-il1",
11474 [ALC268_3ST
] = "3stack",
11475 [ALC268_TOSHIBA
] = "toshiba",
11476 [ALC268_ACER
] = "acer",
11477 [ALC268_ACER_ASPIRE_ONE
] = "acer-aspire",
11478 [ALC268_DELL
] = "dell",
11479 [ALC268_ZEPTO
] = "zepto",
11480 #ifdef CONFIG_SND_DEBUG
11481 [ALC268_TEST
] = "test",
11483 [ALC268_AUTO
] = "auto",
11486 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
11487 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
11488 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
11489 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
11490 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
11491 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
11492 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
11493 ALC268_ACER_ASPIRE_ONE
),
11494 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
11495 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA
),
11496 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
11497 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA
),
11498 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA
),
11499 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA
),
11500 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
11501 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
11502 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
11503 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
11507 static struct alc_config_preset alc268_presets
[] = {
11508 [ALC267_QUANTA_IL1
] = {
11509 .mixers
= { alc267_quanta_il1_mixer
},
11510 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11511 alc267_quanta_il1_verbs
},
11512 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11513 .dac_nids
= alc268_dac_nids
,
11514 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11515 .adc_nids
= alc268_adc_nids_alt
,
11517 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11518 .channel_mode
= alc268_modes
,
11519 .input_mux
= &alc268_capture_source
,
11520 .unsol_event
= alc267_quanta_il1_unsol_event
,
11521 .init_hook
= alc267_quanta_il1_automute
,
11524 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
11525 alc268_beep_mixer
},
11526 .init_verbs
= { alc268_base_init_verbs
},
11527 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11528 .dac_nids
= alc268_dac_nids
,
11529 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11530 .adc_nids
= alc268_adc_nids_alt
,
11531 .capsrc_nids
= alc268_capsrc_nids
,
11533 .dig_out_nid
= ALC268_DIGOUT_NID
,
11534 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11535 .channel_mode
= alc268_modes
,
11536 .input_mux
= &alc268_capture_source
,
11538 [ALC268_TOSHIBA
] = {
11539 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
11540 alc268_beep_mixer
},
11541 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11542 alc268_toshiba_verbs
},
11543 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11544 .dac_nids
= alc268_dac_nids
,
11545 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11546 .adc_nids
= alc268_adc_nids_alt
,
11547 .capsrc_nids
= alc268_capsrc_nids
,
11549 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11550 .channel_mode
= alc268_modes
,
11551 .input_mux
= &alc268_capture_source
,
11552 .unsol_event
= alc268_toshiba_unsol_event
,
11553 .init_hook
= alc268_toshiba_automute
,
11556 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
11557 alc268_beep_mixer
},
11558 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11559 alc268_acer_verbs
},
11560 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11561 .dac_nids
= alc268_dac_nids
,
11562 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11563 .adc_nids
= alc268_adc_nids_alt
,
11564 .capsrc_nids
= alc268_capsrc_nids
,
11566 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11567 .channel_mode
= alc268_modes
,
11568 .input_mux
= &alc268_acer_capture_source
,
11569 .unsol_event
= alc268_acer_unsol_event
,
11570 .init_hook
= alc268_acer_init_hook
,
11572 [ALC268_ACER_ASPIRE_ONE
] = {
11573 .mixers
= { alc268_acer_aspire_one_mixer
,
11574 alc268_capture_alt_mixer
},
11575 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11576 alc268_acer_aspire_one_verbs
},
11577 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11578 .dac_nids
= alc268_dac_nids
,
11579 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11580 .adc_nids
= alc268_adc_nids_alt
,
11581 .capsrc_nids
= alc268_capsrc_nids
,
11583 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11584 .channel_mode
= alc268_modes
,
11585 .input_mux
= &alc268_acer_lc_capture_source
,
11586 .unsol_event
= alc268_acer_lc_unsol_event
,
11587 .init_hook
= alc268_acer_lc_init_hook
,
11590 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
},
11591 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11592 alc268_dell_verbs
},
11593 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11594 .dac_nids
= alc268_dac_nids
,
11596 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11597 .channel_mode
= alc268_modes
,
11598 .unsol_event
= alc268_dell_unsol_event
,
11599 .init_hook
= alc268_dell_init_hook
,
11600 .input_mux
= &alc268_capture_source
,
11603 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
11604 alc268_beep_mixer
},
11605 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11606 alc268_toshiba_verbs
},
11607 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11608 .dac_nids
= alc268_dac_nids
,
11609 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11610 .adc_nids
= alc268_adc_nids_alt
,
11611 .capsrc_nids
= alc268_capsrc_nids
,
11613 .dig_out_nid
= ALC268_DIGOUT_NID
,
11614 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11615 .channel_mode
= alc268_modes
,
11616 .input_mux
= &alc268_capture_source
,
11617 .unsol_event
= alc268_toshiba_unsol_event
,
11618 .init_hook
= alc268_toshiba_automute
11620 #ifdef CONFIG_SND_DEBUG
11622 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
11623 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
11624 alc268_volume_init_verbs
},
11625 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
11626 .dac_nids
= alc268_dac_nids
,
11627 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
11628 .adc_nids
= alc268_adc_nids_alt
,
11629 .capsrc_nids
= alc268_capsrc_nids
,
11631 .dig_out_nid
= ALC268_DIGOUT_NID
,
11632 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
11633 .channel_mode
= alc268_modes
,
11634 .input_mux
= &alc268_capture_source
,
11639 static int patch_alc268(struct hda_codec
*codec
)
11641 struct alc_spec
*spec
;
11645 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
11649 codec
->spec
= spec
;
11651 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
11655 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
11656 printk(KERN_INFO
"hda_codec: Unknown model for ALC268, "
11657 "trying auto-probe from BIOS...\n");
11658 board_config
= ALC268_AUTO
;
11661 if (board_config
== ALC268_AUTO
) {
11662 /* automatic parse from the BIOS config */
11663 err
= alc268_parse_auto_config(codec
);
11669 "hda_codec: Cannot set up configuration "
11670 "from BIOS. Using base mode...\n");
11671 board_config
= ALC268_3ST
;
11675 if (board_config
!= ALC268_AUTO
)
11676 setup_preset(spec
, &alc268_presets
[board_config
]);
11678 if (codec
->vendor_id
== 0x10ec0267) {
11679 spec
->stream_name_analog
= "ALC267 Analog";
11680 spec
->stream_name_digital
= "ALC267 Digital";
11682 spec
->stream_name_analog
= "ALC268 Analog";
11683 spec
->stream_name_digital
= "ALC268 Digital";
11686 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
11687 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
11688 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
11690 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
11692 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
11693 /* override the amp caps for beep generator */
11694 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
11695 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
11696 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
11697 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
11698 (0 << AC_AMPCAP_MUTE_SHIFT
));
11700 if (!spec
->adc_nids
&& spec
->input_mux
) {
11701 /* check whether NID 0x07 is valid */
11702 unsigned int wcap
= get_wcaps(codec
, 0x07);
11706 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
11707 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
11708 spec
->adc_nids
= alc268_adc_nids_alt
;
11709 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
11710 spec
->mixers
[spec
->num_mixers
] =
11711 alc268_capture_alt_mixer
;
11712 spec
->num_mixers
++;
11714 spec
->adc_nids
= alc268_adc_nids
;
11715 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
11716 spec
->mixers
[spec
->num_mixers
] =
11717 alc268_capture_mixer
;
11718 spec
->num_mixers
++;
11720 spec
->capsrc_nids
= alc268_capsrc_nids
;
11721 /* set default input source */
11722 for (i
= 0; i
< spec
->num_adc_nids
; i
++)
11723 snd_hda_codec_write_cache(codec
, alc268_capsrc_nids
[i
],
11724 0, AC_VERB_SET_CONNECT_SEL
,
11725 spec
->input_mux
->items
[0].index
);
11728 spec
->vmaster_nid
= 0x02;
11730 codec
->patch_ops
= alc_patch_ops
;
11731 if (board_config
== ALC268_AUTO
)
11732 spec
->init_hook
= alc268_auto_init
;
11738 * ALC269 channel source setting (2 channel)
11740 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11742 #define alc269_dac_nids alc260_dac_nids
11744 static hda_nid_t alc269_adc_nids
[1] = {
11749 static hda_nid_t alc269_capsrc_nids
[1] = {
11753 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
11757 static struct hda_input_mux alc269_eeepc_dmic_capture_source
= {
11765 static struct hda_input_mux alc269_eeepc_amic_capture_source
= {
11773 #define alc269_modes alc260_modes
11774 #define alc269_capture_source alc880_lg_lw_capture_source
11776 static struct snd_kcontrol_new alc269_base_mixer
[] = {
11777 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11778 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11779 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11780 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11781 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11782 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11783 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT
),
11784 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT
),
11785 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11786 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11787 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11788 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
11789 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11790 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
11794 static struct snd_kcontrol_new alc269_quanta_fl1_mixer
[] = {
11795 /* output mixer control */
11796 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
11798 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11799 .name
= "Master Playback Switch",
11800 .info
= snd_hda_mixer_amp_switch_info
,
11801 .get
= snd_hda_mixer_amp_switch_get
,
11802 .put
= alc268_acer_master_sw_put
,
11803 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
11805 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11806 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11807 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11808 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11809 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11810 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
11811 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11812 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11816 /* bind volumes of both NID 0x0c and 0x0d */
11817 static struct hda_bind_ctls alc269_epc_bind_vol
= {
11818 .ops
= &snd_hda_bind_vol
,
11820 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
11821 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
11826 static struct snd_kcontrol_new alc269_eeepc_mixer
[] = {
11827 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11828 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol
),
11829 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11833 /* capture mixer elements */
11834 static struct snd_kcontrol_new alc269_capture_mixer
[] = {
11835 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11836 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11838 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11839 /* The multiple "Capture Source" controls confuse alsamixer
11840 * So call somewhat different..
11842 /* .name = "Capture Source", */
11843 .name
= "Input Source",
11845 .info
= alc_mux_enum_info
,
11846 .get
= alc_mux_enum_get
,
11847 .put
= alc_mux_enum_put
,
11852 /* capture mixer elements */
11853 static struct snd_kcontrol_new alc269_epc_capture_mixer
[] = {
11854 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11855 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11860 static struct snd_kcontrol_new alc269_beep_mixer
[] = {
11861 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT
),
11862 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT
),
11866 static struct hda_verb alc269_quanta_fl1_verbs
[] = {
11867 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11868 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11869 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11870 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
11871 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11872 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11876 /* toggle speaker-output according to the hp-jack state */
11877 static void alc269_quanta_fl1_speaker_automute(struct hda_codec
*codec
)
11879 unsigned int present
;
11880 unsigned char bits
;
11882 present
= snd_hda_codec_read(codec
, 0x15, 0,
11883 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11884 bits
= present
? AMP_IN_MUTE(0) : 0;
11885 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
11886 AMP_IN_MUTE(0), bits
);
11887 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
11888 AMP_IN_MUTE(0), bits
);
11890 snd_hda_codec_write(codec
, 0x20, 0,
11891 AC_VERB_SET_COEF_INDEX
, 0x0c);
11892 snd_hda_codec_write(codec
, 0x20, 0,
11893 AC_VERB_SET_PROC_COEF
, 0x680);
11895 snd_hda_codec_write(codec
, 0x20, 0,
11896 AC_VERB_SET_COEF_INDEX
, 0x0c);
11897 snd_hda_codec_write(codec
, 0x20, 0,
11898 AC_VERB_SET_PROC_COEF
, 0x480);
11901 static void alc269_quanta_fl1_mic_automute(struct hda_codec
*codec
)
11903 unsigned int present
;
11905 present
= snd_hda_codec_read(codec
, 0x18, 0,
11906 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11907 snd_hda_codec_write(codec
, 0x23, 0,
11908 AC_VERB_SET_CONNECT_SEL
, present
? 0x0 : 0x1);
11911 static void alc269_quanta_fl1_unsol_event(struct hda_codec
*codec
,
11914 if ((res
>> 26) == ALC880_HP_EVENT
)
11915 alc269_quanta_fl1_speaker_automute(codec
);
11916 if ((res
>> 26) == ALC880_MIC_EVENT
)
11917 alc269_quanta_fl1_mic_automute(codec
);
11920 static void alc269_quanta_fl1_init_hook(struct hda_codec
*codec
)
11922 alc269_quanta_fl1_speaker_automute(codec
);
11923 alc269_quanta_fl1_mic_automute(codec
);
11926 static struct hda_verb alc269_eeepc_dmic_init_verbs
[] = {
11927 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11928 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x05},
11929 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
11930 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
11931 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11932 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11933 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11937 static struct hda_verb alc269_eeepc_amic_init_verbs
[] = {
11938 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11939 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
11940 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
11941 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x701b | (0x00 << 8))},
11942 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11943 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11947 /* toggle speaker-output according to the hp-jack state */
11948 static void alc269_speaker_automute(struct hda_codec
*codec
)
11950 unsigned int present
;
11951 unsigned char bits
;
11953 present
= snd_hda_codec_read(codec
, 0x15, 0,
11954 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11955 bits
= present
? AMP_IN_MUTE(0) : 0;
11956 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
11957 AMP_IN_MUTE(0), bits
);
11958 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
11959 AMP_IN_MUTE(0), bits
);
11962 static void alc269_eeepc_dmic_automute(struct hda_codec
*codec
)
11964 unsigned int present
;
11966 present
= snd_hda_codec_read(codec
, 0x18, 0,
11967 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11968 snd_hda_codec_write(codec
, 0x23, 0,
11969 AC_VERB_SET_CONNECT_SEL
, (present
? 0 : 5));
11972 static void alc269_eeepc_amic_automute(struct hda_codec
*codec
)
11974 unsigned int present
;
11976 present
= snd_hda_codec_read(codec
, 0x18, 0,
11977 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11978 snd_hda_codec_write(codec
, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
11979 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
11980 snd_hda_codec_write(codec
, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
11981 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
11984 /* unsolicited event for HP jack sensing */
11985 static void alc269_eeepc_dmic_unsol_event(struct hda_codec
*codec
,
11988 if ((res
>> 26) == ALC880_HP_EVENT
)
11989 alc269_speaker_automute(codec
);
11991 if ((res
>> 26) == ALC880_MIC_EVENT
)
11992 alc269_eeepc_dmic_automute(codec
);
11995 static void alc269_eeepc_dmic_inithook(struct hda_codec
*codec
)
11997 alc269_speaker_automute(codec
);
11998 alc269_eeepc_dmic_automute(codec
);
12001 /* unsolicited event for HP jack sensing */
12002 static void alc269_eeepc_amic_unsol_event(struct hda_codec
*codec
,
12005 if ((res
>> 26) == ALC880_HP_EVENT
)
12006 alc269_speaker_automute(codec
);
12008 if ((res
>> 26) == ALC880_MIC_EVENT
)
12009 alc269_eeepc_amic_automute(codec
);
12012 static void alc269_eeepc_amic_inithook(struct hda_codec
*codec
)
12014 alc269_speaker_automute(codec
);
12015 alc269_eeepc_amic_automute(codec
);
12019 * generic initialization of ADC, input mixers and output mixers
12021 static struct hda_verb alc269_init_verbs
[] = {
12023 * Unmute ADC0 and set the default input to mic-in
12025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12027 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12028 * analog-loopback mixer widget
12029 * Note: PASD motherboards uses the Line In 2 as the input for
12030 * front panel mic (mic 2)
12032 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12033 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12034 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12036 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12040 * Set up output mixers (0x0c - 0x0e)
12042 /* set vol=0 to output mixers */
12043 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12044 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12046 /* set up input amps for analog loopback */
12047 /* Amp Indices: DAC = 0, mixer = 1 */
12048 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12049 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12050 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12051 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12052 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12053 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12055 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12056 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12057 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12058 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12059 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12060 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12061 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12063 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12064 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12065 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12066 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12067 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12068 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12069 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12071 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
12072 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
12074 /* FIXME: use matrix-type input source selection */
12075 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12076 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12077 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12078 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12079 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12080 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12083 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
12084 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
12088 /* add playback controls from the parsed DAC table */
12089 static int alc269_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12090 const struct auto_pin_cfg
*cfg
)
12095 spec
->multiout
.num_dacs
= 1; /* only use one dac */
12096 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
12097 spec
->multiout
.dac_nids
[0] = 2;
12099 nid
= cfg
->line_out_pins
[0];
12101 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12102 "Front Playback Volume",
12103 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
));
12106 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12107 "Front Playback Switch",
12108 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
12113 nid
= cfg
->speaker_pins
[0];
12115 if (!cfg
->line_out_pins
[0]) {
12116 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12117 "Speaker Playback Volume",
12118 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12124 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12125 "Speaker Playback Switch",
12126 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
12131 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12132 "Speaker Playback Switch",
12133 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
12139 nid
= cfg
->hp_pins
[0];
12141 /* spec->multiout.hp_nid = 2; */
12142 if (!cfg
->line_out_pins
[0] && !cfg
->speaker_pins
[0]) {
12143 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12144 "Headphone Playback Volume",
12145 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12151 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12152 "Headphone Playback Switch",
12153 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
12158 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12159 "Headphone Playback Switch",
12160 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
12169 #define alc269_auto_create_analog_input_ctls \
12170 alc880_auto_create_analog_input_ctls
12172 #ifdef CONFIG_SND_HDA_POWER_SAVE
12173 #define alc269_loopbacks alc880_loopbacks
12176 /* pcm configuration: identiacal with ALC880 */
12177 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12178 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12179 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12180 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12183 * BIOS auto configuration
12185 static int alc269_parse_auto_config(struct hda_codec
*codec
)
12187 struct alc_spec
*spec
= codec
->spec
;
12189 static hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
12191 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12196 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12199 err
= alc269_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
12203 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12205 if (spec
->autocfg
.dig_out_pin
)
12206 spec
->multiout
.dig_out_nid
= ALC269_DIGOUT_NID
;
12208 if (spec
->kctl_alloc
)
12209 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
12211 /* create a beep mixer control if the pin 0x1d isn't assigned */
12212 for (i
= 0; i
< ARRAY_SIZE(spec
->autocfg
.input_pins
); i
++)
12213 if (spec
->autocfg
.input_pins
[i
] == 0x1d)
12215 if (i
>= ARRAY_SIZE(spec
->autocfg
.input_pins
))
12216 spec
->mixers
[spec
->num_mixers
++] = alc269_beep_mixer
;
12218 spec
->init_verbs
[spec
->num_init_verbs
++] = alc269_init_verbs
;
12219 spec
->num_mux_defs
= 1;
12220 spec
->input_mux
= &spec
->private_imux
;
12221 /* set default input source */
12222 snd_hda_codec_write_cache(codec
, alc269_capsrc_nids
[0],
12223 0, AC_VERB_SET_CONNECT_SEL
,
12224 spec
->input_mux
->items
[0].index
);
12226 err
= alc_auto_add_mic_boost(codec
);
12230 spec
->mixers
[spec
->num_mixers
] = alc269_capture_mixer
;
12231 spec
->num_mixers
++;
12236 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12237 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12238 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12241 /* init callback for auto-configuration model -- overriding the default init */
12242 static void alc269_auto_init(struct hda_codec
*codec
)
12244 struct alc_spec
*spec
= codec
->spec
;
12245 alc269_auto_init_multi_out(codec
);
12246 alc269_auto_init_hp_out(codec
);
12247 alc269_auto_init_analog_input(codec
);
12248 if (spec
->unsol_event
)
12249 alc_inithook(codec
);
12253 * configuration and preset
12255 static const char *alc269_models
[ALC269_MODEL_LAST
] = {
12256 [ALC269_BASIC
] = "basic",
12257 [ALC269_QUANTA_FL1
] = "quanta",
12258 [ALC269_ASUS_EEEPC_P703
] = "eeepc-p703",
12259 [ALC269_ASUS_EEEPC_P901
] = "eeepc-p901"
12262 static struct snd_pci_quirk alc269_cfg_tbl
[] = {
12263 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1
),
12264 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12265 ALC269_ASUS_EEEPC_P703
),
12266 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12267 ALC269_ASUS_EEEPC_P901
),
12268 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12269 ALC269_ASUS_EEEPC_P901
),
12273 static struct alc_config_preset alc269_presets
[] = {
12275 .mixers
= { alc269_base_mixer
, alc269_capture_mixer
},
12276 .init_verbs
= { alc269_init_verbs
},
12277 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
12278 .dac_nids
= alc269_dac_nids
,
12280 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
12281 .channel_mode
= alc269_modes
,
12282 .input_mux
= &alc269_capture_source
,
12284 [ALC269_QUANTA_FL1
] = {
12285 .mixers
= { alc269_quanta_fl1_mixer
},
12286 .init_verbs
= { alc269_init_verbs
, alc269_quanta_fl1_verbs
},
12287 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
12288 .dac_nids
= alc269_dac_nids
,
12290 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
12291 .channel_mode
= alc269_modes
,
12292 .input_mux
= &alc269_capture_source
,
12293 .unsol_event
= alc269_quanta_fl1_unsol_event
,
12294 .init_hook
= alc269_quanta_fl1_init_hook
,
12296 [ALC269_ASUS_EEEPC_P703
] = {
12297 .mixers
= { alc269_eeepc_mixer
, alc269_epc_capture_mixer
},
12298 .init_verbs
= { alc269_init_verbs
,
12299 alc269_eeepc_amic_init_verbs
},
12300 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
12301 .dac_nids
= alc269_dac_nids
,
12303 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
12304 .channel_mode
= alc269_modes
,
12305 .input_mux
= &alc269_eeepc_amic_capture_source
,
12306 .unsol_event
= alc269_eeepc_amic_unsol_event
,
12307 .init_hook
= alc269_eeepc_amic_inithook
,
12309 [ALC269_ASUS_EEEPC_P901
] = {
12310 .mixers
= { alc269_eeepc_mixer
, alc269_epc_capture_mixer
},
12311 .init_verbs
= { alc269_init_verbs
,
12312 alc269_eeepc_dmic_init_verbs
},
12313 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
12314 .dac_nids
= alc269_dac_nids
,
12316 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
12317 .channel_mode
= alc269_modes
,
12318 .input_mux
= &alc269_eeepc_dmic_capture_source
,
12319 .unsol_event
= alc269_eeepc_dmic_unsol_event
,
12320 .init_hook
= alc269_eeepc_dmic_inithook
,
12324 static int patch_alc269(struct hda_codec
*codec
)
12326 struct alc_spec
*spec
;
12330 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
12334 codec
->spec
= spec
;
12336 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
12338 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
12342 if (board_config
< 0) {
12343 printk(KERN_INFO
"hda_codec: Unknown model for ALC269, "
12344 "trying auto-probe from BIOS...\n");
12345 board_config
= ALC269_AUTO
;
12348 if (board_config
== ALC269_AUTO
) {
12349 /* automatic parse from the BIOS config */
12350 err
= alc269_parse_auto_config(codec
);
12356 "hda_codec: Cannot set up configuration "
12357 "from BIOS. Using base mode...\n");
12358 board_config
= ALC269_BASIC
;
12362 if (board_config
!= ALC269_AUTO
)
12363 setup_preset(spec
, &alc269_presets
[board_config
]);
12365 spec
->stream_name_analog
= "ALC269 Analog";
12366 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
12367 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
12369 spec
->stream_name_digital
= "ALC269 Digital";
12370 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
12371 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
12373 spec
->adc_nids
= alc269_adc_nids
;
12374 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
12375 spec
->capsrc_nids
= alc269_capsrc_nids
;
12377 codec
->patch_ops
= alc_patch_ops
;
12378 if (board_config
== ALC269_AUTO
)
12379 spec
->init_hook
= alc269_auto_init
;
12380 #ifdef CONFIG_SND_HDA_POWER_SAVE
12381 if (!spec
->loopback
.amplist
)
12382 spec
->loopback
.amplist
= alc269_loopbacks
;
12389 * ALC861 channel source setting (2/6 channel selection for 3-stack)
12393 * set the path ways for 2 channel output
12394 * need to set the codec line out and mic 1 pin widgets to inputs
12396 static struct hda_verb alc861_threestack_ch2_init
[] = {
12397 /* set pin widget 1Ah (line in) for input */
12398 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12399 /* set pin widget 18h (mic1/2) for input, for mic also enable
12402 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12404 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
12406 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
12407 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
12413 * need to set the codec line out and mic 1 pin widgets to outputs
12415 static struct hda_verb alc861_threestack_ch6_init
[] = {
12416 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12417 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12418 /* set pin widget 18h (mic1) for output (CLFE)*/
12419 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12421 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12422 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12424 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
12426 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
12427 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
12432 static struct hda_channel_mode alc861_threestack_modes
[2] = {
12433 { 2, alc861_threestack_ch2_init
},
12434 { 6, alc861_threestack_ch6_init
},
12436 /* Set mic1 as input and unmute the mixer */
12437 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
12438 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12439 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
12442 /* Set mic1 as output and mute mixer */
12443 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
12444 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12445 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
12449 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
12450 { 2, alc861_uniwill_m31_ch2_init
},
12451 { 4, alc861_uniwill_m31_ch4_init
},
12454 /* Set mic1 and line-in as input and unmute the mixer */
12455 static struct hda_verb alc861_asus_ch2_init
[] = {
12456 /* set pin widget 1Ah (line in) for input */
12457 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12458 /* set pin widget 18h (mic1/2) for input, for mic also enable
12461 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12463 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
12465 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
12466 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
12470 /* Set mic1 nad line-in as output and mute mixer */
12471 static struct hda_verb alc861_asus_ch6_init
[] = {
12472 /* set pin widget 1Ah (line in) for output (Back Surround)*/
12473 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12474 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12475 /* set pin widget 18h (mic1) for output (CLFE)*/
12476 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12477 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
12478 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12479 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12481 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
12483 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
12484 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
12489 static struct hda_channel_mode alc861_asus_modes
[2] = {
12490 { 2, alc861_asus_ch2_init
},
12491 { 6, alc861_asus_ch6_init
},
12496 static struct snd_kcontrol_new alc861_base_mixer
[] = {
12497 /* output mixer control */
12498 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
12499 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
12500 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
12501 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
12502 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
12504 /*Input mixer control */
12505 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12506 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12507 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
12508 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
12509 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
12510 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
12511 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
12512 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
12513 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
12514 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
12516 /* Capture mixer control */
12517 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
12518 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
12520 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12521 .name
= "Capture Source",
12523 .info
= alc_mux_enum_info
,
12524 .get
= alc_mux_enum_get
,
12525 .put
= alc_mux_enum_put
,
12530 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
12531 /* output mixer control */
12532 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
12533 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
12534 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
12535 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
12536 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12538 /* Input mixer control */
12539 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12540 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12541 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
12542 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
12543 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
12544 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
12545 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
12546 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
12547 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
12548 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
12550 /* Capture mixer control */
12551 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
12552 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
12554 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12555 .name
= "Capture Source",
12557 .info
= alc_mux_enum_info
,
12558 .get
= alc_mux_enum_get
,
12559 .put
= alc_mux_enum_put
,
12562 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12563 .name
= "Channel Mode",
12564 .info
= alc_ch_mode_info
,
12565 .get
= alc_ch_mode_get
,
12566 .put
= alc_ch_mode_put
,
12567 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
12572 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
12573 /* output mixer control */
12574 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
12575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
12576 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
12578 /*Capture mixer control */
12579 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
12580 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
12582 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12583 .name
= "Capture Source",
12585 .info
= alc_mux_enum_info
,
12586 .get
= alc_mux_enum_get
,
12587 .put
= alc_mux_enum_put
,
12593 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
12594 /* output mixer control */
12595 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
12596 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
12597 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
12598 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
12599 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
12601 /* Input mixer control */
12602 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
12603 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
12604 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
12605 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
12606 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
12607 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
12608 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
12609 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
12610 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
12611 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
12613 /* Capture mixer control */
12614 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
12615 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
12617 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12618 .name
= "Capture Source",
12620 .info
= alc_mux_enum_info
,
12621 .get
= alc_mux_enum_get
,
12622 .put
= alc_mux_enum_put
,
12625 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12626 .name
= "Channel Mode",
12627 .info
= alc_ch_mode_info
,
12628 .get
= alc_ch_mode_get
,
12629 .put
= alc_ch_mode_put
,
12630 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
12635 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
12636 /* output mixer control */
12637 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
12638 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
12639 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
12640 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
12641 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
12643 /* Input mixer control */
12644 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
12645 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
12646 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
12647 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
12648 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
12649 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
12650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
12651 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
12652 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
12653 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
12655 /* Capture mixer control */
12656 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
12657 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
12659 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12660 .name
= "Capture Source",
12662 .info
= alc_mux_enum_info
,
12663 .get
= alc_mux_enum_get
,
12664 .put
= alc_mux_enum_put
,
12667 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12668 .name
= "Channel Mode",
12669 .info
= alc_ch_mode_info
,
12670 .get
= alc_ch_mode_get
,
12671 .put
= alc_ch_mode_put
,
12672 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
12677 /* additional mixer */
12678 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
12679 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
12680 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
12681 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT
),
12682 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT
),
12687 * generic initialization of ADC, input mixers and output mixers
12689 static struct hda_verb alc861_base_init_verbs
[] = {
12691 * Unmute ADC0 and set the default input to mic-in
12693 /* port-A for surround (rear panel) */
12694 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12695 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12696 /* port-B for mic-in (rear panel) with vref */
12697 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12698 /* port-C for line-in (rear panel) */
12699 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12700 /* port-D for Front */
12701 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12702 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12703 /* port-E for HP out (front panel) */
12704 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
12705 /* route front PCM to HP */
12706 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12707 /* port-F for mic-in (front panel) with vref */
12708 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12709 /* port-G for CLFE (rear panel) */
12710 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12711 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12712 /* port-H for side (rear panel) */
12713 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12714 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12716 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12717 /* route front mic to ADC1*/
12718 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12719 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12721 /* Unmute DAC0~3 & spdif out*/
12722 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12723 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12724 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12725 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12726 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12728 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12729 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12730 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12731 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12732 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12734 /* Unmute Stereo Mixer 15 */
12735 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12736 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12737 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
12740 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12741 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12742 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12743 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12744 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12745 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12746 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12747 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12748 /* hp used DAC 3 (Front) */
12749 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12750 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12755 static struct hda_verb alc861_threestack_init_verbs
[] = {
12757 * Unmute ADC0 and set the default input to mic-in
12759 /* port-A for surround (rear panel) */
12760 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12761 /* port-B for mic-in (rear panel) with vref */
12762 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12763 /* port-C for line-in (rear panel) */
12764 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12765 /* port-D for Front */
12766 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12767 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12768 /* port-E for HP out (front panel) */
12769 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
12770 /* route front PCM to HP */
12771 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12772 /* port-F for mic-in (front panel) with vref */
12773 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12774 /* port-G for CLFE (rear panel) */
12775 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12776 /* port-H for side (rear panel) */
12777 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12779 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12780 /* route front mic to ADC1*/
12781 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12782 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12783 /* Unmute DAC0~3 & spdif out*/
12784 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12785 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12786 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12787 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12788 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12790 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12791 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12792 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12793 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12794 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12796 /* Unmute Stereo Mixer 15 */
12797 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12798 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12799 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
12802 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12803 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12804 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12805 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12806 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12807 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12808 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12809 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12810 /* hp used DAC 3 (Front) */
12811 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12812 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12816 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
12818 * Unmute ADC0 and set the default input to mic-in
12820 /* port-A for surround (rear panel) */
12821 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12822 /* port-B for mic-in (rear panel) with vref */
12823 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12824 /* port-C for line-in (rear panel) */
12825 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12826 /* port-D for Front */
12827 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12828 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12829 /* port-E for HP out (front panel) */
12830 /* this has to be set to VREF80 */
12831 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12832 /* route front PCM to HP */
12833 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12834 /* port-F for mic-in (front panel) with vref */
12835 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12836 /* port-G for CLFE (rear panel) */
12837 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12838 /* port-H for side (rear panel) */
12839 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12841 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12842 /* route front mic to ADC1*/
12843 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12844 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12845 /* Unmute DAC0~3 & spdif out*/
12846 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12847 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12848 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12849 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12850 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12852 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12853 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12854 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12855 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12856 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12858 /* Unmute Stereo Mixer 15 */
12859 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12860 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12861 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12862 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
12864 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12865 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12866 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12867 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12868 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12869 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12870 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12871 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12872 /* hp used DAC 3 (Front) */
12873 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12874 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12878 static struct hda_verb alc861_asus_init_verbs
[] = {
12880 * Unmute ADC0 and set the default input to mic-in
12882 /* port-A for surround (rear panel)
12883 * according to codec#0 this is the HP jack
12885 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
12886 /* route front PCM to HP */
12887 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
12888 /* port-B for mic-in (rear panel) with vref */
12889 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12890 /* port-C for line-in (rear panel) */
12891 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12892 /* port-D for Front */
12893 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12894 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12895 /* port-E for HP out (front panel) */
12896 /* this has to be set to VREF80 */
12897 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12898 /* route front PCM to HP */
12899 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12900 /* port-F for mic-in (front panel) with vref */
12901 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12902 /* port-G for CLFE (rear panel) */
12903 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12904 /* port-H for side (rear panel) */
12905 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12907 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12908 /* route front mic to ADC1*/
12909 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12910 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12911 /* Unmute DAC0~3 & spdif out*/
12912 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12913 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12914 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12915 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12917 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12918 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12919 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12920 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12921 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12923 /* Unmute Stereo Mixer 15 */
12924 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12925 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12926 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12927 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
12929 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12930 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12931 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12932 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12933 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12934 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12935 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12936 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12937 /* hp used DAC 3 (Front) */
12938 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12939 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12943 /* additional init verbs for ASUS laptops */
12944 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
12945 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
12946 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
12951 * generic initialization of ADC, input mixers and output mixers
12953 static struct hda_verb alc861_auto_init_verbs
[] = {
12955 * Unmute ADC0 and set the default input to mic-in
12957 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
12958 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12960 /* Unmute DAC0~3 & spdif out*/
12961 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12962 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12963 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12964 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12965 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12967 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12968 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12969 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12970 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12971 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12973 /* Unmute Stereo Mixer 15 */
12974 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12975 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12976 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12977 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
12979 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12980 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12981 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12982 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12983 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12984 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12985 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12986 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12988 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12989 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12990 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12991 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12992 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12993 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12994 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12995 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12997 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
13002 static struct hda_verb alc861_toshiba_init_verbs
[] = {
13003 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13008 /* toggle speaker-output according to the hp-jack state */
13009 static void alc861_toshiba_automute(struct hda_codec
*codec
)
13011 unsigned int present
;
13013 present
= snd_hda_codec_read(codec
, 0x0f, 0,
13014 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13015 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
13016 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
13017 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
13018 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
13021 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
13024 if ((res
>> 26) == ALC880_HP_EVENT
)
13025 alc861_toshiba_automute(codec
);
13028 /* pcm configuration: identiacal with ALC880 */
13029 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13030 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13031 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13032 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13035 #define ALC861_DIGOUT_NID 0x07
13037 static struct hda_channel_mode alc861_8ch_modes
[1] = {
13041 static hda_nid_t alc861_dac_nids
[4] = {
13042 /* front, surround, clfe, side */
13043 0x03, 0x06, 0x05, 0x04
13046 static hda_nid_t alc660_dac_nids
[3] = {
13047 /* front, clfe, surround */
13051 static hda_nid_t alc861_adc_nids
[1] = {
13056 static struct hda_input_mux alc861_capture_source
= {
13060 { "Front Mic", 0x3 },
13067 /* fill in the dac_nids table from the parsed pin configuration */
13068 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
,
13069 const struct auto_pin_cfg
*cfg
)
13074 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
13075 for (i
= 0; i
< cfg
->line_outs
; i
++) {
13076 nid
= cfg
->line_out_pins
[i
];
13078 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
13080 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
13083 spec
->multiout
.num_dacs
= cfg
->line_outs
;
13087 /* add playback controls from the parsed DAC table */
13088 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13089 const struct auto_pin_cfg
*cfg
)
13092 static const char *chname
[4] = {
13093 "Front", "Surround", NULL
/*CLFE*/, "Side"
13098 for (i
= 0; i
< cfg
->line_outs
; i
++) {
13099 nid
= spec
->multiout
.dac_nids
[i
];
13104 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
13105 "Center Playback Switch",
13106 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
13110 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
13111 "LFE Playback Switch",
13112 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
13117 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1;
13119 if (nid
== alc861_dac_nids
[idx
])
13121 sprintf(name
, "%s Playback Switch", chname
[idx
]);
13122 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
13123 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
13132 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
13140 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
13142 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
13143 "Headphone Playback Switch",
13144 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
13147 spec
->multiout
.hp_nid
= nid
;
13152 /* create playback/capture controls for input pins */
13153 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
,
13154 const struct auto_pin_cfg
*cfg
)
13156 struct hda_input_mux
*imux
= &spec
->private_imux
;
13157 int i
, err
, idx
, idx1
;
13159 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
13160 switch (cfg
->input_pins
[i
]) {
13163 idx
= 2; /* Line In */
13167 idx
= 2; /* Line In */
13171 idx
= 1; /* Mic In */
13175 idx
= 1; /* Mic In */
13185 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
13186 auto_pin_cfg_labels
[i
], idx
, 0x15);
13190 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
13191 imux
->items
[imux
->num_items
].index
= idx1
;
13197 static struct snd_kcontrol_new alc861_capture_mixer
[] = {
13198 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
13199 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
13202 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13203 /* The multiple "Capture Source" controls confuse alsamixer
13204 * So call somewhat different..
13206 /* .name = "Capture Source", */
13207 .name
= "Input Source",
13209 .info
= alc_mux_enum_info
,
13210 .get
= alc_mux_enum_get
,
13211 .put
= alc_mux_enum_put
,
13216 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
13218 int pin_type
, int dac_idx
)
13220 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
13222 snd_hda_codec_write(codec
, dac_idx
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13226 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
13228 struct alc_spec
*spec
= codec
->spec
;
13231 alc_subsystem_id(codec
, 0x0e, 0x0f, 0x0b);
13232 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
13233 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
13234 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
13236 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
13237 spec
->multiout
.dac_nids
[i
]);
13241 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
13243 struct alc_spec
*spec
= codec
->spec
;
13246 pin
= spec
->autocfg
.hp_pins
[0];
13247 if (pin
) /* connect to front */
13248 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
13249 spec
->multiout
.dac_nids
[0]);
13250 pin
= spec
->autocfg
.speaker_pins
[0];
13252 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
13255 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
13257 struct alc_spec
*spec
= codec
->spec
;
13260 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
13261 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
13262 if (nid
>= 0x0c && nid
<= 0x11) {
13263 snd_hda_codec_write(codec
, nid
, 0,
13264 AC_VERB_SET_PIN_WIDGET_CONTROL
,
13265 i
<= AUTO_PIN_FRONT_MIC
?
13266 PIN_VREF80
: PIN_IN
);
13271 /* parse the BIOS configuration and set up the alc_spec */
13272 /* return 1 if successful, 0 if the proper config is not found,
13273 * or a negative error code
13275 static int alc861_parse_auto_config(struct hda_codec
*codec
)
13277 struct alc_spec
*spec
= codec
->spec
;
13279 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
13281 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13285 if (!spec
->autocfg
.line_outs
)
13286 return 0; /* can't find valid BIOS pin config */
13288 err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
);
13291 err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13294 err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pins
[0]);
13297 err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
13301 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
13303 if (spec
->autocfg
.dig_out_pin
)
13304 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
13306 if (spec
->kctl_alloc
)
13307 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
13309 spec
->init_verbs
[spec
->num_init_verbs
++] = alc861_auto_init_verbs
;
13311 spec
->num_mux_defs
= 1;
13312 spec
->input_mux
= &spec
->private_imux
;
13314 spec
->adc_nids
= alc861_adc_nids
;
13315 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
13316 spec
->mixers
[spec
->num_mixers
] = alc861_capture_mixer
;
13317 spec
->num_mixers
++;
13322 /* additional initialization for auto-configuration model */
13323 static void alc861_auto_init(struct hda_codec
*codec
)
13325 struct alc_spec
*spec
= codec
->spec
;
13326 alc861_auto_init_multi_out(codec
);
13327 alc861_auto_init_hp_out(codec
);
13328 alc861_auto_init_analog_input(codec
);
13329 if (spec
->unsol_event
)
13330 alc_inithook(codec
);
13333 #ifdef CONFIG_SND_HDA_POWER_SAVE
13334 static struct hda_amp_list alc861_loopbacks
[] = {
13335 { 0x15, HDA_INPUT
, 0 },
13336 { 0x15, HDA_INPUT
, 1 },
13337 { 0x15, HDA_INPUT
, 2 },
13338 { 0x15, HDA_INPUT
, 3 },
13345 * configuration and preset
13347 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
13348 [ALC861_3ST
] = "3stack",
13349 [ALC660_3ST
] = "3stack-660",
13350 [ALC861_3ST_DIG
] = "3stack-dig",
13351 [ALC861_6ST_DIG
] = "6stack-dig",
13352 [ALC861_UNIWILL_M31
] = "uniwill-m31",
13353 [ALC861_TOSHIBA
] = "toshiba",
13354 [ALC861_ASUS
] = "asus",
13355 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
13356 [ALC861_AUTO
] = "auto",
13359 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
13360 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
13361 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
13362 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
13363 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
13364 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
13365 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
13366 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
13367 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
13368 * Any other models that need this preset?
13370 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
13371 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
13372 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
13373 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
13374 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
13375 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
13376 /* FIXME: the below seems conflict */
13377 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
13378 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
13379 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
13383 static struct alc_config_preset alc861_presets
[] = {
13385 .mixers
= { alc861_3ST_mixer
},
13386 .init_verbs
= { alc861_threestack_init_verbs
},
13387 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13388 .dac_nids
= alc861_dac_nids
,
13389 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
13390 .channel_mode
= alc861_threestack_modes
,
13392 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13393 .adc_nids
= alc861_adc_nids
,
13394 .input_mux
= &alc861_capture_source
,
13396 [ALC861_3ST_DIG
] = {
13397 .mixers
= { alc861_base_mixer
},
13398 .init_verbs
= { alc861_threestack_init_verbs
},
13399 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13400 .dac_nids
= alc861_dac_nids
,
13401 .dig_out_nid
= ALC861_DIGOUT_NID
,
13402 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
13403 .channel_mode
= alc861_threestack_modes
,
13405 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13406 .adc_nids
= alc861_adc_nids
,
13407 .input_mux
= &alc861_capture_source
,
13409 [ALC861_6ST_DIG
] = {
13410 .mixers
= { alc861_base_mixer
},
13411 .init_verbs
= { alc861_base_init_verbs
},
13412 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13413 .dac_nids
= alc861_dac_nids
,
13414 .dig_out_nid
= ALC861_DIGOUT_NID
,
13415 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
13416 .channel_mode
= alc861_8ch_modes
,
13417 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13418 .adc_nids
= alc861_adc_nids
,
13419 .input_mux
= &alc861_capture_source
,
13422 .mixers
= { alc861_3ST_mixer
},
13423 .init_verbs
= { alc861_threestack_init_verbs
},
13424 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
13425 .dac_nids
= alc660_dac_nids
,
13426 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
13427 .channel_mode
= alc861_threestack_modes
,
13429 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13430 .adc_nids
= alc861_adc_nids
,
13431 .input_mux
= &alc861_capture_source
,
13433 [ALC861_UNIWILL_M31
] = {
13434 .mixers
= { alc861_uniwill_m31_mixer
},
13435 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
13436 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13437 .dac_nids
= alc861_dac_nids
,
13438 .dig_out_nid
= ALC861_DIGOUT_NID
,
13439 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
13440 .channel_mode
= alc861_uniwill_m31_modes
,
13442 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13443 .adc_nids
= alc861_adc_nids
,
13444 .input_mux
= &alc861_capture_source
,
13446 [ALC861_TOSHIBA
] = {
13447 .mixers
= { alc861_toshiba_mixer
},
13448 .init_verbs
= { alc861_base_init_verbs
,
13449 alc861_toshiba_init_verbs
},
13450 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13451 .dac_nids
= alc861_dac_nids
,
13452 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
13453 .channel_mode
= alc883_3ST_2ch_modes
,
13454 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13455 .adc_nids
= alc861_adc_nids
,
13456 .input_mux
= &alc861_capture_source
,
13457 .unsol_event
= alc861_toshiba_unsol_event
,
13458 .init_hook
= alc861_toshiba_automute
,
13461 .mixers
= { alc861_asus_mixer
},
13462 .init_verbs
= { alc861_asus_init_verbs
},
13463 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13464 .dac_nids
= alc861_dac_nids
,
13465 .dig_out_nid
= ALC861_DIGOUT_NID
,
13466 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
13467 .channel_mode
= alc861_asus_modes
,
13470 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13471 .adc_nids
= alc861_adc_nids
,
13472 .input_mux
= &alc861_capture_source
,
13474 [ALC861_ASUS_LAPTOP
] = {
13475 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
13476 .init_verbs
= { alc861_asus_init_verbs
,
13477 alc861_asus_laptop_init_verbs
},
13478 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
13479 .dac_nids
= alc861_dac_nids
,
13480 .dig_out_nid
= ALC861_DIGOUT_NID
,
13481 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
13482 .channel_mode
= alc883_3ST_2ch_modes
,
13484 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
13485 .adc_nids
= alc861_adc_nids
,
13486 .input_mux
= &alc861_capture_source
,
13491 static int patch_alc861(struct hda_codec
*codec
)
13493 struct alc_spec
*spec
;
13497 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13501 codec
->spec
= spec
;
13503 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
13507 if (board_config
< 0) {
13508 printk(KERN_INFO
"hda_codec: Unknown model for ALC861, "
13509 "trying auto-probe from BIOS...\n");
13510 board_config
= ALC861_AUTO
;
13513 if (board_config
== ALC861_AUTO
) {
13514 /* automatic parse from the BIOS config */
13515 err
= alc861_parse_auto_config(codec
);
13521 "hda_codec: Cannot set up configuration "
13522 "from BIOS. Using base mode...\n");
13523 board_config
= ALC861_3ST_DIG
;
13527 if (board_config
!= ALC861_AUTO
)
13528 setup_preset(spec
, &alc861_presets
[board_config
]);
13530 spec
->stream_name_analog
= "ALC861 Analog";
13531 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
13532 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
13534 spec
->stream_name_digital
= "ALC861 Digital";
13535 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
13536 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
13538 spec
->vmaster_nid
= 0x03;
13540 codec
->patch_ops
= alc_patch_ops
;
13541 if (board_config
== ALC861_AUTO
)
13542 spec
->init_hook
= alc861_auto_init
;
13543 #ifdef CONFIG_SND_HDA_POWER_SAVE
13544 if (!spec
->loopback
.amplist
)
13545 spec
->loopback
.amplist
= alc861_loopbacks
;
13552 * ALC861-VD support
13556 * In addition, an independent DAC
13558 #define ALC861VD_DIGOUT_NID 0x06
13560 static hda_nid_t alc861vd_dac_nids
[4] = {
13561 /* front, surr, clfe, side surr */
13562 0x02, 0x03, 0x04, 0x05
13565 /* dac_nids for ALC660vd are in a different order - according to
13566 * Realtek's driver.
13567 * This should probably tesult in a different mixer for 6stack models
13568 * of ALC660vd codecs, but for now there is only 3stack mixer
13569 * - and it is the same as in 861vd.
13570 * adc_nids in ALC660vd are (is) the same as in 861vd
13572 static hda_nid_t alc660vd_dac_nids
[3] = {
13573 /* front, rear, clfe, rear_surr */
13577 static hda_nid_t alc861vd_adc_nids
[1] = {
13582 static hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
13585 /* FIXME: should be a matrix-type input source selection */
13586 static struct hda_input_mux alc861vd_capture_source
= {
13590 { "Front Mic", 0x1 },
13596 static struct hda_input_mux alc861vd_dallas_capture_source
= {
13599 { "Ext Mic", 0x0 },
13600 { "Int Mic", 0x1 },
13604 static struct hda_input_mux alc861vd_hp_capture_source
= {
13607 { "Front Mic", 0x0 },
13608 { "ATAPI Mic", 0x1 },
13612 #define alc861vd_mux_enum_info alc_mux_enum_info
13613 #define alc861vd_mux_enum_get alc_mux_enum_get
13614 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
13615 #define alc861vd_mux_enum_put alc882_mux_enum_put
13620 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
13627 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
13628 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13629 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13630 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13631 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13638 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
13639 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13640 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13641 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13642 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13646 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
13647 { 6, alc861vd_6stack_ch6_init
},
13648 { 8, alc861vd_6stack_ch8_init
},
13651 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
13653 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13654 .name
= "Channel Mode",
13655 .info
= alc_ch_mode_info
,
13656 .get
= alc_ch_mode_get
,
13657 .put
= alc_ch_mode_put
,
13662 static struct snd_kcontrol_new alc861vd_capture_mixer
[] = {
13663 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
13664 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
13667 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13668 /* The multiple "Capture Source" controls confuse alsamixer
13669 * So call somewhat different..
13671 /* .name = "Capture Source", */
13672 .name
= "Input Source",
13674 .info
= alc861vd_mux_enum_info
,
13675 .get
= alc861vd_mux_enum_get
,
13676 .put
= alc861vd_mux_enum_put
,
13681 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13682 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13684 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
13685 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13686 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
13688 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13689 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
13691 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
13693 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
13695 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
13696 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
13698 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
13699 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
13701 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13703 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13704 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13705 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13707 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
13708 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13709 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13711 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13712 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13714 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13715 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13717 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
13718 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
13723 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
13724 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13725 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
13727 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13729 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13730 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13733 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
13734 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13735 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13737 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13738 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13740 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13741 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13743 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
13744 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
13749 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
13750 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13751 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
13752 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13754 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13756 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
13757 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13758 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13760 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
13761 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13762 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13764 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13765 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13770 /* Pin assignment: Speaker=0x14, HP = 0x15,
13771 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
13773 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
13774 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13775 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
13776 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13777 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
13778 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
13779 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13780 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13781 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
13782 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13783 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13784 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT
),
13785 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT
),
13789 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
13790 * Front Mic=0x18, ATAPI Mic = 0x19,
13792 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
13793 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13794 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
13795 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13796 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
13797 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13798 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13799 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13800 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13806 * generic initialization of ADC, input mixers and output mixers
13808 static struct hda_verb alc861vd_volume_init_verbs
[] = {
13810 * Unmute ADC0 and set the default input to mic-in
13812 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
13813 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13815 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
13816 * the analog-loopback mixer widget
13818 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13819 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13820 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13821 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13822 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13823 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
13825 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
13826 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13827 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
13832 * Set up output mixers (0x02 - 0x05)
13834 /* set vol=0 to output mixers */
13835 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13836 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13837 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13838 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13840 /* set up input amps for analog loopback */
13841 /* Amp Indices: DAC = 0, mixer = 1 */
13842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13843 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13844 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13845 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13847 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13848 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13849 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13855 * 3-stack pin configuration:
13856 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
13858 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
13860 * Set pin mode and muting
13862 /* set front pin widgets 0x14 for output */
13863 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13864 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13865 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
13867 /* Mic (rear) pin: input vref at 80% */
13868 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13869 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13870 /* Front Mic pin: input vref at 80% */
13871 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13872 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13873 /* Line In pin: input */
13874 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13875 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13876 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13877 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13878 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13879 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
13880 /* CD pin widget for input */
13881 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13887 * 6-stack pin configuration:
13889 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
13891 * Set pin mode and muting
13893 /* set front pin widgets 0x14 for output */
13894 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13895 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13896 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
13898 /* Rear Pin: output 1 (0x0d) */
13899 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13900 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13901 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13902 /* CLFE Pin: output 2 (0x0e) */
13903 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13904 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13905 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
13906 /* Side Pin: output 3 (0x0f) */
13907 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13908 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13909 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
13911 /* Mic (rear) pin: input vref at 80% */
13912 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13913 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13914 /* Front Mic pin: input vref at 80% */
13915 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13916 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13917 /* Line In pin: input */
13918 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13919 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13920 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13921 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13922 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13923 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
13924 /* CD pin widget for input */
13925 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13930 static struct hda_verb alc861vd_eapd_verbs
[] = {
13931 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13935 static struct hda_verb alc660vd_eapd_verbs
[] = {
13936 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13937 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13941 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
13942 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13943 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13944 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
13945 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13946 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13950 /* toggle speaker-output according to the hp-jack state */
13951 static void alc861vd_lenovo_hp_automute(struct hda_codec
*codec
)
13953 unsigned int present
;
13954 unsigned char bits
;
13956 present
= snd_hda_codec_read(codec
, 0x1b, 0,
13957 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13958 bits
= present
? HDA_AMP_MUTE
: 0;
13959 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
13960 HDA_AMP_MUTE
, bits
);
13963 static void alc861vd_lenovo_mic_automute(struct hda_codec
*codec
)
13965 unsigned int present
;
13966 unsigned char bits
;
13968 present
= snd_hda_codec_read(codec
, 0x18, 0,
13969 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13970 bits
= present
? HDA_AMP_MUTE
: 0;
13971 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
13972 HDA_AMP_MUTE
, bits
);
13975 static void alc861vd_lenovo_automute(struct hda_codec
*codec
)
13977 alc861vd_lenovo_hp_automute(codec
);
13978 alc861vd_lenovo_mic_automute(codec
);
13981 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
13984 switch (res
>> 26) {
13985 case ALC880_HP_EVENT
:
13986 alc861vd_lenovo_hp_automute(codec
);
13988 case ALC880_MIC_EVENT
:
13989 alc861vd_lenovo_mic_automute(codec
);
13994 static struct hda_verb alc861vd_dallas_verbs
[] = {
13995 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13996 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13997 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13998 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14000 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14002 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14003 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14004 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14005 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14006 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14007 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14009 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14010 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14011 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14012 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14013 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14014 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14015 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14016 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14018 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
14019 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14020 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
14021 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14022 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14023 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14024 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14025 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14027 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14028 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
14029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
14030 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
14032 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14033 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
14034 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14039 /* toggle speaker-output according to the hp-jack state */
14040 static void alc861vd_dallas_automute(struct hda_codec
*codec
)
14042 unsigned int present
;
14044 present
= snd_hda_codec_read(codec
, 0x15, 0,
14045 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
14046 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14047 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
14050 static void alc861vd_dallas_unsol_event(struct hda_codec
*codec
, unsigned int res
)
14052 if ((res
>> 26) == ALC880_HP_EVENT
)
14053 alc861vd_dallas_automute(codec
);
14056 #ifdef CONFIG_SND_HDA_POWER_SAVE
14057 #define alc861vd_loopbacks alc880_loopbacks
14060 /* pcm configuration: identiacal with ALC880 */
14061 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14062 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14063 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14064 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14067 * configuration and preset
14069 static const char *alc861vd_models
[ALC861VD_MODEL_LAST
] = {
14070 [ALC660VD_3ST
] = "3stack-660",
14071 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
14072 [ALC861VD_3ST
] = "3stack",
14073 [ALC861VD_3ST_DIG
] = "3stack-digout",
14074 [ALC861VD_6ST_DIG
] = "6stack-digout",
14075 [ALC861VD_LENOVO
] = "lenovo",
14076 [ALC861VD_DALLAS
] = "dallas",
14077 [ALC861VD_HP
] = "hp",
14078 [ALC861VD_AUTO
] = "auto",
14081 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
14082 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
14083 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
14084 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
14085 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST
),
14086 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO
),
14087 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
14088 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
14089 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
14090 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14091 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS
),
14092 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
14093 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
14094 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
14095 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO
),
14096 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO
),
14097 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO
),
14098 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
14102 static struct alc_config_preset alc861vd_presets
[] = {
14104 .mixers
= { alc861vd_3st_mixer
},
14105 .init_verbs
= { alc861vd_volume_init_verbs
,
14106 alc861vd_3stack_init_verbs
},
14107 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
14108 .dac_nids
= alc660vd_dac_nids
,
14109 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14110 .channel_mode
= alc861vd_3stack_2ch_modes
,
14111 .input_mux
= &alc861vd_capture_source
,
14113 [ALC660VD_3ST_DIG
] = {
14114 .mixers
= { alc861vd_3st_mixer
},
14115 .init_verbs
= { alc861vd_volume_init_verbs
,
14116 alc861vd_3stack_init_verbs
},
14117 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
14118 .dac_nids
= alc660vd_dac_nids
,
14119 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
14120 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14121 .channel_mode
= alc861vd_3stack_2ch_modes
,
14122 .input_mux
= &alc861vd_capture_source
,
14125 .mixers
= { alc861vd_3st_mixer
},
14126 .init_verbs
= { alc861vd_volume_init_verbs
,
14127 alc861vd_3stack_init_verbs
},
14128 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
14129 .dac_nids
= alc861vd_dac_nids
,
14130 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14131 .channel_mode
= alc861vd_3stack_2ch_modes
,
14132 .input_mux
= &alc861vd_capture_source
,
14134 [ALC861VD_3ST_DIG
] = {
14135 .mixers
= { alc861vd_3st_mixer
},
14136 .init_verbs
= { alc861vd_volume_init_verbs
,
14137 alc861vd_3stack_init_verbs
},
14138 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
14139 .dac_nids
= alc861vd_dac_nids
,
14140 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
14141 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14142 .channel_mode
= alc861vd_3stack_2ch_modes
,
14143 .input_mux
= &alc861vd_capture_source
,
14145 [ALC861VD_6ST_DIG
] = {
14146 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
14147 .init_verbs
= { alc861vd_volume_init_verbs
,
14148 alc861vd_6stack_init_verbs
},
14149 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
14150 .dac_nids
= alc861vd_dac_nids
,
14151 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
14152 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
14153 .channel_mode
= alc861vd_6stack_modes
,
14154 .input_mux
= &alc861vd_capture_source
,
14156 [ALC861VD_LENOVO
] = {
14157 .mixers
= { alc861vd_lenovo_mixer
},
14158 .init_verbs
= { alc861vd_volume_init_verbs
,
14159 alc861vd_3stack_init_verbs
,
14160 alc861vd_eapd_verbs
,
14161 alc861vd_lenovo_unsol_verbs
},
14162 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
14163 .dac_nids
= alc660vd_dac_nids
,
14164 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14165 .channel_mode
= alc861vd_3stack_2ch_modes
,
14166 .input_mux
= &alc861vd_capture_source
,
14167 .unsol_event
= alc861vd_lenovo_unsol_event
,
14168 .init_hook
= alc861vd_lenovo_automute
,
14170 [ALC861VD_DALLAS
] = {
14171 .mixers
= { alc861vd_dallas_mixer
},
14172 .init_verbs
= { alc861vd_dallas_verbs
},
14173 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
14174 .dac_nids
= alc861vd_dac_nids
,
14175 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14176 .channel_mode
= alc861vd_3stack_2ch_modes
,
14177 .input_mux
= &alc861vd_dallas_capture_source
,
14178 .unsol_event
= alc861vd_dallas_unsol_event
,
14179 .init_hook
= alc861vd_dallas_automute
,
14182 .mixers
= { alc861vd_hp_mixer
},
14183 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
14184 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
14185 .dac_nids
= alc861vd_dac_nids
,
14186 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
14187 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
14188 .channel_mode
= alc861vd_3stack_2ch_modes
,
14189 .input_mux
= &alc861vd_hp_capture_source
,
14190 .unsol_event
= alc861vd_dallas_unsol_event
,
14191 .init_hook
= alc861vd_dallas_automute
,
14196 * BIOS auto configuration
14198 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
14199 hda_nid_t nid
, int pin_type
, int dac_idx
)
14201 alc_set_pin_output(codec
, nid
, pin_type
);
14204 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
14206 struct alc_spec
*spec
= codec
->spec
;
14209 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
14210 for (i
= 0; i
<= HDA_SIDE
; i
++) {
14211 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
14212 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
14214 alc861vd_auto_set_output_and_unmute(codec
, nid
,
14220 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
14222 struct alc_spec
*spec
= codec
->spec
;
14225 pin
= spec
->autocfg
.hp_pins
[0];
14226 if (pin
) /* connect to front and use dac 0 */
14227 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
14228 pin
= spec
->autocfg
.speaker_pins
[0];
14230 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
14233 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14234 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14236 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
14238 struct alc_spec
*spec
= codec
->spec
;
14241 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
14242 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
14243 if (alc861vd_is_input_pin(nid
)) {
14244 snd_hda_codec_write(codec
, nid
, 0,
14245 AC_VERB_SET_PIN_WIDGET_CONTROL
,
14246 i
<= AUTO_PIN_FRONT_MIC
?
14247 PIN_VREF80
: PIN_IN
);
14248 if (nid
!= ALC861VD_PIN_CD_NID
)
14249 snd_hda_codec_write(codec
, nid
, 0,
14250 AC_VERB_SET_AMP_GAIN_MUTE
,
14256 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14258 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14259 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14261 /* add playback controls from the parsed DAC table */
14262 /* Based on ALC880 version. But ALC861VD has separate,
14263 * different NIDs for mute/unmute switch and volume control */
14264 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
14265 const struct auto_pin_cfg
*cfg
)
14268 static const char *chname
[4] = {"Front", "Surround", "CLFE", "Side"};
14269 hda_nid_t nid_v
, nid_s
;
14272 for (i
= 0; i
< cfg
->line_outs
; i
++) {
14273 if (!spec
->multiout
.dac_nids
[i
])
14275 nid_v
= alc861vd_idx_to_mixer_vol(
14277 spec
->multiout
.dac_nids
[i
]));
14278 nid_s
= alc861vd_idx_to_mixer_switch(
14280 spec
->multiout
.dac_nids
[i
]));
14284 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
14285 "Center Playback Volume",
14286 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
14290 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
14291 "LFE Playback Volume",
14292 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
14296 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14297 "Center Playback Switch",
14298 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
14302 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14303 "LFE Playback Switch",
14304 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
14309 sprintf(name
, "%s Playback Volume", chname
[i
]);
14310 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
14311 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
14315 sprintf(name
, "%s Playback Switch", chname
[i
]);
14316 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
14317 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
14326 /* add playback controls for speaker and HP outputs */
14327 /* Based on ALC880 version. But ALC861VD has separate,
14328 * different NIDs for mute/unmute switch and volume control */
14329 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
14330 hda_nid_t pin
, const char *pfx
)
14332 hda_nid_t nid_v
, nid_s
;
14339 if (alc880_is_fixed_pin(pin
)) {
14340 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
14341 /* specify the DAC as the extra output */
14342 if (!spec
->multiout
.hp_nid
)
14343 spec
->multiout
.hp_nid
= nid_v
;
14345 spec
->multiout
.extra_out_nid
[0] = nid_v
;
14346 /* control HP volume/switch on the output mixer amp */
14347 nid_v
= alc861vd_idx_to_mixer_vol(
14348 alc880_fixed_pin_idx(pin
));
14349 nid_s
= alc861vd_idx_to_mixer_switch(
14350 alc880_fixed_pin_idx(pin
));
14352 sprintf(name
, "%s Playback Volume", pfx
);
14353 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
14354 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
14357 sprintf(name
, "%s Playback Switch", pfx
);
14358 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
14359 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
14362 } else if (alc880_is_multi_pin(pin
)) {
14363 /* set manual connection */
14364 /* we have only a switch on HP-out PIN */
14365 sprintf(name
, "%s Playback Switch", pfx
);
14366 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
14367 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
14374 /* parse the BIOS configuration and set up the alc_spec
14375 * return 1 if successful, 0 if the proper config is not found,
14376 * or a negative error code
14377 * Based on ALC880 version - had to change it to override
14378 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
14379 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
14381 struct alc_spec
*spec
= codec
->spec
;
14383 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
14385 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14389 if (!spec
->autocfg
.line_outs
)
14390 return 0; /* can't find valid BIOS pin config */
14392 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
14395 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14398 err
= alc861vd_auto_create_extra_out(spec
,
14399 spec
->autocfg
.speaker_pins
[0],
14403 err
= alc861vd_auto_create_extra_out(spec
,
14404 spec
->autocfg
.hp_pins
[0],
14408 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
14412 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14414 if (spec
->autocfg
.dig_out_pin
)
14415 spec
->multiout
.dig_out_nid
= ALC861VD_DIGOUT_NID
;
14417 if (spec
->kctl_alloc
)
14418 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
14420 spec
->init_verbs
[spec
->num_init_verbs
++]
14421 = alc861vd_volume_init_verbs
;
14423 spec
->num_mux_defs
= 1;
14424 spec
->input_mux
= &spec
->private_imux
;
14426 err
= alc_auto_add_mic_boost(codec
);
14433 /* additional initialization for auto-configuration model */
14434 static void alc861vd_auto_init(struct hda_codec
*codec
)
14436 struct alc_spec
*spec
= codec
->spec
;
14437 alc861vd_auto_init_multi_out(codec
);
14438 alc861vd_auto_init_hp_out(codec
);
14439 alc861vd_auto_init_analog_input(codec
);
14440 alc861vd_auto_init_input_src(codec
);
14441 if (spec
->unsol_event
)
14442 alc_inithook(codec
);
14445 static int patch_alc861vd(struct hda_codec
*codec
)
14447 struct alc_spec
*spec
;
14448 int err
, board_config
;
14450 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
14454 codec
->spec
= spec
;
14456 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
14460 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
14461 printk(KERN_INFO
"hda_codec: Unknown model for ALC660VD/"
14462 "ALC861VD, trying auto-probe from BIOS...\n");
14463 board_config
= ALC861VD_AUTO
;
14466 if (board_config
== ALC861VD_AUTO
) {
14467 /* automatic parse from the BIOS config */
14468 err
= alc861vd_parse_auto_config(codec
);
14474 "hda_codec: Cannot set up configuration "
14475 "from BIOS. Using base mode...\n");
14476 board_config
= ALC861VD_3ST
;
14480 if (board_config
!= ALC861VD_AUTO
)
14481 setup_preset(spec
, &alc861vd_presets
[board_config
]);
14483 if (codec
->vendor_id
== 0x10ec0660) {
14484 spec
->stream_name_analog
= "ALC660-VD Analog";
14485 spec
->stream_name_digital
= "ALC660-VD Digital";
14486 /* always turn on EAPD */
14487 spec
->init_verbs
[spec
->num_init_verbs
++] = alc660vd_eapd_verbs
;
14489 spec
->stream_name_analog
= "ALC861VD Analog";
14490 spec
->stream_name_digital
= "ALC861VD Digital";
14493 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
14494 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
14496 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
14497 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
14499 spec
->adc_nids
= alc861vd_adc_nids
;
14500 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
14501 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
14503 spec
->mixers
[spec
->num_mixers
] = alc861vd_capture_mixer
;
14504 spec
->num_mixers
++;
14506 spec
->vmaster_nid
= 0x02;
14508 codec
->patch_ops
= alc_patch_ops
;
14510 if (board_config
== ALC861VD_AUTO
)
14511 spec
->init_hook
= alc861vd_auto_init
;
14512 #ifdef CONFIG_SND_HDA_POWER_SAVE
14513 if (!spec
->loopback
.amplist
)
14514 spec
->loopback
.amplist
= alc861vd_loopbacks
;
14523 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
14524 * configuration. Each pin widget can choose any input DACs and a mixer.
14525 * Each ADC is connected from a mixer of all inputs. This makes possible
14526 * 6-channel independent captures.
14528 * In addition, an independent DAC for the multi-playback (not used in this
14531 #define ALC662_DIGOUT_NID 0x06
14532 #define ALC662_DIGIN_NID 0x0a
14534 static hda_nid_t alc662_dac_nids
[4] = {
14535 /* front, rear, clfe, rear_surr */
14539 static hda_nid_t alc662_adc_nids
[1] = {
14544 static hda_nid_t alc662_capsrc_nids
[1] = { 0x22 };
14547 /* FIXME: should be a matrix-type input source selection */
14548 static struct hda_input_mux alc662_capture_source
= {
14552 { "Front Mic", 0x1 },
14558 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
14566 static struct hda_input_mux alc662_eeepc_capture_source
= {
14574 static struct hda_input_mux alc663_capture_source
= {
14578 { "Front Mic", 0x1 },
14583 static struct hda_input_mux alc663_m51va_capture_source
= {
14586 { "Ext-Mic", 0x0 },
14591 #define alc662_mux_enum_info alc_mux_enum_info
14592 #define alc662_mux_enum_get alc_mux_enum_get
14593 #define alc662_mux_enum_put alc882_mux_enum_put
14598 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
14605 static struct hda_verb alc662_3ST_ch2_init
[] = {
14606 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14607 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14608 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14609 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14616 static struct hda_verb alc662_3ST_ch6_init
[] = {
14617 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14618 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14619 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
14620 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14621 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14622 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
14626 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
14627 { 2, alc662_3ST_ch2_init
},
14628 { 6, alc662_3ST_ch6_init
},
14634 static struct hda_verb alc662_sixstack_ch6_init
[] = {
14635 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
14636 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
14637 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14644 static struct hda_verb alc662_sixstack_ch8_init
[] = {
14645 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14646 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14647 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14651 static struct hda_channel_mode alc662_5stack_modes
[2] = {
14652 { 2, alc662_sixstack_ch6_init
},
14653 { 6, alc662_sixstack_ch8_init
},
14656 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14657 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14660 static struct snd_kcontrol_new alc662_base_mixer
[] = {
14661 /* output mixer control */
14662 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
14663 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
14664 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
14665 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
14666 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
14667 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
14668 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
14669 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
14670 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14672 /*Input mixer control */
14673 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
14674 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
14675 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
14676 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
14677 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
14678 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
14679 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
14680 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
14684 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
14685 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14686 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
14687 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14688 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
14689 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
14690 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14691 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14692 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14693 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14694 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14695 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14696 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
14697 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
14701 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
14702 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14703 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
14704 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14705 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
14706 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
14707 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
14708 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
14709 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
14710 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14711 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
14712 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
14713 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14714 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14715 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14716 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14717 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14718 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14719 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
14720 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
14724 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
14725 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14726 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
14727 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14728 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
14729 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14730 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14731 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14737 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
14738 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14740 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14741 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14743 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT
),
14744 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14745 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14747 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
14748 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14749 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14753 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
14754 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14755 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14756 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14757 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT
),
14758 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
14759 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
14760 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT
),
14761 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT
),
14762 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14763 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
14764 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14765 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14766 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14767 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14771 static struct hda_bind_ctls alc663_asus_bind_master_vol
= {
14772 .ops
= &snd_hda_bind_vol
,
14774 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
14775 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
14780 static struct hda_bind_ctls alc663_asus_one_bind_switch
= {
14781 .ops
= &snd_hda_bind_sw
,
14783 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
14784 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
14789 static struct snd_kcontrol_new alc663_m51va_mixer
[] = {
14790 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
14791 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch
),
14792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14797 static struct hda_bind_ctls alc663_asus_tree_bind_switch
= {
14798 .ops
= &snd_hda_bind_sw
,
14800 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
14801 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
14802 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT
),
14807 static struct snd_kcontrol_new alc663_two_hp_m1_mixer
[] = {
14808 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
14809 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch
),
14810 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14811 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14812 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14813 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14818 static struct hda_bind_ctls alc663_asus_four_bind_switch
= {
14819 .ops
= &snd_hda_bind_sw
,
14821 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
14822 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
14823 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
14828 static struct snd_kcontrol_new alc663_two_hp_m2_mixer
[] = {
14829 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
14830 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch
),
14831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14832 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14833 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14834 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14838 static struct snd_kcontrol_new alc662_1bjd_mixer
[] = {
14839 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14840 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14841 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
14842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14843 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14844 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14845 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14849 static struct hda_bind_ctls alc663_asus_two_bind_master_vol
= {
14850 .ops
= &snd_hda_bind_vol
,
14852 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
14853 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT
),
14858 static struct hda_bind_ctls alc663_asus_two_bind_switch
= {
14859 .ops
= &snd_hda_bind_sw
,
14861 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
14862 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT
),
14867 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer
[] = {
14868 HDA_BIND_VOL("Master Playback Volume",
14869 &alc663_asus_two_bind_master_vol
),
14870 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
14871 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14872 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
14873 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14874 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14878 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer
[] = {
14879 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol
),
14880 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch
),
14881 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
14883 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14884 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14888 static struct snd_kcontrol_new alc663_g71v_mixer
[] = {
14889 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14890 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14891 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
14892 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
14893 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
14895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14897 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14898 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14902 static struct snd_kcontrol_new alc663_g50v_mixer
[] = {
14903 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
14904 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
14905 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
14907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
14908 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
14909 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
14910 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
14911 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
14912 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
14916 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
14918 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14919 .name
= "Channel Mode",
14920 .info
= alc_ch_mode_info
,
14921 .get
= alc_ch_mode_get
,
14922 .put
= alc_ch_mode_put
,
14927 static struct hda_verb alc662_init_verbs
[] = {
14928 /* ADC: mute amp left and right */
14929 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14930 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
14931 /* Front mixer: unmute input/output amp left and right (volume = 0) */
14933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
14936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
14937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
14939 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14940 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14941 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14942 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14943 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14944 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14946 /* Front Pin: output 0 (0x0c) */
14947 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14948 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14950 /* Rear Pin: output 1 (0x0d) */
14951 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14952 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14954 /* CLFE Pin: output 2 (0x0e) */
14955 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14956 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14958 /* Mic (rear) pin: input vref at 80% */
14959 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14960 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14961 /* Front Mic pin: input vref at 80% */
14962 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14963 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14964 /* Line In pin: input */
14965 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14966 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14967 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14968 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14969 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14970 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
14971 /* CD pin widget for input */
14972 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14974 /* FIXME: use matrix-type input source selection */
14975 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14977 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14978 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14979 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14980 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
14982 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14983 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14984 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14985 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
14987 /* always trun on EAPD */
14988 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14989 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14994 static struct hda_verb alc662_sue_init_verbs
[] = {
14995 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
14996 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
15000 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
15001 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15002 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15006 /* Set Unsolicited Event*/
15007 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
15008 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
15009 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15014 * generic initialization of ADC, input mixers and output mixers
15016 static struct hda_verb alc662_auto_init_verbs
[] = {
15018 * Unmute ADC and set the default input to mic-in
15020 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
15021 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15023 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15025 * Note: PASD motherboards uses the Line In 2 as the input for front
15026 * panel mic (mic 2)
15028 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
15031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
15032 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
15033 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
15036 * Set up output mixers (0x0c - 0x0f)
15038 /* set vol=0 to output mixers */
15039 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15040 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15041 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
15043 /* set up input amps for analog loopback */
15044 /* Amp Indices: DAC = 0, mixer = 1 */
15045 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15046 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15047 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15048 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15049 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15050 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15053 /* FIXME: use matrix-type input source selection */
15054 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15056 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15057 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15061 /* additional verbs for ALC663 */
15062 static struct hda_verb alc663_auto_init_verbs
[] = {
15063 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
15064 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15068 static struct hda_verb alc663_m51va_init_verbs
[] = {
15069 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15070 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15071 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15072 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15073 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
15074 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15075 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
15076 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15077 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15081 static struct hda_verb alc663_21jd_amic_init_verbs
[] = {
15082 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15083 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15084 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
15085 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15087 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15088 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15092 static struct hda_verb alc662_1bjd_amic_init_verbs
[] = {
15093 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15094 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15095 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15096 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
15097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15099 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15100 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15104 static struct hda_verb alc663_15jd_amic_init_verbs
[] = {
15105 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15106 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15107 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
15108 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15110 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15111 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15115 static struct hda_verb alc663_two_hp_amic_m1_init_verbs
[] = {
15116 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15117 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15118 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15119 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
15120 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15121 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15122 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x0}, /* Headphone */
15123 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15124 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15125 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15126 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15127 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15131 static struct hda_verb alc663_two_hp_amic_m2_init_verbs
[] = {
15132 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
15133 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15134 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15135 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
15136 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15137 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15138 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Headphone */
15139 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15140 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
15141 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15142 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15143 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15147 static struct hda_verb alc663_g71v_init_verbs
[] = {
15148 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15149 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15150 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15152 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15153 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15154 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
15156 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
15157 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_MIC_EVENT
},
15158 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
15162 static struct hda_verb alc663_g50v_init_verbs
[] = {
15163 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
15164 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
15165 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
15167 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15168 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15172 static struct hda_verb alc662_ecs_init_verbs
[] = {
15173 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0x701f},
15174 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
15175 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
15176 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
15180 /* capture mixer elements */
15181 static struct snd_kcontrol_new alc662_capture_mixer
[] = {
15182 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
15183 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
15185 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15186 /* The multiple "Capture Source" controls confuse alsamixer
15187 * So call somewhat different..
15189 /* .name = "Capture Source", */
15190 .name
= "Input Source",
15192 .info
= alc662_mux_enum_info
,
15193 .get
= alc662_mux_enum_get
,
15194 .put
= alc662_mux_enum_put
,
15199 static struct snd_kcontrol_new alc662_auto_capture_mixer
[] = {
15200 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
15201 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
15205 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
15207 unsigned int present
;
15208 unsigned char bits
;
15210 present
= snd_hda_codec_read(codec
, 0x14, 0,
15211 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
15212 bits
= present
? HDA_AMP_MUTE
: 0;
15213 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
15214 HDA_AMP_MUTE
, bits
);
15217 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
15219 unsigned int present
;
15220 unsigned char bits
;
15222 present
= snd_hda_codec_read(codec
, 0x1b, 0,
15223 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
15224 bits
= present
? HDA_AMP_MUTE
: 0;
15225 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
15226 HDA_AMP_MUTE
, bits
);
15227 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
15228 HDA_AMP_MUTE
, bits
);
15231 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
15234 if ((res
>> 26) == ALC880_HP_EVENT
)
15235 alc662_lenovo_101e_all_automute(codec
);
15236 if ((res
>> 26) == ALC880_FRONT_EVENT
)
15237 alc662_lenovo_101e_ispeaker_automute(codec
);
15240 static void alc662_eeepc_mic_automute(struct hda_codec
*codec
)
15242 unsigned int present
;
15244 present
= snd_hda_codec_read(codec
, 0x18, 0,
15245 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
15246 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15247 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
15248 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15249 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
15250 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15251 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
15252 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15253 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
15256 /* unsolicited event for HP jack sensing */
15257 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
15260 if ((res
>> 26) == ALC880_HP_EVENT
)
15261 alc262_hippo1_automute( codec
);
15263 if ((res
>> 26) == ALC880_MIC_EVENT
)
15264 alc662_eeepc_mic_automute(codec
);
15267 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
15269 alc262_hippo1_automute( codec
);
15270 alc662_eeepc_mic_automute(codec
);
15273 static void alc662_eeepc_ep20_automute(struct hda_codec
*codec
)
15276 unsigned int present
;
15278 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
15279 present
= snd_hda_codec_read(codec
, 0x14, 0,
15280 AC_VERB_GET_PIN_SENSE
, 0);
15281 present
= (present
& 0x80000000) != 0;
15283 /* mute internal speaker */
15284 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
15285 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
15287 /* unmute internal speaker if necessary */
15288 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
15289 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
15290 HDA_AMP_MUTE
, mute
);
15294 /* unsolicited event for HP jack sensing */
15295 static void alc662_eeepc_ep20_unsol_event(struct hda_codec
*codec
,
15298 if ((res
>> 26) == ALC880_HP_EVENT
)
15299 alc662_eeepc_ep20_automute(codec
);
15302 static void alc662_eeepc_ep20_inithook(struct hda_codec
*codec
)
15304 alc662_eeepc_ep20_automute(codec
);
15307 static void alc663_m51va_speaker_automute(struct hda_codec
*codec
)
15309 unsigned int present
;
15310 unsigned char bits
;
15312 present
= snd_hda_codec_read(codec
, 0x21, 0,
15313 AC_VERB_GET_PIN_SENSE
, 0)
15314 & AC_PINSENSE_PRESENCE
;
15315 bits
= present
? HDA_AMP_MUTE
: 0;
15316 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
15317 AMP_IN_MUTE(0), bits
);
15318 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
15319 AMP_IN_MUTE(0), bits
);
15322 static void alc663_21jd_two_speaker_automute(struct hda_codec
*codec
)
15324 unsigned int present
;
15325 unsigned char bits
;
15327 present
= snd_hda_codec_read(codec
, 0x21, 0,
15328 AC_VERB_GET_PIN_SENSE
, 0)
15329 & AC_PINSENSE_PRESENCE
;
15330 bits
= present
? HDA_AMP_MUTE
: 0;
15331 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
15332 AMP_IN_MUTE(0), bits
);
15333 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
15334 AMP_IN_MUTE(0), bits
);
15335 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
15336 AMP_IN_MUTE(0), bits
);
15337 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
15338 AMP_IN_MUTE(0), bits
);
15341 static void alc663_15jd_two_speaker_automute(struct hda_codec
*codec
)
15343 unsigned int present
;
15344 unsigned char bits
;
15346 present
= snd_hda_codec_read(codec
, 0x15, 0,
15347 AC_VERB_GET_PIN_SENSE
, 0)
15348 & AC_PINSENSE_PRESENCE
;
15349 bits
= present
? HDA_AMP_MUTE
: 0;
15350 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
15351 AMP_IN_MUTE(0), bits
);
15352 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
15353 AMP_IN_MUTE(0), bits
);
15354 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 0,
15355 AMP_IN_MUTE(0), bits
);
15356 snd_hda_codec_amp_stereo(codec
, 0x0e, HDA_INPUT
, 1,
15357 AMP_IN_MUTE(0), bits
);
15360 static void alc662_f5z_speaker_automute(struct hda_codec
*codec
)
15362 unsigned int present
;
15363 unsigned char bits
;
15365 present
= snd_hda_codec_read(codec
, 0x1b, 0,
15366 AC_VERB_GET_PIN_SENSE
, 0)
15367 & AC_PINSENSE_PRESENCE
;
15368 bits
= present
? 0 : PIN_OUT
;
15369 snd_hda_codec_write(codec
, 0x14, 0,
15370 AC_VERB_SET_PIN_WIDGET_CONTROL
, bits
);
15373 static void alc663_two_hp_m1_speaker_automute(struct hda_codec
*codec
)
15375 unsigned int present1
, present2
;
15377 present1
= snd_hda_codec_read(codec
, 0x21, 0,
15378 AC_VERB_GET_PIN_SENSE
, 0)
15379 & AC_PINSENSE_PRESENCE
;
15380 present2
= snd_hda_codec_read(codec
, 0x15, 0,
15381 AC_VERB_GET_PIN_SENSE
, 0)
15382 & AC_PINSENSE_PRESENCE
;
15384 if (present1
|| present2
) {
15385 snd_hda_codec_write_cache(codec
, 0x14, 0,
15386 AC_VERB_SET_PIN_WIDGET_CONTROL
, 0);
15388 snd_hda_codec_write_cache(codec
, 0x14, 0,
15389 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
15393 static void alc663_two_hp_m2_speaker_automute(struct hda_codec
*codec
)
15395 unsigned int present1
, present2
;
15397 present1
= snd_hda_codec_read(codec
, 0x1b, 0,
15398 AC_VERB_GET_PIN_SENSE
, 0)
15399 & AC_PINSENSE_PRESENCE
;
15400 present2
= snd_hda_codec_read(codec
, 0x15, 0,
15401 AC_VERB_GET_PIN_SENSE
, 0)
15402 & AC_PINSENSE_PRESENCE
;
15404 if (present1
|| present2
) {
15405 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
15406 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15407 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
15408 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
15410 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
15411 AMP_IN_MUTE(0), 0);
15412 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
15413 AMP_IN_MUTE(0), 0);
15417 static void alc663_m51va_mic_automute(struct hda_codec
*codec
)
15419 unsigned int present
;
15421 present
= snd_hda_codec_read(codec
, 0x18, 0,
15422 AC_VERB_GET_PIN_SENSE
, 0)
15423 & AC_PINSENSE_PRESENCE
;
15424 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15425 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
15426 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15427 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
15428 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15429 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
15430 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
15431 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
15434 static void alc663_m51va_unsol_event(struct hda_codec
*codec
,
15437 switch (res
>> 26) {
15438 case ALC880_HP_EVENT
:
15439 alc663_m51va_speaker_automute(codec
);
15441 case ALC880_MIC_EVENT
:
15442 alc663_m51va_mic_automute(codec
);
15447 static void alc663_m51va_inithook(struct hda_codec
*codec
)
15449 alc663_m51va_speaker_automute(codec
);
15450 alc663_m51va_mic_automute(codec
);
15453 /* ***************** Mode1 ******************************/
15454 static void alc663_mode1_unsol_event(struct hda_codec
*codec
,
15457 switch (res
>> 26) {
15458 case ALC880_HP_EVENT
:
15459 alc663_m51va_speaker_automute(codec
);
15461 case ALC880_MIC_EVENT
:
15462 alc662_eeepc_mic_automute(codec
);
15467 static void alc663_mode1_inithook(struct hda_codec
*codec
)
15469 alc663_m51va_speaker_automute(codec
);
15470 alc662_eeepc_mic_automute(codec
);
15472 /* ***************** Mode2 ******************************/
15473 static void alc662_mode2_unsol_event(struct hda_codec
*codec
,
15476 switch (res
>> 26) {
15477 case ALC880_HP_EVENT
:
15478 alc662_f5z_speaker_automute(codec
);
15480 case ALC880_MIC_EVENT
:
15481 alc662_eeepc_mic_automute(codec
);
15486 static void alc662_mode2_inithook(struct hda_codec
*codec
)
15488 alc662_f5z_speaker_automute(codec
);
15489 alc662_eeepc_mic_automute(codec
);
15491 /* ***************** Mode3 ******************************/
15492 static void alc663_mode3_unsol_event(struct hda_codec
*codec
,
15495 switch (res
>> 26) {
15496 case ALC880_HP_EVENT
:
15497 alc663_two_hp_m1_speaker_automute(codec
);
15499 case ALC880_MIC_EVENT
:
15500 alc662_eeepc_mic_automute(codec
);
15505 static void alc663_mode3_inithook(struct hda_codec
*codec
)
15507 alc663_two_hp_m1_speaker_automute(codec
);
15508 alc662_eeepc_mic_automute(codec
);
15510 /* ***************** Mode4 ******************************/
15511 static void alc663_mode4_unsol_event(struct hda_codec
*codec
,
15514 switch (res
>> 26) {
15515 case ALC880_HP_EVENT
:
15516 alc663_21jd_two_speaker_automute(codec
);
15518 case ALC880_MIC_EVENT
:
15519 alc662_eeepc_mic_automute(codec
);
15524 static void alc663_mode4_inithook(struct hda_codec
*codec
)
15526 alc663_21jd_two_speaker_automute(codec
);
15527 alc662_eeepc_mic_automute(codec
);
15529 /* ***************** Mode5 ******************************/
15530 static void alc663_mode5_unsol_event(struct hda_codec
*codec
,
15533 switch (res
>> 26) {
15534 case ALC880_HP_EVENT
:
15535 alc663_15jd_two_speaker_automute(codec
);
15537 case ALC880_MIC_EVENT
:
15538 alc662_eeepc_mic_automute(codec
);
15543 static void alc663_mode5_inithook(struct hda_codec
*codec
)
15545 alc663_15jd_two_speaker_automute(codec
);
15546 alc662_eeepc_mic_automute(codec
);
15548 /* ***************** Mode6 ******************************/
15549 static void alc663_mode6_unsol_event(struct hda_codec
*codec
,
15552 switch (res
>> 26) {
15553 case ALC880_HP_EVENT
:
15554 alc663_two_hp_m2_speaker_automute(codec
);
15556 case ALC880_MIC_EVENT
:
15557 alc662_eeepc_mic_automute(codec
);
15562 static void alc663_mode6_inithook(struct hda_codec
*codec
)
15564 alc663_two_hp_m2_speaker_automute(codec
);
15565 alc662_eeepc_mic_automute(codec
);
15568 static void alc663_g71v_hp_automute(struct hda_codec
*codec
)
15570 unsigned int present
;
15571 unsigned char bits
;
15573 present
= snd_hda_codec_read(codec
, 0x21, 0,
15574 AC_VERB_GET_PIN_SENSE
, 0)
15575 & AC_PINSENSE_PRESENCE
;
15576 bits
= present
? HDA_AMP_MUTE
: 0;
15577 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
15578 HDA_AMP_MUTE
, bits
);
15579 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
15580 HDA_AMP_MUTE
, bits
);
15583 static void alc663_g71v_front_automute(struct hda_codec
*codec
)
15585 unsigned int present
;
15586 unsigned char bits
;
15588 present
= snd_hda_codec_read(codec
, 0x15, 0,
15589 AC_VERB_GET_PIN_SENSE
, 0)
15590 & AC_PINSENSE_PRESENCE
;
15591 bits
= present
? HDA_AMP_MUTE
: 0;
15592 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
15593 HDA_AMP_MUTE
, bits
);
15596 static void alc663_g71v_unsol_event(struct hda_codec
*codec
,
15599 switch (res
>> 26) {
15600 case ALC880_HP_EVENT
:
15601 alc663_g71v_hp_automute(codec
);
15603 case ALC880_FRONT_EVENT
:
15604 alc663_g71v_front_automute(codec
);
15606 case ALC880_MIC_EVENT
:
15607 alc662_eeepc_mic_automute(codec
);
15612 static void alc663_g71v_inithook(struct hda_codec
*codec
)
15614 alc663_g71v_front_automute(codec
);
15615 alc663_g71v_hp_automute(codec
);
15616 alc662_eeepc_mic_automute(codec
);
15619 static void alc663_g50v_unsol_event(struct hda_codec
*codec
,
15622 switch (res
>> 26) {
15623 case ALC880_HP_EVENT
:
15624 alc663_m51va_speaker_automute(codec
);
15626 case ALC880_MIC_EVENT
:
15627 alc662_eeepc_mic_automute(codec
);
15632 static void alc663_g50v_inithook(struct hda_codec
*codec
)
15634 alc663_m51va_speaker_automute(codec
);
15635 alc662_eeepc_mic_automute(codec
);
15638 /* bind hp and internal speaker mute (with plug check) */
15639 static int alc662_ecs_master_sw_put(struct snd_kcontrol
*kcontrol
,
15640 struct snd_ctl_elem_value
*ucontrol
)
15642 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
15643 long *valp
= ucontrol
->value
.integer
.value
;
15646 change
= snd_hda_codec_amp_update(codec
, 0x1b, 0, HDA_OUTPUT
, 0,
15648 valp
[0] ? 0 : HDA_AMP_MUTE
);
15649 change
|= snd_hda_codec_amp_update(codec
, 0x1b, 1, HDA_OUTPUT
, 0,
15651 valp
[1] ? 0 : HDA_AMP_MUTE
);
15653 alc262_hippo1_automute(codec
);
15657 static struct snd_kcontrol_new alc662_ecs_mixer
[] = {
15658 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
15660 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
15661 .name
= "Master Playback Switch",
15662 .info
= snd_hda_mixer_amp_switch_info
,
15663 .get
= snd_hda_mixer_amp_switch_get
,
15664 .put
= alc662_ecs_master_sw_put
,
15665 .private_value
= HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
15668 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT
),
15669 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT
),
15670 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT
),
15672 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
15673 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
15674 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
15678 #ifdef CONFIG_SND_HDA_POWER_SAVE
15679 #define alc662_loopbacks alc880_loopbacks
15683 /* pcm configuration: identiacal with ALC880 */
15684 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
15685 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
15686 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
15687 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
15690 * configuration and preset
15692 static const char *alc662_models
[ALC662_MODEL_LAST
] = {
15693 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
15694 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
15695 [ALC662_3ST_6ch
] = "3stack-6ch",
15696 [ALC662_5ST_DIG
] = "6stack-dig",
15697 [ALC662_LENOVO_101E
] = "lenovo-101e",
15698 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
15699 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
15700 [ALC662_ECS
] = "ecs",
15701 [ALC663_ASUS_M51VA
] = "m51va",
15702 [ALC663_ASUS_G71V
] = "g71v",
15703 [ALC663_ASUS_H13
] = "h13",
15704 [ALC663_ASUS_G50V
] = "g50v",
15705 [ALC663_ASUS_MODE1
] = "asus-mode1",
15706 [ALC662_ASUS_MODE2
] = "asus-mode2",
15707 [ALC663_ASUS_MODE3
] = "asus-mode3",
15708 [ALC663_ASUS_MODE4
] = "asus-mode4",
15709 [ALC663_ASUS_MODE5
] = "asus-mode5",
15710 [ALC663_ASUS_MODE6
] = "asus-mode6",
15711 [ALC662_AUTO
] = "auto",
15714 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
15715 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
15716 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V
),
15717 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
15718 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
15719 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
15720 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1
),
15721 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1
),
15722 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1
),
15723 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1
),
15724 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1
),
15725 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1
),
15726 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1
),
15727 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1
),
15728 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1
),
15729 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1
),
15730 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2
),
15731 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2
),
15732 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2
),
15733 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2
),
15734 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2
),
15735 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2
),
15736 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2
),
15737 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2
),
15738 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2
),
15739 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2
),
15740 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2
),
15741 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2
),
15742 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3
),
15743 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3
),
15744 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3
),
15745 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3
),
15746 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3
),
15747 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4
),
15748 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5
),
15749 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6
),
15750 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6
),
15751 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6
),
15752 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
15753 ALC662_3ST_6ch_DIG
),
15754 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
15755 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS
),
15756 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS
),
15757 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
15758 ALC662_3ST_6ch_DIG
),
15759 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG
),
15760 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
15761 ALC662_3ST_6ch_DIG
),
15762 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13
),
15763 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13
),
15764 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13
),
15768 static struct alc_config_preset alc662_presets
[] = {
15769 [ALC662_3ST_2ch_DIG
] = {
15770 .mixers
= { alc662_3ST_2ch_mixer
, alc662_capture_mixer
},
15771 .init_verbs
= { alc662_init_verbs
},
15772 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15773 .dac_nids
= alc662_dac_nids
,
15774 .dig_out_nid
= ALC662_DIGOUT_NID
,
15775 .dig_in_nid
= ALC662_DIGIN_NID
,
15776 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15777 .channel_mode
= alc662_3ST_2ch_modes
,
15778 .input_mux
= &alc662_capture_source
,
15780 [ALC662_3ST_6ch_DIG
] = {
15781 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
15782 alc662_capture_mixer
},
15783 .init_verbs
= { alc662_init_verbs
},
15784 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15785 .dac_nids
= alc662_dac_nids
,
15786 .dig_out_nid
= ALC662_DIGOUT_NID
,
15787 .dig_in_nid
= ALC662_DIGIN_NID
,
15788 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
15789 .channel_mode
= alc662_3ST_6ch_modes
,
15791 .input_mux
= &alc662_capture_source
,
15793 [ALC662_3ST_6ch
] = {
15794 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
15795 alc662_capture_mixer
},
15796 .init_verbs
= { alc662_init_verbs
},
15797 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15798 .dac_nids
= alc662_dac_nids
,
15799 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
15800 .channel_mode
= alc662_3ST_6ch_modes
,
15802 .input_mux
= &alc662_capture_source
,
15804 [ALC662_5ST_DIG
] = {
15805 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
,
15806 alc662_capture_mixer
},
15807 .init_verbs
= { alc662_init_verbs
},
15808 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15809 .dac_nids
= alc662_dac_nids
,
15810 .dig_out_nid
= ALC662_DIGOUT_NID
,
15811 .dig_in_nid
= ALC662_DIGIN_NID
,
15812 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
15813 .channel_mode
= alc662_5stack_modes
,
15814 .input_mux
= &alc662_capture_source
,
15816 [ALC662_LENOVO_101E
] = {
15817 .mixers
= { alc662_lenovo_101e_mixer
, alc662_capture_mixer
},
15818 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
15819 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15820 .dac_nids
= alc662_dac_nids
,
15821 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15822 .channel_mode
= alc662_3ST_2ch_modes
,
15823 .input_mux
= &alc662_lenovo_101e_capture_source
,
15824 .unsol_event
= alc662_lenovo_101e_unsol_event
,
15825 .init_hook
= alc662_lenovo_101e_all_automute
,
15827 [ALC662_ASUS_EEEPC_P701
] = {
15828 .mixers
= { alc662_eeepc_p701_mixer
, alc662_capture_mixer
},
15829 .init_verbs
= { alc662_init_verbs
,
15830 alc662_eeepc_sue_init_verbs
},
15831 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15832 .dac_nids
= alc662_dac_nids
,
15833 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15834 .channel_mode
= alc662_3ST_2ch_modes
,
15835 .input_mux
= &alc662_eeepc_capture_source
,
15836 .unsol_event
= alc662_eeepc_unsol_event
,
15837 .init_hook
= alc662_eeepc_inithook
,
15839 [ALC662_ASUS_EEEPC_EP20
] = {
15840 .mixers
= { alc662_eeepc_ep20_mixer
, alc662_capture_mixer
,
15841 alc662_chmode_mixer
},
15842 .init_verbs
= { alc662_init_verbs
,
15843 alc662_eeepc_ep20_sue_init_verbs
},
15844 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15845 .dac_nids
= alc662_dac_nids
,
15846 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
15847 .channel_mode
= alc662_3ST_6ch_modes
,
15848 .input_mux
= &alc662_lenovo_101e_capture_source
,
15849 .unsol_event
= alc662_eeepc_ep20_unsol_event
,
15850 .init_hook
= alc662_eeepc_ep20_inithook
,
15853 .mixers
= { alc662_ecs_mixer
, alc662_capture_mixer
},
15854 .init_verbs
= { alc662_init_verbs
,
15855 alc662_ecs_init_verbs
},
15856 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15857 .dac_nids
= alc662_dac_nids
,
15858 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15859 .channel_mode
= alc662_3ST_2ch_modes
,
15860 .input_mux
= &alc662_eeepc_capture_source
,
15861 .unsol_event
= alc662_eeepc_unsol_event
,
15862 .init_hook
= alc662_eeepc_inithook
,
15864 [ALC663_ASUS_M51VA
] = {
15865 .mixers
= { alc663_m51va_mixer
, alc662_capture_mixer
},
15866 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
15867 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15868 .dac_nids
= alc662_dac_nids
,
15869 .dig_out_nid
= ALC662_DIGOUT_NID
,
15870 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15871 .channel_mode
= alc662_3ST_2ch_modes
,
15872 .input_mux
= &alc663_m51va_capture_source
,
15873 .unsol_event
= alc663_m51va_unsol_event
,
15874 .init_hook
= alc663_m51va_inithook
,
15876 [ALC663_ASUS_G71V
] = {
15877 .mixers
= { alc663_g71v_mixer
, alc662_capture_mixer
},
15878 .init_verbs
= { alc662_init_verbs
, alc663_g71v_init_verbs
},
15879 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15880 .dac_nids
= alc662_dac_nids
,
15881 .dig_out_nid
= ALC662_DIGOUT_NID
,
15882 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15883 .channel_mode
= alc662_3ST_2ch_modes
,
15884 .input_mux
= &alc662_eeepc_capture_source
,
15885 .unsol_event
= alc663_g71v_unsol_event
,
15886 .init_hook
= alc663_g71v_inithook
,
15888 [ALC663_ASUS_H13
] = {
15889 .mixers
= { alc663_m51va_mixer
, alc662_capture_mixer
},
15890 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
15891 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15892 .dac_nids
= alc662_dac_nids
,
15893 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15894 .channel_mode
= alc662_3ST_2ch_modes
,
15895 .input_mux
= &alc663_m51va_capture_source
,
15896 .unsol_event
= alc663_m51va_unsol_event
,
15897 .init_hook
= alc663_m51va_inithook
,
15899 [ALC663_ASUS_G50V
] = {
15900 .mixers
= { alc663_g50v_mixer
, alc662_capture_mixer
},
15901 .init_verbs
= { alc662_init_verbs
, alc663_g50v_init_verbs
},
15902 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15903 .dac_nids
= alc662_dac_nids
,
15904 .dig_out_nid
= ALC662_DIGOUT_NID
,
15905 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
15906 .channel_mode
= alc662_3ST_6ch_modes
,
15907 .input_mux
= &alc663_capture_source
,
15908 .unsol_event
= alc663_g50v_unsol_event
,
15909 .init_hook
= alc663_g50v_inithook
,
15911 [ALC663_ASUS_MODE1
] = {
15912 .mixers
= { alc663_m51va_mixer
, alc662_auto_capture_mixer
},
15913 .init_verbs
= { alc662_init_verbs
,
15914 alc663_21jd_amic_init_verbs
},
15915 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15917 .dac_nids
= alc662_dac_nids
,
15918 .dig_out_nid
= ALC662_DIGOUT_NID
,
15919 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15920 .channel_mode
= alc662_3ST_2ch_modes
,
15921 .input_mux
= &alc662_eeepc_capture_source
,
15922 .unsol_event
= alc663_mode1_unsol_event
,
15923 .init_hook
= alc663_mode1_inithook
,
15925 [ALC662_ASUS_MODE2
] = {
15926 .mixers
= { alc662_1bjd_mixer
, alc662_auto_capture_mixer
},
15927 .init_verbs
= { alc662_init_verbs
,
15928 alc662_1bjd_amic_init_verbs
},
15929 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15930 .dac_nids
= alc662_dac_nids
,
15931 .dig_out_nid
= ALC662_DIGOUT_NID
,
15932 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15933 .channel_mode
= alc662_3ST_2ch_modes
,
15934 .input_mux
= &alc662_eeepc_capture_source
,
15935 .unsol_event
= alc662_mode2_unsol_event
,
15936 .init_hook
= alc662_mode2_inithook
,
15938 [ALC663_ASUS_MODE3
] = {
15939 .mixers
= { alc663_two_hp_m1_mixer
, alc662_auto_capture_mixer
},
15940 .init_verbs
= { alc662_init_verbs
,
15941 alc663_two_hp_amic_m1_init_verbs
},
15942 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15944 .dac_nids
= alc662_dac_nids
,
15945 .dig_out_nid
= ALC662_DIGOUT_NID
,
15946 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15947 .channel_mode
= alc662_3ST_2ch_modes
,
15948 .input_mux
= &alc662_eeepc_capture_source
,
15949 .unsol_event
= alc663_mode3_unsol_event
,
15950 .init_hook
= alc663_mode3_inithook
,
15952 [ALC663_ASUS_MODE4
] = {
15953 .mixers
= { alc663_asus_21jd_clfe_mixer
,
15954 alc662_auto_capture_mixer
},
15955 .init_verbs
= { alc662_init_verbs
,
15956 alc663_21jd_amic_init_verbs
},
15957 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15959 .dac_nids
= alc662_dac_nids
,
15960 .dig_out_nid
= ALC662_DIGOUT_NID
,
15961 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15962 .channel_mode
= alc662_3ST_2ch_modes
,
15963 .input_mux
= &alc662_eeepc_capture_source
,
15964 .unsol_event
= alc663_mode4_unsol_event
,
15965 .init_hook
= alc663_mode4_inithook
,
15967 [ALC663_ASUS_MODE5
] = {
15968 .mixers
= { alc663_asus_15jd_clfe_mixer
,
15969 alc662_auto_capture_mixer
},
15970 .init_verbs
= { alc662_init_verbs
,
15971 alc663_15jd_amic_init_verbs
},
15972 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15974 .dac_nids
= alc662_dac_nids
,
15975 .dig_out_nid
= ALC662_DIGOUT_NID
,
15976 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15977 .channel_mode
= alc662_3ST_2ch_modes
,
15978 .input_mux
= &alc662_eeepc_capture_source
,
15979 .unsol_event
= alc663_mode5_unsol_event
,
15980 .init_hook
= alc663_mode5_inithook
,
15982 [ALC663_ASUS_MODE6
] = {
15983 .mixers
= { alc663_two_hp_m2_mixer
, alc662_auto_capture_mixer
},
15984 .init_verbs
= { alc662_init_verbs
,
15985 alc663_two_hp_amic_m2_init_verbs
},
15986 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
15988 .dac_nids
= alc662_dac_nids
,
15989 .dig_out_nid
= ALC662_DIGOUT_NID
,
15990 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
15991 .channel_mode
= alc662_3ST_2ch_modes
,
15992 .input_mux
= &alc662_eeepc_capture_source
,
15993 .unsol_event
= alc663_mode6_unsol_event
,
15994 .init_hook
= alc663_mode6_inithook
,
16000 * BIOS auto configuration
16003 /* add playback controls from the parsed DAC table */
16004 static int alc662_auto_create_multi_out_ctls(struct alc_spec
*spec
,
16005 const struct auto_pin_cfg
*cfg
)
16008 static const char *chname
[4] = {
16009 "Front", "Surround", NULL
/*CLFE*/, "Side"
16014 for (i
= 0; i
< cfg
->line_outs
; i
++) {
16015 if (!spec
->multiout
.dac_nids
[i
])
16017 nid
= alc880_idx_to_dac(i
);
16020 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
16021 "Center Playback Volume",
16022 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
16026 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
16027 "LFE Playback Volume",
16028 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
16032 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
16033 "Center Playback Switch",
16034 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16038 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
16039 "LFE Playback Switch",
16040 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16045 sprintf(name
, "%s Playback Volume", chname
[i
]);
16046 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
16047 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
16051 sprintf(name
, "%s Playback Switch", chname
[i
]);
16052 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
16053 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i
),
16062 /* add playback controls for speaker and HP outputs */
16063 static int alc662_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
16074 /* ALC663 has a mono output pin on 0x17 */
16075 sprintf(name
, "%s Playback Switch", pfx
);
16076 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
16077 HDA_COMPOSE_AMP_VAL(pin
, 2, 0, HDA_OUTPUT
));
16081 if (alc880_is_fixed_pin(pin
)) {
16082 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
16083 /* printk("DAC nid=%x\n",nid); */
16084 /* specify the DAC as the extra output */
16085 if (!spec
->multiout
.hp_nid
)
16086 spec
->multiout
.hp_nid
= nid
;
16088 spec
->multiout
.extra_out_nid
[0] = nid
;
16089 /* control HP volume/switch on the output mixer amp */
16090 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
16091 sprintf(name
, "%s Playback Volume", pfx
);
16092 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
16093 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
16096 sprintf(name
, "%s Playback Switch", pfx
);
16097 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
16098 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
16101 } else if (alc880_is_multi_pin(pin
)) {
16102 /* set manual connection */
16103 /* we have only a switch on HP-out PIN */
16104 sprintf(name
, "%s Playback Switch", pfx
);
16105 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
16106 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
16113 /* create playback/capture controls for input pins */
16114 static int alc662_auto_create_analog_input_ctls(struct alc_spec
*spec
,
16115 const struct auto_pin_cfg
*cfg
)
16117 struct hda_input_mux
*imux
= &spec
->private_imux
;
16120 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
16121 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
16122 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
16123 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
16124 auto_pin_cfg_labels
[i
],
16128 imux
->items
[imux
->num_items
].label
=
16129 auto_pin_cfg_labels
[i
];
16130 imux
->items
[imux
->num_items
].index
=
16131 alc880_input_pin_idx(cfg
->input_pins
[i
]);
16138 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
16139 hda_nid_t nid
, int pin_type
,
16142 alc_set_pin_output(codec
, nid
, pin_type
);
16143 /* need the manual connection? */
16144 if (alc880_is_multi_pin(nid
)) {
16145 struct alc_spec
*spec
= codec
->spec
;
16146 int idx
= alc880_multi_pin_idx(nid
);
16147 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
16148 AC_VERB_SET_CONNECT_SEL
,
16149 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
16153 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
16155 struct alc_spec
*spec
= codec
->spec
;
16158 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
16159 for (i
= 0; i
<= HDA_SIDE
; i
++) {
16160 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
16161 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
16163 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
16168 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
16170 struct alc_spec
*spec
= codec
->spec
;
16173 pin
= spec
->autocfg
.hp_pins
[0];
16174 if (pin
) /* connect to front */
16176 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
16177 pin
= spec
->autocfg
.speaker_pins
[0];
16179 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
16182 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
16183 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16185 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
16187 struct alc_spec
*spec
= codec
->spec
;
16190 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
16191 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
16192 if (alc662_is_input_pin(nid
)) {
16193 snd_hda_codec_write(codec
, nid
, 0,
16194 AC_VERB_SET_PIN_WIDGET_CONTROL
,
16195 (i
<= AUTO_PIN_FRONT_MIC
?
16196 PIN_VREF80
: PIN_IN
));
16197 if (nid
!= ALC662_PIN_CD_NID
)
16198 snd_hda_codec_write(codec
, nid
, 0,
16199 AC_VERB_SET_AMP_GAIN_MUTE
,
16205 #define alc662_auto_init_input_src alc882_auto_init_input_src
16207 static int alc662_parse_auto_config(struct hda_codec
*codec
)
16209 struct alc_spec
*spec
= codec
->spec
;
16211 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
16213 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
16217 if (!spec
->autocfg
.line_outs
)
16218 return 0; /* can't find valid BIOS pin config */
16220 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
16223 err
= alc662_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
16226 err
= alc662_auto_create_extra_out(spec
,
16227 spec
->autocfg
.speaker_pins
[0],
16231 err
= alc662_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
16235 err
= alc662_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
16239 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
16241 if (spec
->autocfg
.dig_out_pin
)
16242 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
16244 if (spec
->kctl_alloc
)
16245 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
16247 spec
->num_mux_defs
= 1;
16248 spec
->input_mux
= &spec
->private_imux
;
16250 spec
->init_verbs
[spec
->num_init_verbs
++] = alc662_auto_init_verbs
;
16251 if (codec
->vendor_id
== 0x10ec0663)
16252 spec
->init_verbs
[spec
->num_init_verbs
++] =
16253 alc663_auto_init_verbs
;
16255 err
= alc_auto_add_mic_boost(codec
);
16259 spec
->mixers
[spec
->num_mixers
] = alc662_capture_mixer
;
16260 spec
->num_mixers
++;
16264 /* additional initialization for auto-configuration model */
16265 static void alc662_auto_init(struct hda_codec
*codec
)
16267 struct alc_spec
*spec
= codec
->spec
;
16268 alc662_auto_init_multi_out(codec
);
16269 alc662_auto_init_hp_out(codec
);
16270 alc662_auto_init_analog_input(codec
);
16271 alc662_auto_init_input_src(codec
);
16272 if (spec
->unsol_event
)
16273 alc_inithook(codec
);
16276 static int patch_alc662(struct hda_codec
*codec
)
16278 struct alc_spec
*spec
;
16279 int err
, board_config
;
16281 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
16285 codec
->spec
= spec
;
16287 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
16289 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
16292 if (board_config
< 0) {
16293 printk(KERN_INFO
"hda_codec: Unknown model for ALC662, "
16294 "trying auto-probe from BIOS...\n");
16295 board_config
= ALC662_AUTO
;
16298 if (board_config
== ALC662_AUTO
) {
16299 /* automatic parse from the BIOS config */
16300 err
= alc662_parse_auto_config(codec
);
16306 "hda_codec: Cannot set up configuration "
16307 "from BIOS. Using base mode...\n");
16308 board_config
= ALC662_3ST_2ch_DIG
;
16312 if (board_config
!= ALC662_AUTO
)
16313 setup_preset(spec
, &alc662_presets
[board_config
]);
16315 if (codec
->vendor_id
== 0x10ec0663) {
16316 spec
->stream_name_analog
= "ALC663 Analog";
16317 spec
->stream_name_digital
= "ALC663 Digital";
16318 } else if (codec
->vendor_id
== 0x10ec0272) {
16319 spec
->stream_name_analog
= "ALC272 Analog";
16320 spec
->stream_name_digital
= "ALC272 Digital";
16322 spec
->stream_name_analog
= "ALC662 Analog";
16323 spec
->stream_name_digital
= "ALC662 Digital";
16326 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
16327 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
16329 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
16330 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
16332 spec
->adc_nids
= alc662_adc_nids
;
16333 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
16334 spec
->capsrc_nids
= alc662_capsrc_nids
;
16336 spec
->vmaster_nid
= 0x02;
16338 codec
->patch_ops
= alc_patch_ops
;
16339 if (board_config
== ALC662_AUTO
)
16340 spec
->init_hook
= alc662_auto_init
;
16341 #ifdef CONFIG_SND_HDA_POWER_SAVE
16342 if (!spec
->loopback
.amplist
)
16343 spec
->loopback
.amplist
= alc662_loopbacks
;
16352 struct hda_codec_preset snd_hda_preset_realtek
[] = {
16353 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
16354 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
16355 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
16356 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
16357 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
16358 { .id
= 0x10ec0272, .name
= "ALC272", .patch
= patch_alc662
},
16359 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
16360 .patch
= patch_alc861
},
16361 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
16362 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
16363 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
16364 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
16365 .patch
= patch_alc883
},
16366 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
16367 .patch
= patch_alc662
},
16368 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
16369 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
16370 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
16371 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
16372 { .id
= 0x10ec0885, .rev
= 0x100101, .name
= "ALC889A",
16373 .patch
= patch_alc882
}, /* should be patch_alc883() in future */
16374 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
16375 .patch
= patch_alc882
}, /* should be patch_alc883() in future */
16376 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
16377 { .id
= 0x10ec0887, .name
= "ALC887", .patch
= patch_alc883
},
16378 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
16379 { .id
= 0x10ec0888, .rev
= 0x100101, .name
= "ALC1200",
16380 .patch
= patch_alc883
},
16381 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc883
},
16382 {} /* terminator */