2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
33 #include "hda_patch.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST
/* last tag */
80 #ifdef CONFIG_SND_DEBUG
84 ALC260_MODEL_LAST
/* last tag */
94 ALC262_HP_BPC_D7000_WL
,
95 ALC262_HP_BPC_D7000_WF
,
105 ALC262_MODEL_LAST
/* last tag */
116 #ifdef CONFIG_SND_DEBUG
120 ALC268_MODEL_LAST
/* last tag */
126 ALC269_ASUS_EEEPC_P703
,
127 ALC269_ASUS_EEEPC_P901
,
129 ALC269_MODEL_LAST
/* last tag */
146 /* ALC861-VD models */
167 ALC662_ASUS_EEEPC_P701
,
168 ALC662_ASUS_EEEPC_EP20
,
200 ALC883_TARGA_2ch_DIG
,
206 ALC883_LENOVO_101E_2ch
,
207 ALC883_LENOVO_NB0763
,
208 ALC888_LENOVO_MS7195_DIG
,
214 ALC883_FUJITSU_PI2515
,
215 ALC883_3ST_6ch_INTEL
,
221 #define GPIO_MASK 0x03
224 /* codec parameterization */
225 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
226 unsigned int num_mixers
;
228 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
232 unsigned int num_init_verbs
;
234 char *stream_name_analog
; /* analog PCM stream */
235 struct hda_pcm_stream
*stream_analog_playback
;
236 struct hda_pcm_stream
*stream_analog_capture
;
237 struct hda_pcm_stream
*stream_analog_alt_playback
;
238 struct hda_pcm_stream
*stream_analog_alt_capture
;
240 char *stream_name_digital
; /* digital PCM stream */
241 struct hda_pcm_stream
*stream_digital_playback
;
242 struct hda_pcm_stream
*stream_digital_capture
;
245 struct hda_multi_out multiout
; /* playback set-up
246 * max_channels, dacs must be set
247 * dig_out_nid and hp_nid are optional
249 hda_nid_t alt_dac_nid
;
252 unsigned int num_adc_nids
;
254 hda_nid_t
*capsrc_nids
;
255 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
258 unsigned int num_mux_defs
;
259 const struct hda_input_mux
*input_mux
;
260 unsigned int cur_mux
[3];
263 const struct hda_channel_mode
*channel_mode
;
264 int num_channel_mode
;
267 /* PCM information */
268 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
270 /* dynamic controls, init_verbs and input_mux */
271 struct auto_pin_cfg autocfg
;
272 unsigned int num_kctl_alloc
, num_kctl_used
;
273 struct snd_kcontrol_new
*kctl_alloc
;
274 struct hda_input_mux private_imux
;
275 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
278 void (*init_hook
)(struct hda_codec
*codec
);
279 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
281 /* for pin sensing */
282 unsigned int sense_updated
: 1;
283 unsigned int jack_present
: 1;
284 unsigned int master_sw
: 1;
286 /* for virtual master */
287 hda_nid_t vmaster_nid
;
288 #ifdef CONFIG_SND_HDA_POWER_SAVE
289 struct hda_loopback_check loopback
;
294 unsigned int pll_coef_idx
, pll_coef_bit
;
298 * configuration template - to be copied to the spec instance
300 struct alc_config_preset
{
301 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
304 const struct hda_verb
*init_verbs
[5];
305 unsigned int num_dacs
;
307 hda_nid_t dig_out_nid
; /* optional */
308 hda_nid_t hp_nid
; /* optional */
309 unsigned int num_adc_nids
;
311 hda_nid_t
*capsrc_nids
;
312 hda_nid_t dig_in_nid
;
313 unsigned int num_channel_mode
;
314 const struct hda_channel_mode
*channel_mode
;
316 unsigned int num_mux_defs
;
317 const struct hda_input_mux
*input_mux
;
318 void (*unsol_event
)(struct hda_codec
*, unsigned int);
319 void (*init_hook
)(struct hda_codec
*);
320 #ifdef CONFIG_SND_HDA_POWER_SAVE
321 struct hda_amp_list
*loopbacks
;
329 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
330 struct snd_ctl_elem_info
*uinfo
)
332 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
333 struct alc_spec
*spec
= codec
->spec
;
334 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
335 if (mux_idx
>= spec
->num_mux_defs
)
337 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
340 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
341 struct snd_ctl_elem_value
*ucontrol
)
343 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
344 struct alc_spec
*spec
= codec
->spec
;
345 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
347 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
351 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
352 struct snd_ctl_elem_value
*ucontrol
)
354 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
355 struct alc_spec
*spec
= codec
->spec
;
356 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
357 unsigned int mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
358 hda_nid_t nid
= spec
->capsrc_nids
?
359 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
360 return snd_hda_input_mux_put(codec
, &spec
->input_mux
[mux_idx
], ucontrol
,
361 nid
, &spec
->cur_mux
[adc_idx
]);
366 * channel mode setting
368 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
369 struct snd_ctl_elem_info
*uinfo
)
371 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
372 struct alc_spec
*spec
= codec
->spec
;
373 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
374 spec
->num_channel_mode
);
377 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
378 struct snd_ctl_elem_value
*ucontrol
)
380 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
381 struct alc_spec
*spec
= codec
->spec
;
382 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
383 spec
->num_channel_mode
,
384 spec
->multiout
.max_channels
);
387 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
388 struct snd_ctl_elem_value
*ucontrol
)
390 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
391 struct alc_spec
*spec
= codec
->spec
;
392 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
393 spec
->num_channel_mode
,
394 &spec
->multiout
.max_channels
);
395 if (err
>= 0 && spec
->need_dac_fix
)
396 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
401 * Control the mode of pin widget settings via the mixer. "pc" is used
402 * instead of "%" to avoid consequences of accidently treating the % as
403 * being part of a format specifier. Maximum allowed length of a value is
404 * 63 characters plus NULL terminator.
406 * Note: some retasking pin complexes seem to ignore requests for input
407 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
408 * are requested. Therefore order this list so that this behaviour will not
409 * cause problems when mixer clients move through the enum sequentially.
410 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
413 static char *alc_pin_mode_names
[] = {
414 "Mic 50pc bias", "Mic 80pc bias",
415 "Line in", "Line out", "Headphone out",
417 static unsigned char alc_pin_mode_values
[] = {
418 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
420 /* The control can present all 5 options, or it can limit the options based
421 * in the pin being assumed to be exclusively an input or an output pin. In
422 * addition, "input" pins may or may not process the mic bias option
423 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
424 * accept requests for bias as of chip versions up to March 2006) and/or
425 * wiring in the computer.
427 #define ALC_PIN_DIR_IN 0x00
428 #define ALC_PIN_DIR_OUT 0x01
429 #define ALC_PIN_DIR_INOUT 0x02
430 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
431 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
433 /* Info about the pin modes supported by the different pin direction modes.
434 * For each direction the minimum and maximum values are given.
436 static signed char alc_pin_mode_dir_info
[5][2] = {
437 { 0, 2 }, /* ALC_PIN_DIR_IN */
438 { 3, 4 }, /* ALC_PIN_DIR_OUT */
439 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
440 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
441 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
443 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
444 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
445 #define alc_pin_mode_n_items(_dir) \
446 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
448 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
449 struct snd_ctl_elem_info
*uinfo
)
451 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
452 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
454 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
456 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
458 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
459 item_num
= alc_pin_mode_min(dir
);
460 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
464 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
465 struct snd_ctl_elem_value
*ucontrol
)
468 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
469 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
470 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
471 long *valp
= ucontrol
->value
.integer
.value
;
472 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
473 AC_VERB_GET_PIN_WIDGET_CONTROL
,
476 /* Find enumerated value for current pinctl setting */
477 i
= alc_pin_mode_min(dir
);
478 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
480 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
484 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
485 struct snd_ctl_elem_value
*ucontrol
)
488 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
489 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
490 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
491 long val
= *ucontrol
->value
.integer
.value
;
492 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
493 AC_VERB_GET_PIN_WIDGET_CONTROL
,
496 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
497 val
= alc_pin_mode_min(dir
);
499 change
= pinctl
!= alc_pin_mode_values
[val
];
501 /* Set pin mode to that requested */
502 snd_hda_codec_write_cache(codec
, nid
, 0,
503 AC_VERB_SET_PIN_WIDGET_CONTROL
,
504 alc_pin_mode_values
[val
]);
506 /* Also enable the retasking pin's input/output as required
507 * for the requested pin mode. Enum values of 2 or less are
510 * Dynamically switching the input/output buffers probably
511 * reduces noise slightly (particularly on input) so we'll
512 * do it. However, having both input and output buffers
513 * enabled simultaneously doesn't seem to be problematic if
514 * this turns out to be necessary in the future.
517 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
518 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
519 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
522 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
523 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
524 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
531 #define ALC_PIN_MODE(xname, nid, dir) \
532 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
533 .info = alc_pin_mode_info, \
534 .get = alc_pin_mode_get, \
535 .put = alc_pin_mode_put, \
536 .private_value = nid | (dir<<16) }
538 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
539 * together using a mask with more than one bit set. This control is
540 * currently used only by the ALC260 test model. At this stage they are not
541 * needed for any "production" models.
543 #ifdef CONFIG_SND_DEBUG
544 #define alc_gpio_data_info snd_ctl_boolean_mono_info
546 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
547 struct snd_ctl_elem_value
*ucontrol
)
549 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
550 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
551 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
552 long *valp
= ucontrol
->value
.integer
.value
;
553 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
554 AC_VERB_GET_GPIO_DATA
, 0x00);
556 *valp
= (val
& mask
) != 0;
559 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
560 struct snd_ctl_elem_value
*ucontrol
)
563 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
564 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
565 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
566 long val
= *ucontrol
->value
.integer
.value
;
567 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
568 AC_VERB_GET_GPIO_DATA
,
571 /* Set/unset the masked GPIO bit(s) as needed */
572 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
577 snd_hda_codec_write_cache(codec
, nid
, 0,
578 AC_VERB_SET_GPIO_DATA
, gpio_data
);
582 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
583 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
584 .info = alc_gpio_data_info, \
585 .get = alc_gpio_data_get, \
586 .put = alc_gpio_data_put, \
587 .private_value = nid | (mask<<16) }
588 #endif /* CONFIG_SND_DEBUG */
590 /* A switch control to allow the enabling of the digital IO pins on the
591 * ALC260. This is incredibly simplistic; the intention of this control is
592 * to provide something in the test model allowing digital outputs to be
593 * identified if present. If models are found which can utilise these
594 * outputs a more complete mixer control can be devised for those models if
597 #ifdef CONFIG_SND_DEBUG
598 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
600 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
601 struct snd_ctl_elem_value
*ucontrol
)
603 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
604 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
605 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
606 long *valp
= ucontrol
->value
.integer
.value
;
607 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
608 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
610 *valp
= (val
& mask
) != 0;
613 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
614 struct snd_ctl_elem_value
*ucontrol
)
617 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
618 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
619 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
620 long val
= *ucontrol
->value
.integer
.value
;
621 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
622 AC_VERB_GET_DIGI_CONVERT_1
,
625 /* Set/unset the masked control bit(s) as needed */
626 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
631 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
636 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
637 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
638 .info = alc_spdif_ctrl_info, \
639 .get = alc_spdif_ctrl_get, \
640 .put = alc_spdif_ctrl_put, \
641 .private_value = nid | (mask<<16) }
642 #endif /* CONFIG_SND_DEBUG */
644 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
645 * Again, this is only used in the ALC26x test models to help identify when
646 * the EAPD line must be asserted for features to work.
648 #ifdef CONFIG_SND_DEBUG
649 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
651 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
652 struct snd_ctl_elem_value
*ucontrol
)
654 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
655 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
656 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
657 long *valp
= ucontrol
->value
.integer
.value
;
658 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
659 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
661 *valp
= (val
& mask
) != 0;
665 static int alc_eapd_ctrl_put(struct snd_kcontrol
*kcontrol
,
666 struct snd_ctl_elem_value
*ucontrol
)
669 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
670 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
671 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
672 long val
= *ucontrol
->value
.integer
.value
;
673 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
674 AC_VERB_GET_EAPD_BTLENABLE
,
677 /* Set/unset the masked control bit(s) as needed */
678 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
683 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
689 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
690 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
691 .info = alc_eapd_ctrl_info, \
692 .get = alc_eapd_ctrl_get, \
693 .put = alc_eapd_ctrl_put, \
694 .private_value = nid | (mask<<16) }
695 #endif /* CONFIG_SND_DEBUG */
698 * set up from the preset table
700 static void setup_preset(struct alc_spec
*spec
,
701 const struct alc_config_preset
*preset
)
705 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
706 spec
->mixers
[spec
->num_mixers
++] = preset
->mixers
[i
];
707 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
709 spec
->init_verbs
[spec
->num_init_verbs
++] =
710 preset
->init_verbs
[i
];
712 spec
->channel_mode
= preset
->channel_mode
;
713 spec
->num_channel_mode
= preset
->num_channel_mode
;
714 spec
->need_dac_fix
= preset
->need_dac_fix
;
716 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
718 spec
->multiout
.num_dacs
= preset
->num_dacs
;
719 spec
->multiout
.dac_nids
= preset
->dac_nids
;
720 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
721 spec
->multiout
.hp_nid
= preset
->hp_nid
;
723 spec
->num_mux_defs
= preset
->num_mux_defs
;
724 if (!spec
->num_mux_defs
)
725 spec
->num_mux_defs
= 1;
726 spec
->input_mux
= preset
->input_mux
;
728 spec
->num_adc_nids
= preset
->num_adc_nids
;
729 spec
->adc_nids
= preset
->adc_nids
;
730 spec
->capsrc_nids
= preset
->capsrc_nids
;
731 spec
->dig_in_nid
= preset
->dig_in_nid
;
733 spec
->unsol_event
= preset
->unsol_event
;
734 spec
->init_hook
= preset
->init_hook
;
735 #ifdef CONFIG_SND_HDA_POWER_SAVE
736 spec
->loopback
.amplist
= preset
->loopbacks
;
740 /* Enable GPIO mask and set output */
741 static struct hda_verb alc_gpio1_init_verbs
[] = {
742 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
743 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
744 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
748 static struct hda_verb alc_gpio2_init_verbs
[] = {
749 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
750 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
751 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
755 static struct hda_verb alc_gpio3_init_verbs
[] = {
756 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
757 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
758 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
763 * Fix hardware PLL issue
764 * On some codecs, the analog PLL gating control must be off while
765 * the default value is 1.
767 static void alc_fix_pll(struct hda_codec
*codec
)
769 struct alc_spec
*spec
= codec
->spec
;
774 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
776 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
777 AC_VERB_GET_PROC_COEF
, 0);
778 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
780 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
781 val
& ~(1 << spec
->pll_coef_bit
));
784 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
785 unsigned int coef_idx
, unsigned int coef_bit
)
787 struct alc_spec
*spec
= codec
->spec
;
789 spec
->pll_coef_idx
= coef_idx
;
790 spec
->pll_coef_bit
= coef_bit
;
794 static void alc_sku_automute(struct hda_codec
*codec
)
796 struct alc_spec
*spec
= codec
->spec
;
797 unsigned int present
;
798 unsigned int hp_nid
= spec
->autocfg
.hp_pins
[0];
799 unsigned int sp_nid
= spec
->autocfg
.speaker_pins
[0];
801 /* need to execute and sync at first */
802 snd_hda_codec_read(codec
, hp_nid
, 0, AC_VERB_SET_PIN_SENSE
, 0);
803 present
= snd_hda_codec_read(codec
, hp_nid
, 0,
804 AC_VERB_GET_PIN_SENSE
, 0);
805 spec
->jack_present
= (present
& 0x80000000) != 0;
806 snd_hda_codec_write(codec
, sp_nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
807 spec
->jack_present
? 0 : PIN_OUT
);
810 /* unsolicited event for HP jack sensing */
811 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
813 if (codec
->vendor_id
== 0x10ec0880)
817 if (res
!= ALC880_HP_EVENT
)
820 alc_sku_automute(codec
);
823 /* additional initialization for ALC888 variants */
824 static void alc888_coef_init(struct hda_codec
*codec
)
828 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
829 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
830 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
831 if ((tmp
& 0xf0) == 2)
833 snd_hda_codec_read(codec
, 0x20, 0,
834 AC_VERB_SET_PROC_COEF
, 0x830);
837 snd_hda_codec_read(codec
, 0x20, 0,
838 AC_VERB_SET_PROC_COEF
, 0x3030);
841 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
842 * 31 ~ 16 : Manufacture ID
844 * 7 ~ 0 : Assembly ID
845 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
847 static void alc_subsystem_id(struct hda_codec
*codec
,
848 unsigned int porta
, unsigned int porte
,
851 unsigned int ass
, tmp
, i
;
853 struct alc_spec
*spec
= codec
->spec
;
855 ass
= codec
->subsystem_id
& 0xffff;
856 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
860 * 31~30 : port conetcivity
863 * 19~16 : Check sum (15:1)
868 if (codec
->vendor_id
== 0x10ec0260)
870 ass
= snd_hda_codec_read(codec
, nid
, 0,
871 AC_VERB_GET_CONFIG_DEFAULT
, 0);
872 if (!(ass
& 1) && !(ass
& 0x100000))
874 if ((ass
>> 30) != 1) /* no physical connection */
879 for (i
= 1; i
< 16; i
++) {
883 if (((ass
>> 16) & 0xf) != tmp
)
889 * 2 : 0 --> Desktop, 1 --> Laptop
890 * 3~5 : External Amplifier control
893 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
896 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
899 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
902 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
904 case 5: /* set EAPD output high */
905 switch (codec
->vendor_id
) {
907 snd_hda_codec_write(codec
, 0x0f, 0,
908 AC_VERB_SET_EAPD_BTLENABLE
, 2);
909 snd_hda_codec_write(codec
, 0x10, 0,
910 AC_VERB_SET_EAPD_BTLENABLE
, 2);
921 snd_hda_codec_write(codec
, 0x14, 0,
922 AC_VERB_SET_EAPD_BTLENABLE
, 2);
923 snd_hda_codec_write(codec
, 0x15, 0,
924 AC_VERB_SET_EAPD_BTLENABLE
, 2);
927 switch (codec
->vendor_id
) {
929 snd_hda_codec_write(codec
, 0x1a, 0,
930 AC_VERB_SET_COEF_INDEX
, 7);
931 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
932 AC_VERB_GET_PROC_COEF
, 0);
933 snd_hda_codec_write(codec
, 0x1a, 0,
934 AC_VERB_SET_COEF_INDEX
, 7);
935 snd_hda_codec_write(codec
, 0x1a, 0,
936 AC_VERB_SET_PROC_COEF
,
945 snd_hda_codec_write(codec
, 0x20, 0,
946 AC_VERB_SET_COEF_INDEX
, 7);
947 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
948 AC_VERB_GET_PROC_COEF
, 0);
949 snd_hda_codec_write(codec
, 0x20, 0,
950 AC_VERB_SET_COEF_INDEX
, 7);
951 snd_hda_codec_write(codec
, 0x20, 0,
952 AC_VERB_SET_PROC_COEF
,
956 /*alc888_coef_init(codec);*/ /* called in alc_init() */
960 snd_hda_codec_write(codec
, 0x20, 0,
961 AC_VERB_SET_COEF_INDEX
, 7);
962 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
963 AC_VERB_GET_PROC_COEF
, 0);
964 snd_hda_codec_write(codec
, 0x20, 0,
965 AC_VERB_SET_COEF_INDEX
, 7);
966 snd_hda_codec_write(codec
, 0x20, 0,
967 AC_VERB_SET_PROC_COEF
,
975 /* is laptop or Desktop and enable the function "Mute internal speaker
976 * when the external headphone out jack is plugged"
981 * 10~8 : Jack location
982 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
984 * 15 : 1 --> enable the function "Mute internal speaker
985 * when the external headphone out jack is plugged"
987 if (!spec
->autocfg
.speaker_pins
[0]) {
988 if (spec
->autocfg
.line_out_pins
[0])
989 spec
->autocfg
.speaker_pins
[0] =
990 spec
->autocfg
.line_out_pins
[0];
995 if (!spec
->autocfg
.hp_pins
[0]) {
996 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
998 spec
->autocfg
.hp_pins
[0] = porta
;
1000 spec
->autocfg
.hp_pins
[0] = porte
;
1002 spec
->autocfg
.hp_pins
[0] = portd
;
1007 snd_hda_codec_write(codec
, spec
->autocfg
.hp_pins
[0], 0,
1008 AC_VERB_SET_UNSOLICITED_ENABLE
,
1009 AC_USRSP_EN
| ALC880_HP_EVENT
);
1010 spec
->unsol_event
= alc_sku_unsol_event
;
1014 * Fix-up pin default configurations
1022 static void alc_fix_pincfg(struct hda_codec
*codec
,
1023 const struct snd_pci_quirk
*quirk
,
1024 const struct alc_pincfg
**pinfix
)
1026 const struct alc_pincfg
*cfg
;
1028 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
1032 cfg
= pinfix
[quirk
->value
];
1033 for (; cfg
->nid
; cfg
++) {
1036 for (i
= 0; i
< 4; i
++) {
1037 snd_hda_codec_write(codec
, cfg
->nid
, 0,
1038 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
+ i
,
1046 * ALC880 3-stack model
1048 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1049 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1050 * F-Mic = 0x1b, HP = 0x19
1053 static hda_nid_t alc880_dac_nids
[4] = {
1054 /* front, rear, clfe, rear_surr */
1055 0x02, 0x05, 0x04, 0x03
1058 static hda_nid_t alc880_adc_nids
[3] = {
1063 /* The datasheet says the node 0x07 is connected from inputs,
1064 * but it shows zero connection in the real implementation on some devices.
1065 * Note: this is a 915GAV bug, fixed on 915GLV
1067 static hda_nid_t alc880_adc_nids_alt
[2] = {
1072 #define ALC880_DIGOUT_NID 0x06
1073 #define ALC880_DIGIN_NID 0x0a
1075 static struct hda_input_mux alc880_capture_source
= {
1079 { "Front Mic", 0x3 },
1085 /* channel source setting (2/6 channel selection for 3-stack) */
1087 static struct hda_verb alc880_threestack_ch2_init
[] = {
1088 /* set line-in to input, mute it */
1089 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1090 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1091 /* set mic-in to input vref 80%, mute it */
1092 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1093 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1098 static struct hda_verb alc880_threestack_ch6_init
[] = {
1099 /* set line-in to output, unmute it */
1100 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1101 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1102 /* set mic-in to output, unmute it */
1103 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1104 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1108 static struct hda_channel_mode alc880_threestack_modes
[2] = {
1109 { 2, alc880_threestack_ch2_init
},
1110 { 6, alc880_threestack_ch6_init
},
1113 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
1114 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1115 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1116 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1117 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
1118 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1119 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1120 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1121 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1124 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1125 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1127 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1128 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
1129 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
1130 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1131 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1132 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
1134 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1135 .name
= "Channel Mode",
1136 .info
= alc_ch_mode_info
,
1137 .get
= alc_ch_mode_get
,
1138 .put
= alc_ch_mode_put
,
1143 /* capture mixer elements */
1144 static struct snd_kcontrol_new alc880_capture_mixer
[] = {
1145 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
1146 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
1147 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
1148 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
1149 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
1150 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
1152 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1153 /* The multiple "Capture Source" controls confuse alsamixer
1154 * So call somewhat different..
1156 /* .name = "Capture Source", */
1157 .name
= "Input Source",
1159 .info
= alc_mux_enum_info
,
1160 .get
= alc_mux_enum_get
,
1161 .put
= alc_mux_enum_put
,
1166 /* capture mixer elements (in case NID 0x07 not available) */
1167 static struct snd_kcontrol_new alc880_capture_alt_mixer
[] = {
1168 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1169 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1170 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
1171 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
1173 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1174 /* The multiple "Capture Source" controls confuse alsamixer
1175 * So call somewhat different..
1177 /* .name = "Capture Source", */
1178 .name
= "Input Source",
1180 .info
= alc_mux_enum_info
,
1181 .get
= alc_mux_enum_get
,
1182 .put
= alc_mux_enum_put
,
1190 * ALC880 5-stack model
1192 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1194 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1195 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1198 /* additional mixers to alc880_three_stack_mixer */
1199 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
1200 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1201 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
1205 /* channel source setting (6/8 channel selection for 5-stack) */
1207 static struct hda_verb alc880_fivestack_ch6_init
[] = {
1208 /* set line-in to input, mute it */
1209 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1210 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1215 static struct hda_verb alc880_fivestack_ch8_init
[] = {
1216 /* set line-in to output, unmute it */
1217 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1218 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1222 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
1223 { 6, alc880_fivestack_ch6_init
},
1224 { 8, alc880_fivestack_ch8_init
},
1229 * ALC880 6-stack model
1231 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1232 * Side = 0x05 (0x0f)
1233 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1234 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1237 static hda_nid_t alc880_6st_dac_nids
[4] = {
1238 /* front, rear, clfe, rear_surr */
1239 0x02, 0x03, 0x04, 0x05
1242 static struct hda_input_mux alc880_6stack_capture_source
= {
1246 { "Front Mic", 0x1 },
1252 /* fixed 8-channels */
1253 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
1257 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
1258 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1259 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1260 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1261 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1262 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1263 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1264 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1265 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1266 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1267 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1268 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1269 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1270 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1271 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1274 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1275 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1276 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1277 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1279 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1280 .name
= "Channel Mode",
1281 .info
= alc_ch_mode_info
,
1282 .get
= alc_ch_mode_get
,
1283 .put
= alc_ch_mode_put
,
1292 * W810 has rear IO for:
1295 * Center/LFE (DAC 04)
1298 * The system also has a pair of internal speakers, and a headphone jack.
1299 * These are both connected to Line2 on the codec, hence to DAC 02.
1301 * There is a variable resistor to control the speaker or headphone
1302 * volume. This is a hardware-only device without a software API.
1304 * Plugging headphones in will disable the internal speakers. This is
1305 * implemented in hardware, not via the driver using jack sense. In
1306 * a similar fashion, plugging into the rear socket marked "front" will
1307 * disable both the speakers and headphones.
1309 * For input, there's a microphone jack, and an "audio in" jack.
1310 * These may not do anything useful with this driver yet, because I
1311 * haven't setup any initialization verbs for these yet...
1314 static hda_nid_t alc880_w810_dac_nids
[3] = {
1315 /* front, rear/surround, clfe */
1319 /* fixed 6 channels */
1320 static struct hda_channel_mode alc880_w810_modes
[1] = {
1324 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1325 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
1326 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1327 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1328 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1329 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1330 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1331 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1332 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1333 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1334 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1342 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1343 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1347 static hda_nid_t alc880_z71v_dac_nids
[1] = {
1350 #define ALC880_Z71V_HP_DAC 0x03
1352 /* fixed 2 channels */
1353 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
1357 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
1358 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1359 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1360 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1361 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
1362 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1363 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1364 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1365 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1371 * ALC880 F1734 model
1373 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1374 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1377 static hda_nid_t alc880_f1734_dac_nids
[1] = {
1380 #define ALC880_F1734_HP_DAC 0x02
1382 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
1383 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1384 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1385 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1386 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1394 static struct hda_input_mux alc880_f1734_capture_source
= {
1406 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1407 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1408 * Mic = 0x18, Line = 0x1a
1411 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1412 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1414 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
1415 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1416 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1417 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1418 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1419 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1420 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1421 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1422 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1423 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1424 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1425 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1426 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1427 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1428 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1430 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1431 .name
= "Channel Mode",
1432 .info
= alc_ch_mode_info
,
1433 .get
= alc_ch_mode_get
,
1434 .put
= alc_ch_mode_put
,
1440 * ALC880 ASUS W1V model
1442 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1443 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1444 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1447 /* additional mixers to alc880_asus_mixer */
1448 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
1449 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
1450 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
1454 /* additional mixers to alc880_asus_mixer */
1455 static struct snd_kcontrol_new alc880_pcbeep_mixer
[] = {
1456 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1457 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1462 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
1463 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1464 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1465 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
1466 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
1467 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
1468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
1469 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
1470 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1471 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1473 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1474 /* The multiple "Capture Source" controls confuse alsamixer
1475 * So call somewhat different..
1477 /* .name = "Capture Source", */
1478 .name
= "Input Source",
1480 .info
= alc_mux_enum_info
,
1481 .get
= alc_mux_enum_get
,
1482 .put
= alc_mux_enum_put
,
1488 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
1489 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1490 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1491 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1492 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1493 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1494 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1495 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1496 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1497 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1498 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1499 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1500 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1502 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1503 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1504 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1505 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1506 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1508 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1509 .name
= "Channel Mode",
1510 .info
= alc_ch_mode_info
,
1511 .get
= alc_ch_mode_get
,
1512 .put
= alc_ch_mode_put
,
1517 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
1518 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1519 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1520 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1521 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1522 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1523 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1524 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1525 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1526 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1527 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1531 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
1532 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1533 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1534 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1535 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1537 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1542 * virtual master controls
1546 * slave controls for virtual master
1548 static const char *alc_slave_vols
[] = {
1549 "Front Playback Volume",
1550 "Surround Playback Volume",
1551 "Center Playback Volume",
1552 "LFE Playback Volume",
1553 "Side Playback Volume",
1554 "Headphone Playback Volume",
1555 "Speaker Playback Volume",
1556 "Mono Playback Volume",
1557 "Line-Out Playback Volume",
1561 static const char *alc_slave_sws
[] = {
1562 "Front Playback Switch",
1563 "Surround Playback Switch",
1564 "Center Playback Switch",
1565 "LFE Playback Switch",
1566 "Side Playback Switch",
1567 "Headphone Playback Switch",
1568 "Speaker Playback Switch",
1569 "Mono Playback Switch",
1570 "IEC958 Playback Switch",
1575 * build control elements
1577 static int alc_build_controls(struct hda_codec
*codec
)
1579 struct alc_spec
*spec
= codec
->spec
;
1583 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1584 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1589 if (spec
->multiout
.dig_out_nid
) {
1590 err
= snd_hda_create_spdif_out_ctls(codec
,
1591 spec
->multiout
.dig_out_nid
);
1594 err
= snd_hda_create_spdif_share_sw(codec
,
1598 spec
->multiout
.share_spdif
= 1;
1600 if (spec
->dig_in_nid
) {
1601 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1606 /* if we have no master control, let's create it */
1607 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
1608 unsigned int vmaster_tlv
[4];
1609 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
1610 HDA_OUTPUT
, vmaster_tlv
);
1611 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
1612 vmaster_tlv
, alc_slave_vols
);
1616 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
1617 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
1618 NULL
, alc_slave_sws
);
1628 * initialize the codec volumes, etc
1632 * generic initialization of ADC, input mixers and output mixers
1634 static struct hda_verb alc880_volume_init_verbs
[] = {
1636 * Unmute ADC0-2 and set the default input to mic-in
1638 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
1639 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1640 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
1641 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1642 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
1643 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1645 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1647 * Note: PASD motherboards uses the Line In 2 as the input for front
1650 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1651 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1652 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1653 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
1654 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
1655 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
1656 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
1657 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
1660 * Set up output mixers (0x0c - 0x0f)
1662 /* set vol=0 to output mixers */
1663 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1664 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1665 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1667 /* set up input amps for analog loopback */
1668 /* Amp Indices: DAC = 0, mixer = 1 */
1669 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1670 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1671 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1672 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1673 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1674 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1675 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1676 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1682 * 3-stack pin configuration:
1683 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1685 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
1687 * preset connection lists of input pins
1688 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1690 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
1691 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1692 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
1695 * Set pin mode and muting
1697 /* set front pin widgets 0x14 for output */
1698 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1699 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1700 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1701 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1702 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1703 /* Mic2 (as headphone out) for HP output */
1704 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1705 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1706 /* Line In pin widget for input */
1707 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1708 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1709 /* Line2 (as front mic) pin widget for input and vref at 80% */
1710 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1711 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1712 /* CD pin widget for input */
1713 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1719 * 5-stack pin configuration:
1720 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1721 * line-in/side = 0x1a, f-mic = 0x1b
1723 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
1725 * preset connection lists of input pins
1726 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1728 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1729 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
1732 * Set pin mode and muting
1734 /* set pin widgets 0x14-0x17 for output */
1735 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1736 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1737 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1738 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1739 /* unmute pins for output (no gain on this amp) */
1740 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1741 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1742 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1743 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1745 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1746 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1747 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1748 /* Mic2 (as headphone out) for HP output */
1749 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1751 /* Line In pin widget for input */
1752 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1754 /* Line2 (as front mic) pin widget for input and vref at 80% */
1755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1756 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1757 /* CD pin widget for input */
1758 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1764 * W810 pin configuration:
1765 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1767 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
1768 /* hphone/speaker input selector: front DAC */
1769 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
1771 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1773 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1774 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1775 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1776 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1778 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1779 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1785 * Z71V pin configuration:
1786 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1788 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
1789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1790 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1791 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1794 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1795 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1796 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1797 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1803 * 6-stack pin configuration:
1804 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1805 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1807 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
1808 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1810 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1811 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1812 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1813 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1814 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1815 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1816 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1817 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1819 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1820 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1821 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1822 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1823 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1824 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1825 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1826 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1827 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1833 * Uniwill pin configuration:
1834 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1837 static struct hda_verb alc880_uniwill_init_verbs
[] = {
1838 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1840 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1841 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1842 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1843 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1844 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1845 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1846 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1847 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1848 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1850 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1851 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1852 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1853 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1855 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1856 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1857 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1858 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1859 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1860 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1861 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1862 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1863 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1865 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
1873 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1875 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
1876 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1880 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1881 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1882 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1883 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1884 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1885 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1886 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1887 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1888 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1889 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1891 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1892 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1893 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1894 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1895 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1896 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1898 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1899 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
1904 static struct hda_verb alc880_beep_init_verbs
[] = {
1905 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
1909 /* toggle speaker-output according to the hp-jack state */
1910 static void alc880_uniwill_hp_automute(struct hda_codec
*codec
)
1912 unsigned int present
;
1915 present
= snd_hda_codec_read(codec
, 0x14, 0,
1916 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1917 bits
= present
? HDA_AMP_MUTE
: 0;
1918 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
1919 HDA_AMP_MUTE
, bits
);
1920 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
1921 HDA_AMP_MUTE
, bits
);
1924 /* auto-toggle front mic */
1925 static void alc880_uniwill_mic_automute(struct hda_codec
*codec
)
1927 unsigned int present
;
1930 present
= snd_hda_codec_read(codec
, 0x18, 0,
1931 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1932 bits
= present
? HDA_AMP_MUTE
: 0;
1933 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
1936 static void alc880_uniwill_automute(struct hda_codec
*codec
)
1938 alc880_uniwill_hp_automute(codec
);
1939 alc880_uniwill_mic_automute(codec
);
1942 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
1945 /* Looks like the unsol event is incompatible with the standard
1946 * definition. 4bit tag is placed at 28 bit!
1948 switch (res
>> 28) {
1949 case ALC880_HP_EVENT
:
1950 alc880_uniwill_hp_automute(codec
);
1952 case ALC880_MIC_EVENT
:
1953 alc880_uniwill_mic_automute(codec
);
1958 static void alc880_uniwill_p53_hp_automute(struct hda_codec
*codec
)
1960 unsigned int present
;
1963 present
= snd_hda_codec_read(codec
, 0x14, 0,
1964 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1965 bits
= present
? HDA_AMP_MUTE
: 0;
1966 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0, HDA_AMP_MUTE
, bits
);
1969 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
1971 unsigned int present
;
1973 present
= snd_hda_codec_read(codec
, 0x21, 0,
1974 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
1975 present
&= HDA_AMP_VOLMASK
;
1976 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
1977 HDA_AMP_VOLMASK
, present
);
1978 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
1979 HDA_AMP_VOLMASK
, present
);
1982 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
1985 /* Looks like the unsol event is incompatible with the standard
1986 * definition. 4bit tag is placed at 28 bit!
1988 if ((res
>> 28) == ALC880_HP_EVENT
)
1989 alc880_uniwill_p53_hp_automute(codec
);
1990 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
1991 alc880_uniwill_p53_dcvol_automute(codec
);
1995 * F1734 pin configuration:
1996 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1998 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
1999 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
2000 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2001 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2002 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2003 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2007 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2010 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2011 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2012 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
2013 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2014 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2015 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2016 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2017 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2018 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2020 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
2021 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
2027 * ASUS pin configuration:
2028 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2030 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
2031 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2032 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2033 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2034 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2036 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2037 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2038 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2039 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2040 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2041 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2042 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2043 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2045 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2046 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2047 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2048 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2049 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2050 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2051 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2052 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2053 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2058 /* Enable GPIO mask and set output */
2059 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2060 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2062 /* Clevo m520g init */
2063 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
2064 /* headphone output */
2065 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2067 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2068 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2070 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2071 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2073 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2074 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2075 /* Mic1 (rear panel) */
2076 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2077 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2078 /* Mic2 (front panel) */
2079 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2080 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2082 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2083 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2084 /* change to EAPD mode */
2085 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2086 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2091 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
2092 /* change to EAPD mode */
2093 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2094 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2096 /* Headphone output */
2097 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2099 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2100 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
2102 /* Line In pin widget for input */
2103 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2104 /* CD pin widget for input */
2105 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2106 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2107 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2109 /* change to EAPD mode */
2110 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2111 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
2117 * LG m1 express dual
2120 * Rear Line-In/Out (blue): 0x14
2121 * Build-in Mic-In: 0x15
2123 * HP-Out (green): 0x1b
2124 * Mic-In/Out (red): 0x19
2128 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2129 static hda_nid_t alc880_lg_dac_nids
[3] = {
2133 /* seems analog CD is not working */
2134 static struct hda_input_mux alc880_lg_capture_source
= {
2139 { "Internal Mic", 0x6 },
2143 /* 2,4,6 channel modes */
2144 static struct hda_verb alc880_lg_ch2_init
[] = {
2145 /* set line-in and mic-in to input */
2146 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2147 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2151 static struct hda_verb alc880_lg_ch4_init
[] = {
2152 /* set line-in to out and mic-in to input */
2153 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2154 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2158 static struct hda_verb alc880_lg_ch6_init
[] = {
2159 /* set line-in and mic-in to output */
2160 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2161 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2165 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
2166 { 2, alc880_lg_ch2_init
},
2167 { 4, alc880_lg_ch4_init
},
2168 { 6, alc880_lg_ch6_init
},
2171 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
2172 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2173 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
2174 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2175 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
2176 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
2177 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
2178 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
2179 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
2180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2181 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2182 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
2183 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
2184 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
2185 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
2187 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2188 .name
= "Channel Mode",
2189 .info
= alc_ch_mode_info
,
2190 .get
= alc_ch_mode_get
,
2191 .put
= alc_ch_mode_put
,
2196 static struct hda_verb alc880_lg_init_verbs
[] = {
2197 /* set capture source to mic-in */
2198 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2199 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2200 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2201 /* mute all amp mixer inputs */
2202 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
2203 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2204 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2205 /* line-in to input */
2206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2207 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2209 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2210 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2212 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2213 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2214 /* mic-in to input */
2215 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2216 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2217 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2219 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
2220 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2221 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2223 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2227 /* toggle speaker-output according to the hp-jack state */
2228 static void alc880_lg_automute(struct hda_codec
*codec
)
2230 unsigned int present
;
2233 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2234 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2235 bits
= present
? HDA_AMP_MUTE
: 0;
2236 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
2237 HDA_AMP_MUTE
, bits
);
2240 static void alc880_lg_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2242 /* Looks like the unsol event is incompatible with the standard
2243 * definition. 4bit tag is placed at 28 bit!
2245 if ((res
>> 28) == 0x01)
2246 alc880_lg_automute(codec
);
2255 * Built-in Mic-In: 0x19
2261 static struct hda_input_mux alc880_lg_lw_capture_source
= {
2265 { "Internal Mic", 0x1 },
2270 #define alc880_lg_lw_modes alc880_threestack_modes
2272 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
2273 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2274 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2275 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2276 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2277 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2278 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2279 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2280 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2281 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2282 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2283 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2284 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2285 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
2286 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
2288 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2289 .name
= "Channel Mode",
2290 .info
= alc_ch_mode_info
,
2291 .get
= alc_ch_mode_get
,
2292 .put
= alc_ch_mode_put
,
2297 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
2298 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2299 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2300 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2302 /* set capture source to mic-in */
2303 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2305 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2309 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2311 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2312 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2313 /* mic-in to input */
2314 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2315 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2317 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2318 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2320 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2324 /* toggle speaker-output according to the hp-jack state */
2325 static void alc880_lg_lw_automute(struct hda_codec
*codec
)
2327 unsigned int present
;
2330 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2331 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2332 bits
= present
? HDA_AMP_MUTE
: 0;
2333 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
2334 HDA_AMP_MUTE
, bits
);
2337 static void alc880_lg_lw_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2339 /* Looks like the unsol event is incompatible with the standard
2340 * definition. 4bit tag is placed at 28 bit!
2342 if ((res
>> 28) == 0x01)
2343 alc880_lg_lw_automute(codec
);
2346 static struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
2347 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2348 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
2349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2350 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2351 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2352 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2356 static struct hda_input_mux alc880_medion_rim_capture_source
= {
2360 { "Internal Mic", 0x1 },
2364 static struct hda_verb alc880_medion_rim_init_verbs
[] = {
2365 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2367 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2368 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2370 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2371 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2372 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2373 /* Mic2 (as headphone out) for HP output */
2374 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2376 /* Internal Speaker */
2377 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2378 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2380 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2381 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2383 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2387 /* toggle speaker-output according to the hp-jack state */
2388 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
2390 unsigned int present
;
2393 present
= snd_hda_codec_read(codec
, 0x14, 0,
2394 AC_VERB_GET_PIN_SENSE
, 0)
2395 & AC_PINSENSE_PRESENCE
;
2396 bits
= present
? HDA_AMP_MUTE
: 0;
2397 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
2398 HDA_AMP_MUTE
, bits
);
2400 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
2402 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
2405 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
2408 /* Looks like the unsol event is incompatible with the standard
2409 * definition. 4bit tag is placed at 28 bit!
2411 if ((res
>> 28) == ALC880_HP_EVENT
)
2412 alc880_medion_rim_automute(codec
);
2415 #ifdef CONFIG_SND_HDA_POWER_SAVE
2416 static struct hda_amp_list alc880_loopbacks
[] = {
2417 { 0x0b, HDA_INPUT
, 0 },
2418 { 0x0b, HDA_INPUT
, 1 },
2419 { 0x0b, HDA_INPUT
, 2 },
2420 { 0x0b, HDA_INPUT
, 3 },
2421 { 0x0b, HDA_INPUT
, 4 },
2425 static struct hda_amp_list alc880_lg_loopbacks
[] = {
2426 { 0x0b, HDA_INPUT
, 1 },
2427 { 0x0b, HDA_INPUT
, 6 },
2428 { 0x0b, HDA_INPUT
, 7 },
2437 static int alc_init(struct hda_codec
*codec
)
2439 struct alc_spec
*spec
= codec
->spec
;
2443 if (codec
->vendor_id
== 0x10ec0888)
2444 alc888_coef_init(codec
);
2446 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
2447 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
2449 if (spec
->init_hook
)
2450 spec
->init_hook(codec
);
2455 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2457 struct alc_spec
*spec
= codec
->spec
;
2459 if (spec
->unsol_event
)
2460 spec
->unsol_event(codec
, res
);
2463 #ifdef CONFIG_SND_HDA_POWER_SAVE
2464 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
2466 struct alc_spec
*spec
= codec
->spec
;
2467 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
2472 * Analog playback callbacks
2474 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2475 struct hda_codec
*codec
,
2476 struct snd_pcm_substream
*substream
)
2478 struct alc_spec
*spec
= codec
->spec
;
2479 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
2483 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2484 struct hda_codec
*codec
,
2485 unsigned int stream_tag
,
2486 unsigned int format
,
2487 struct snd_pcm_substream
*substream
)
2489 struct alc_spec
*spec
= codec
->spec
;
2490 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
2491 stream_tag
, format
, substream
);
2494 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2495 struct hda_codec
*codec
,
2496 struct snd_pcm_substream
*substream
)
2498 struct alc_spec
*spec
= codec
->spec
;
2499 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2505 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2506 struct hda_codec
*codec
,
2507 struct snd_pcm_substream
*substream
)
2509 struct alc_spec
*spec
= codec
->spec
;
2510 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2513 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2514 struct hda_codec
*codec
,
2515 unsigned int stream_tag
,
2516 unsigned int format
,
2517 struct snd_pcm_substream
*substream
)
2519 struct alc_spec
*spec
= codec
->spec
;
2520 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2521 stream_tag
, format
, substream
);
2524 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2525 struct hda_codec
*codec
,
2526 struct snd_pcm_substream
*substream
)
2528 struct alc_spec
*spec
= codec
->spec
;
2529 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2535 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2536 struct hda_codec
*codec
,
2537 unsigned int stream_tag
,
2538 unsigned int format
,
2539 struct snd_pcm_substream
*substream
)
2541 struct alc_spec
*spec
= codec
->spec
;
2543 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
2544 stream_tag
, 0, format
);
2548 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2549 struct hda_codec
*codec
,
2550 struct snd_pcm_substream
*substream
)
2552 struct alc_spec
*spec
= codec
->spec
;
2554 snd_hda_codec_cleanup_stream(codec
,
2555 spec
->adc_nids
[substream
->number
+ 1]);
2562 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
2566 /* NID is set in alc_build_pcms */
2568 .open
= alc880_playback_pcm_open
,
2569 .prepare
= alc880_playback_pcm_prepare
,
2570 .cleanup
= alc880_playback_pcm_cleanup
2574 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
2578 /* NID is set in alc_build_pcms */
2581 static struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
2585 /* NID is set in alc_build_pcms */
2588 static struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
2589 .substreams
= 2, /* can be overridden */
2592 /* NID is set in alc_build_pcms */
2594 .prepare
= alc880_alt_capture_pcm_prepare
,
2595 .cleanup
= alc880_alt_capture_pcm_cleanup
2599 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
2603 /* NID is set in alc_build_pcms */
2605 .open
= alc880_dig_playback_pcm_open
,
2606 .close
= alc880_dig_playback_pcm_close
,
2607 .prepare
= alc880_dig_playback_pcm_prepare
2611 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
2615 /* NID is set in alc_build_pcms */
2618 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2619 static struct hda_pcm_stream alc_pcm_null_stream
= {
2625 static int alc_build_pcms(struct hda_codec
*codec
)
2627 struct alc_spec
*spec
= codec
->spec
;
2628 struct hda_pcm
*info
= spec
->pcm_rec
;
2631 codec
->num_pcms
= 1;
2632 codec
->pcm_info
= info
;
2634 info
->name
= spec
->stream_name_analog
;
2635 if (spec
->stream_analog_playback
) {
2636 if (snd_BUG_ON(!spec
->multiout
.dac_nids
))
2638 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
2639 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
2641 if (spec
->stream_analog_capture
) {
2642 if (snd_BUG_ON(!spec
->adc_nids
))
2644 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
2645 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
2648 if (spec
->channel_mode
) {
2649 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
2650 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
2651 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
2652 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
2657 /* SPDIF for stream index #1 */
2658 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2659 codec
->num_pcms
= 2;
2660 info
= spec
->pcm_rec
+ 1;
2661 info
->name
= spec
->stream_name_digital
;
2662 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
2663 if (spec
->multiout
.dig_out_nid
&&
2664 spec
->stream_digital_playback
) {
2665 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
2666 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2668 if (spec
->dig_in_nid
&&
2669 spec
->stream_digital_capture
) {
2670 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
2671 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2673 /* FIXME: do we need this for all Realtek codec models? */
2674 codec
->spdif_status_reset
= 1;
2677 /* If the use of more than one ADC is requested for the current
2678 * model, configure a second analog capture-only PCM.
2680 /* Additional Analaog capture for index #2 */
2681 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
2682 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
2683 codec
->num_pcms
= 3;
2684 info
= spec
->pcm_rec
+ 2;
2685 info
->name
= spec
->stream_name_analog
;
2686 if (spec
->alt_dac_nid
) {
2687 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
2688 *spec
->stream_analog_alt_playback
;
2689 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
2692 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
2693 alc_pcm_null_stream
;
2694 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
2696 if (spec
->num_adc_nids
> 1) {
2697 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
2698 *spec
->stream_analog_alt_capture
;
2699 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
2701 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
2702 spec
->num_adc_nids
- 1;
2704 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
2705 alc_pcm_null_stream
;
2706 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
2713 static void alc_free(struct hda_codec
*codec
)
2715 struct alc_spec
*spec
= codec
->spec
;
2721 if (spec
->kctl_alloc
) {
2722 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
2723 kfree(spec
->kctl_alloc
[i
].name
);
2724 kfree(spec
->kctl_alloc
);
2727 codec
->spec
= NULL
; /* to be sure */
2732 static struct hda_codec_ops alc_patch_ops
= {
2733 .build_controls
= alc_build_controls
,
2734 .build_pcms
= alc_build_pcms
,
2737 .unsol_event
= alc_unsol_event
,
2738 #ifdef CONFIG_SND_HDA_POWER_SAVE
2739 .check_power_status
= alc_check_power_status
,
2745 * Test configuration for debugging
2747 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2750 #ifdef CONFIG_SND_DEBUG
2751 static hda_nid_t alc880_test_dac_nids
[4] = {
2752 0x02, 0x03, 0x04, 0x05
2755 static struct hda_input_mux alc880_test_capture_source
= {
2764 { "Surround", 0x6 },
2768 static struct hda_channel_mode alc880_test_modes
[4] = {
2775 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
2776 struct snd_ctl_elem_info
*uinfo
)
2778 static char *texts
[] = {
2779 "N/A", "Line Out", "HP Out",
2780 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2782 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2784 uinfo
->value
.enumerated
.items
= 8;
2785 if (uinfo
->value
.enumerated
.item
>= 8)
2786 uinfo
->value
.enumerated
.item
= 7;
2787 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2791 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
2792 struct snd_ctl_elem_value
*ucontrol
)
2794 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2795 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2796 unsigned int pin_ctl
, item
= 0;
2798 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2799 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2800 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
2801 if (pin_ctl
& AC_PINCTL_HP_EN
)
2805 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
2806 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
2807 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
2808 case AC_PINCTL_VREF_50
: item
= 4; break;
2809 case AC_PINCTL_VREF_GRD
: item
= 5; break;
2810 case AC_PINCTL_VREF_80
: item
= 6; break;
2811 case AC_PINCTL_VREF_100
: item
= 7; break;
2814 ucontrol
->value
.enumerated
.item
[0] = item
;
2818 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
2819 struct snd_ctl_elem_value
*ucontrol
)
2821 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2822 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2823 static unsigned int ctls
[] = {
2824 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
2825 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
2826 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
2827 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
2828 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
2829 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
2831 unsigned int old_ctl
, new_ctl
;
2833 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2834 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2835 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
2836 if (old_ctl
!= new_ctl
) {
2838 snd_hda_codec_write_cache(codec
, nid
, 0,
2839 AC_VERB_SET_PIN_WIDGET_CONTROL
,
2841 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
2843 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
2850 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
2851 struct snd_ctl_elem_info
*uinfo
)
2853 static char *texts
[] = {
2854 "Front", "Surround", "CLFE", "Side"
2856 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2858 uinfo
->value
.enumerated
.items
= 4;
2859 if (uinfo
->value
.enumerated
.item
>= 4)
2860 uinfo
->value
.enumerated
.item
= 3;
2861 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2865 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
2866 struct snd_ctl_elem_value
*ucontrol
)
2868 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2869 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2872 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
2873 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
2877 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
2878 struct snd_ctl_elem_value
*ucontrol
)
2880 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2881 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2884 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
2885 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
2886 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
2887 snd_hda_codec_write_cache(codec
, nid
, 0,
2888 AC_VERB_SET_CONNECT_SEL
, sel
);
2894 #define PIN_CTL_TEST(xname,nid) { \
2895 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2897 .info = alc_test_pin_ctl_info, \
2898 .get = alc_test_pin_ctl_get, \
2899 .put = alc_test_pin_ctl_put, \
2900 .private_value = nid \
2903 #define PIN_SRC_TEST(xname,nid) { \
2904 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2906 .info = alc_test_pin_src_info, \
2907 .get = alc_test_pin_src_get, \
2908 .put = alc_test_pin_src_put, \
2909 .private_value = nid \
2912 static struct snd_kcontrol_new alc880_test_mixer
[] = {
2913 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2914 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2915 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
2916 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2917 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2918 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2919 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
2920 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2921 PIN_CTL_TEST("Front Pin Mode", 0x14),
2922 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2923 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2924 PIN_CTL_TEST("Side Pin Mode", 0x17),
2925 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2926 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2927 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2928 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2929 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2930 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2931 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2932 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2933 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2934 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2935 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2936 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2937 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
2938 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
2939 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2940 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2941 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
2942 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
2944 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2945 .name
= "Channel Mode",
2946 .info
= alc_ch_mode_info
,
2947 .get
= alc_ch_mode_get
,
2948 .put
= alc_ch_mode_put
,
2953 static struct hda_verb alc880_test_init_verbs
[] = {
2954 /* Unmute inputs of 0x0c - 0x0f */
2955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2956 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2957 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2958 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2959 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2960 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2961 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2962 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2963 /* Vol output for 0x0c-0x0f */
2964 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2965 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2966 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2967 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2968 /* Set output pins 0x14-0x17 */
2969 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2970 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2971 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2972 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2973 /* Unmute output pins 0x14-0x17 */
2974 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2975 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2976 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2977 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2978 /* Set input pins 0x18-0x1c */
2979 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2980 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2981 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2982 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2983 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2984 /* Mute input pins 0x18-0x1b */
2985 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2986 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2987 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2988 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2990 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2991 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2992 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2993 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2994 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2995 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2996 /* Analog input/passthru */
2997 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2998 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2999 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3000 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3001 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3009 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
3010 [ALC880_3ST
] = "3stack",
3011 [ALC880_TCL_S700
] = "tcl",
3012 [ALC880_3ST_DIG
] = "3stack-digout",
3013 [ALC880_CLEVO
] = "clevo",
3014 [ALC880_5ST
] = "5stack",
3015 [ALC880_5ST_DIG
] = "5stack-digout",
3016 [ALC880_W810
] = "w810",
3017 [ALC880_Z71V
] = "z71v",
3018 [ALC880_6ST
] = "6stack",
3019 [ALC880_6ST_DIG
] = "6stack-digout",
3020 [ALC880_ASUS
] = "asus",
3021 [ALC880_ASUS_W1V
] = "asus-w1v",
3022 [ALC880_ASUS_DIG
] = "asus-dig",
3023 [ALC880_ASUS_DIG2
] = "asus-dig2",
3024 [ALC880_UNIWILL_DIG
] = "uniwill",
3025 [ALC880_UNIWILL_P53
] = "uniwill-p53",
3026 [ALC880_FUJITSU
] = "fujitsu",
3027 [ALC880_F1734
] = "F1734",
3029 [ALC880_LG_LW
] = "lg-lw",
3030 [ALC880_MEDION_RIM
] = "medion",
3031 #ifdef CONFIG_SND_DEBUG
3032 [ALC880_TEST
] = "test",
3034 [ALC880_AUTO
] = "auto",
3037 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
3038 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
3039 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
3040 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
3041 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
3042 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
3043 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
3044 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
3045 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
3046 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
3047 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
3048 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
3049 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
3050 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
3051 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
3052 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
3053 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
3054 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
3055 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
3056 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3057 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
3058 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
3059 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
3060 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
3061 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
3062 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
3063 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS
), /* default ASUS */
3064 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
3065 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
3066 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
3067 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
3068 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
3069 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
3070 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
3071 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
3072 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
3073 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
3074 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
3075 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
3076 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
3077 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
3078 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
3079 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
3080 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
3081 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
3082 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
3083 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
3084 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
3085 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
3086 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
3087 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL
),
3088 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
3089 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
3090 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
3091 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
3092 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
3093 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
3094 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
3095 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
3096 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
3097 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
3098 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
3099 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
3100 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
3101 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
3102 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
3103 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
3104 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
3105 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
3106 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST
), /* default Intel */
3107 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
3108 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
3113 * ALC880 codec presets
3115 static struct alc_config_preset alc880_presets
[] = {
3117 .mixers
= { alc880_three_stack_mixer
},
3118 .init_verbs
= { alc880_volume_init_verbs
,
3119 alc880_pin_3stack_init_verbs
},
3120 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3121 .dac_nids
= alc880_dac_nids
,
3122 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3123 .channel_mode
= alc880_threestack_modes
,
3125 .input_mux
= &alc880_capture_source
,
3127 [ALC880_3ST_DIG
] = {
3128 .mixers
= { alc880_three_stack_mixer
},
3129 .init_verbs
= { alc880_volume_init_verbs
,
3130 alc880_pin_3stack_init_verbs
},
3131 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3132 .dac_nids
= alc880_dac_nids
,
3133 .dig_out_nid
= ALC880_DIGOUT_NID
,
3134 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3135 .channel_mode
= alc880_threestack_modes
,
3137 .input_mux
= &alc880_capture_source
,
3139 [ALC880_TCL_S700
] = {
3140 .mixers
= { alc880_tcl_s700_mixer
},
3141 .init_verbs
= { alc880_volume_init_verbs
,
3142 alc880_pin_tcl_S700_init_verbs
,
3143 alc880_gpio2_init_verbs
},
3144 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3145 .dac_nids
= alc880_dac_nids
,
3147 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3148 .channel_mode
= alc880_2_jack_modes
,
3149 .input_mux
= &alc880_capture_source
,
3152 .mixers
= { alc880_three_stack_mixer
,
3153 alc880_five_stack_mixer
},
3154 .init_verbs
= { alc880_volume_init_verbs
,
3155 alc880_pin_5stack_init_verbs
},
3156 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3157 .dac_nids
= alc880_dac_nids
,
3158 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3159 .channel_mode
= alc880_fivestack_modes
,
3160 .input_mux
= &alc880_capture_source
,
3162 [ALC880_5ST_DIG
] = {
3163 .mixers
= { alc880_three_stack_mixer
,
3164 alc880_five_stack_mixer
},
3165 .init_verbs
= { alc880_volume_init_verbs
,
3166 alc880_pin_5stack_init_verbs
},
3167 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3168 .dac_nids
= alc880_dac_nids
,
3169 .dig_out_nid
= ALC880_DIGOUT_NID
,
3170 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3171 .channel_mode
= alc880_fivestack_modes
,
3172 .input_mux
= &alc880_capture_source
,
3175 .mixers
= { alc880_six_stack_mixer
},
3176 .init_verbs
= { alc880_volume_init_verbs
,
3177 alc880_pin_6stack_init_verbs
},
3178 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3179 .dac_nids
= alc880_6st_dac_nids
,
3180 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3181 .channel_mode
= alc880_sixstack_modes
,
3182 .input_mux
= &alc880_6stack_capture_source
,
3184 [ALC880_6ST_DIG
] = {
3185 .mixers
= { alc880_six_stack_mixer
},
3186 .init_verbs
= { alc880_volume_init_verbs
,
3187 alc880_pin_6stack_init_verbs
},
3188 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3189 .dac_nids
= alc880_6st_dac_nids
,
3190 .dig_out_nid
= ALC880_DIGOUT_NID
,
3191 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3192 .channel_mode
= alc880_sixstack_modes
,
3193 .input_mux
= &alc880_6stack_capture_source
,
3196 .mixers
= { alc880_w810_base_mixer
},
3197 .init_verbs
= { alc880_volume_init_verbs
,
3198 alc880_pin_w810_init_verbs
,
3199 alc880_gpio2_init_verbs
},
3200 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
3201 .dac_nids
= alc880_w810_dac_nids
,
3202 .dig_out_nid
= ALC880_DIGOUT_NID
,
3203 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3204 .channel_mode
= alc880_w810_modes
,
3205 .input_mux
= &alc880_capture_source
,
3208 .mixers
= { alc880_z71v_mixer
},
3209 .init_verbs
= { alc880_volume_init_verbs
,
3210 alc880_pin_z71v_init_verbs
},
3211 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
3212 .dac_nids
= alc880_z71v_dac_nids
,
3213 .dig_out_nid
= ALC880_DIGOUT_NID
,
3215 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3216 .channel_mode
= alc880_2_jack_modes
,
3217 .input_mux
= &alc880_capture_source
,
3220 .mixers
= { alc880_f1734_mixer
},
3221 .init_verbs
= { alc880_volume_init_verbs
,
3222 alc880_pin_f1734_init_verbs
},
3223 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
3224 .dac_nids
= alc880_f1734_dac_nids
,
3226 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3227 .channel_mode
= alc880_2_jack_modes
,
3228 .input_mux
= &alc880_f1734_capture_source
,
3229 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3230 .init_hook
= alc880_uniwill_p53_hp_automute
,
3233 .mixers
= { alc880_asus_mixer
},
3234 .init_verbs
= { alc880_volume_init_verbs
,
3235 alc880_pin_asus_init_verbs
,
3236 alc880_gpio1_init_verbs
},
3237 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3238 .dac_nids
= alc880_asus_dac_nids
,
3239 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3240 .channel_mode
= alc880_asus_modes
,
3242 .input_mux
= &alc880_capture_source
,
3244 [ALC880_ASUS_DIG
] = {
3245 .mixers
= { alc880_asus_mixer
},
3246 .init_verbs
= { alc880_volume_init_verbs
,
3247 alc880_pin_asus_init_verbs
,
3248 alc880_gpio1_init_verbs
},
3249 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3250 .dac_nids
= alc880_asus_dac_nids
,
3251 .dig_out_nid
= ALC880_DIGOUT_NID
,
3252 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3253 .channel_mode
= alc880_asus_modes
,
3255 .input_mux
= &alc880_capture_source
,
3257 [ALC880_ASUS_DIG2
] = {
3258 .mixers
= { alc880_asus_mixer
},
3259 .init_verbs
= { alc880_volume_init_verbs
,
3260 alc880_pin_asus_init_verbs
,
3261 alc880_gpio2_init_verbs
}, /* use GPIO2 */
3262 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3263 .dac_nids
= alc880_asus_dac_nids
,
3264 .dig_out_nid
= ALC880_DIGOUT_NID
,
3265 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3266 .channel_mode
= alc880_asus_modes
,
3268 .input_mux
= &alc880_capture_source
,
3270 [ALC880_ASUS_W1V
] = {
3271 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
3272 .init_verbs
= { alc880_volume_init_verbs
,
3273 alc880_pin_asus_init_verbs
,
3274 alc880_gpio1_init_verbs
},
3275 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3276 .dac_nids
= alc880_asus_dac_nids
,
3277 .dig_out_nid
= ALC880_DIGOUT_NID
,
3278 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3279 .channel_mode
= alc880_asus_modes
,
3281 .input_mux
= &alc880_capture_source
,
3283 [ALC880_UNIWILL_DIG
] = {
3284 .mixers
= { alc880_asus_mixer
, alc880_pcbeep_mixer
},
3285 .init_verbs
= { alc880_volume_init_verbs
,
3286 alc880_pin_asus_init_verbs
},
3287 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3288 .dac_nids
= alc880_asus_dac_nids
,
3289 .dig_out_nid
= ALC880_DIGOUT_NID
,
3290 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3291 .channel_mode
= alc880_asus_modes
,
3293 .input_mux
= &alc880_capture_source
,
3295 [ALC880_UNIWILL
] = {
3296 .mixers
= { alc880_uniwill_mixer
},
3297 .init_verbs
= { alc880_volume_init_verbs
,
3298 alc880_uniwill_init_verbs
},
3299 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3300 .dac_nids
= alc880_asus_dac_nids
,
3301 .dig_out_nid
= ALC880_DIGOUT_NID
,
3302 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3303 .channel_mode
= alc880_threestack_modes
,
3305 .input_mux
= &alc880_capture_source
,
3306 .unsol_event
= alc880_uniwill_unsol_event
,
3307 .init_hook
= alc880_uniwill_automute
,
3309 [ALC880_UNIWILL_P53
] = {
3310 .mixers
= { alc880_uniwill_p53_mixer
},
3311 .init_verbs
= { alc880_volume_init_verbs
,
3312 alc880_uniwill_p53_init_verbs
},
3313 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3314 .dac_nids
= alc880_asus_dac_nids
,
3315 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3316 .channel_mode
= alc880_threestack_modes
,
3317 .input_mux
= &alc880_capture_source
,
3318 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3319 .init_hook
= alc880_uniwill_p53_hp_automute
,
3321 [ALC880_FUJITSU
] = {
3322 .mixers
= { alc880_fujitsu_mixer
,
3323 alc880_pcbeep_mixer
, },
3324 .init_verbs
= { alc880_volume_init_verbs
,
3325 alc880_uniwill_p53_init_verbs
,
3326 alc880_beep_init_verbs
},
3327 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3328 .dac_nids
= alc880_dac_nids
,
3329 .dig_out_nid
= ALC880_DIGOUT_NID
,
3330 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3331 .channel_mode
= alc880_2_jack_modes
,
3332 .input_mux
= &alc880_capture_source
,
3333 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3334 .init_hook
= alc880_uniwill_p53_hp_automute
,
3337 .mixers
= { alc880_three_stack_mixer
},
3338 .init_verbs
= { alc880_volume_init_verbs
,
3339 alc880_pin_clevo_init_verbs
},
3340 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3341 .dac_nids
= alc880_dac_nids
,
3343 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3344 .channel_mode
= alc880_threestack_modes
,
3346 .input_mux
= &alc880_capture_source
,
3349 .mixers
= { alc880_lg_mixer
},
3350 .init_verbs
= { alc880_volume_init_verbs
,
3351 alc880_lg_init_verbs
},
3352 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
3353 .dac_nids
= alc880_lg_dac_nids
,
3354 .dig_out_nid
= ALC880_DIGOUT_NID
,
3355 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
3356 .channel_mode
= alc880_lg_ch_modes
,
3358 .input_mux
= &alc880_lg_capture_source
,
3359 .unsol_event
= alc880_lg_unsol_event
,
3360 .init_hook
= alc880_lg_automute
,
3361 #ifdef CONFIG_SND_HDA_POWER_SAVE
3362 .loopbacks
= alc880_lg_loopbacks
,
3366 .mixers
= { alc880_lg_lw_mixer
},
3367 .init_verbs
= { alc880_volume_init_verbs
,
3368 alc880_lg_lw_init_verbs
},
3369 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3370 .dac_nids
= alc880_dac_nids
,
3371 .dig_out_nid
= ALC880_DIGOUT_NID
,
3372 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
3373 .channel_mode
= alc880_lg_lw_modes
,
3374 .input_mux
= &alc880_lg_lw_capture_source
,
3375 .unsol_event
= alc880_lg_lw_unsol_event
,
3376 .init_hook
= alc880_lg_lw_automute
,
3378 [ALC880_MEDION_RIM
] = {
3379 .mixers
= { alc880_medion_rim_mixer
},
3380 .init_verbs
= { alc880_volume_init_verbs
,
3381 alc880_medion_rim_init_verbs
,
3382 alc_gpio2_init_verbs
},
3383 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3384 .dac_nids
= alc880_dac_nids
,
3385 .dig_out_nid
= ALC880_DIGOUT_NID
,
3386 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3387 .channel_mode
= alc880_2_jack_modes
,
3388 .input_mux
= &alc880_medion_rim_capture_source
,
3389 .unsol_event
= alc880_medion_rim_unsol_event
,
3390 .init_hook
= alc880_medion_rim_automute
,
3392 #ifdef CONFIG_SND_DEBUG
3394 .mixers
= { alc880_test_mixer
},
3395 .init_verbs
= { alc880_test_init_verbs
},
3396 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
3397 .dac_nids
= alc880_test_dac_nids
,
3398 .dig_out_nid
= ALC880_DIGOUT_NID
,
3399 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
3400 .channel_mode
= alc880_test_modes
,
3401 .input_mux
= &alc880_test_capture_source
,
3407 * Automatic parse of I/O pins from the BIOS configuration
3410 #define NUM_CONTROL_ALLOC 32
3411 #define NUM_VERB_ALLOC 32
3415 ALC_CTL_WIDGET_MUTE
,
3418 static struct snd_kcontrol_new alc880_control_templates
[] = {
3419 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
3420 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
3421 HDA_BIND_MUTE(NULL
, 0, 0, 0),
3424 /* add dynamic controls */
3425 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
3428 struct snd_kcontrol_new
*knew
;
3430 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
3431 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
3433 /* array + terminator */
3434 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
);
3437 if (spec
->kctl_alloc
) {
3438 memcpy(knew
, spec
->kctl_alloc
,
3439 sizeof(*knew
) * spec
->num_kctl_alloc
);
3440 kfree(spec
->kctl_alloc
);
3442 spec
->kctl_alloc
= knew
;
3443 spec
->num_kctl_alloc
= num
;
3446 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
3447 *knew
= alc880_control_templates
[type
];
3448 knew
->name
= kstrdup(name
, GFP_KERNEL
);
3451 knew
->private_value
= val
;
3452 spec
->num_kctl_used
++;
3456 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3457 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3458 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3459 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3460 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3461 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3462 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3463 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3464 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3465 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3466 #define ALC880_PIN_CD_NID 0x1c
3468 /* fill in the dac_nids table from the parsed pin configuration */
3469 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
3470 const struct auto_pin_cfg
*cfg
)
3476 memset(assigned
, 0, sizeof(assigned
));
3477 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
3479 /* check the pins hardwired to audio widget */
3480 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3481 nid
= cfg
->line_out_pins
[i
];
3482 if (alc880_is_fixed_pin(nid
)) {
3483 int idx
= alc880_fixed_pin_idx(nid
);
3484 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
3488 /* left pins can be connect to any audio widget */
3489 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3490 nid
= cfg
->line_out_pins
[i
];
3491 if (alc880_is_fixed_pin(nid
))
3493 /* search for an empty channel */
3494 for (j
= 0; j
< cfg
->line_outs
; j
++) {
3496 spec
->multiout
.dac_nids
[i
] =
3497 alc880_idx_to_dac(j
);
3503 spec
->multiout
.num_dacs
= cfg
->line_outs
;
3507 /* add playback controls from the parsed DAC table */
3508 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
3509 const struct auto_pin_cfg
*cfg
)
3512 static const char *chname
[4] = {
3513 "Front", "Surround", NULL
/*CLFE*/, "Side"
3518 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3519 if (!spec
->multiout
.dac_nids
[i
])
3521 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
3524 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3525 "Center Playback Volume",
3526 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
3530 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3531 "LFE Playback Volume",
3532 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
3536 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3537 "Center Playback Switch",
3538 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
3542 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3543 "LFE Playback Switch",
3544 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
3549 sprintf(name
, "%s Playback Volume", chname
[i
]);
3550 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3551 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
3555 sprintf(name
, "%s Playback Switch", chname
[i
]);
3556 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3557 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
3566 /* add playback controls for speaker and HP outputs */
3567 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
3577 if (alc880_is_fixed_pin(pin
)) {
3578 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
3579 /* specify the DAC as the extra output */
3580 if (!spec
->multiout
.hp_nid
)
3581 spec
->multiout
.hp_nid
= nid
;
3583 spec
->multiout
.extra_out_nid
[0] = nid
;
3584 /* control HP volume/switch on the output mixer amp */
3585 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
3586 sprintf(name
, "%s Playback Volume", pfx
);
3587 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3588 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
3591 sprintf(name
, "%s Playback Switch", pfx
);
3592 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3593 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
3596 } else if (alc880_is_multi_pin(pin
)) {
3597 /* set manual connection */
3598 /* we have only a switch on HP-out PIN */
3599 sprintf(name
, "%s Playback Switch", pfx
);
3600 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3601 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
3608 /* create input playback/capture controls for the given pin */
3609 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
3610 const char *ctlname
,
3611 int idx
, hda_nid_t mix_nid
)
3616 sprintf(name
, "%s Playback Volume", ctlname
);
3617 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3618 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3621 sprintf(name
, "%s Playback Switch", ctlname
);
3622 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3623 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3629 /* create playback/capture controls for input pins */
3630 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
3631 const struct auto_pin_cfg
*cfg
)
3633 struct hda_input_mux
*imux
= &spec
->private_imux
;
3636 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3637 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
3638 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
3639 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
3640 auto_pin_cfg_labels
[i
],
3644 imux
->items
[imux
->num_items
].label
=
3645 auto_pin_cfg_labels
[i
];
3646 imux
->items
[imux
->num_items
].index
=
3647 alc880_input_pin_idx(cfg
->input_pins
[i
]);
3654 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
3655 unsigned int pin_type
)
3657 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
3660 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
3664 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
3665 hda_nid_t nid
, int pin_type
,
3668 alc_set_pin_output(codec
, nid
, pin_type
);
3669 /* need the manual connection? */
3670 if (alc880_is_multi_pin(nid
)) {
3671 struct alc_spec
*spec
= codec
->spec
;
3672 int idx
= alc880_multi_pin_idx(nid
);
3673 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
3674 AC_VERB_SET_CONNECT_SEL
,
3675 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
3679 static int get_pin_type(int line_out_type
)
3681 if (line_out_type
== AUTO_PIN_HP_OUT
)
3687 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
3689 struct alc_spec
*spec
= codec
->spec
;
3692 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
3693 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
3694 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
3695 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
3696 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
3700 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
3702 struct alc_spec
*spec
= codec
->spec
;
3705 pin
= spec
->autocfg
.speaker_pins
[0];
3706 if (pin
) /* connect to front */
3707 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
3708 pin
= spec
->autocfg
.hp_pins
[0];
3709 if (pin
) /* connect to front */
3710 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
3713 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
3715 struct alc_spec
*spec
= codec
->spec
;
3718 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3719 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
3720 if (alc880_is_input_pin(nid
)) {
3721 snd_hda_codec_write(codec
, nid
, 0,
3722 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3723 i
<= AUTO_PIN_FRONT_MIC
?
3724 PIN_VREF80
: PIN_IN
);
3725 if (nid
!= ALC880_PIN_CD_NID
)
3726 snd_hda_codec_write(codec
, nid
, 0,
3727 AC_VERB_SET_AMP_GAIN_MUTE
,
3733 /* parse the BIOS configuration and set up the alc_spec */
3734 /* return 1 if successful, 0 if the proper config is not found,
3735 * or a negative error code
3737 static int alc880_parse_auto_config(struct hda_codec
*codec
)
3739 struct alc_spec
*spec
= codec
->spec
;
3741 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
3743 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
3747 if (!spec
->autocfg
.line_outs
)
3748 return 0; /* can't find valid BIOS pin config */
3750 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
3753 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
3756 err
= alc880_auto_create_extra_out(spec
,
3757 spec
->autocfg
.speaker_pins
[0],
3761 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
3765 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
3769 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
3771 if (spec
->autocfg
.dig_out_pin
)
3772 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
3773 if (spec
->autocfg
.dig_in_pin
)
3774 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
3776 if (spec
->kctl_alloc
)
3777 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3779 spec
->init_verbs
[spec
->num_init_verbs
++] = alc880_volume_init_verbs
;
3781 spec
->num_mux_defs
= 1;
3782 spec
->input_mux
= &spec
->private_imux
;
3787 /* additional initialization for auto-configuration model */
3788 static void alc880_auto_init(struct hda_codec
*codec
)
3790 struct alc_spec
*spec
= codec
->spec
;
3791 alc880_auto_init_multi_out(codec
);
3792 alc880_auto_init_extra_out(codec
);
3793 alc880_auto_init_analog_input(codec
);
3794 if (spec
->unsol_event
)
3795 alc_sku_automute(codec
);
3799 * OK, here we have finally the patch for ALC880
3802 static int patch_alc880(struct hda_codec
*codec
)
3804 struct alc_spec
*spec
;
3808 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3814 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
3817 if (board_config
< 0) {
3818 printk(KERN_INFO
"hda_codec: Unknown model for ALC880, "
3819 "trying auto-probe from BIOS...\n");
3820 board_config
= ALC880_AUTO
;
3823 if (board_config
== ALC880_AUTO
) {
3824 /* automatic parse from the BIOS config */
3825 err
= alc880_parse_auto_config(codec
);
3831 "hda_codec: Cannot set up configuration "
3832 "from BIOS. Using 3-stack mode...\n");
3833 board_config
= ALC880_3ST
;
3837 if (board_config
!= ALC880_AUTO
)
3838 setup_preset(spec
, &alc880_presets
[board_config
]);
3840 spec
->stream_name_analog
= "ALC880 Analog";
3841 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
3842 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
3843 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
3845 spec
->stream_name_digital
= "ALC880 Digital";
3846 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
3847 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
3849 if (!spec
->adc_nids
&& spec
->input_mux
) {
3850 /* check whether NID 0x07 is valid */
3851 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
3853 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
3854 if (wcap
!= AC_WID_AUD_IN
) {
3855 spec
->adc_nids
= alc880_adc_nids_alt
;
3856 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
3857 spec
->mixers
[spec
->num_mixers
] =
3858 alc880_capture_alt_mixer
;
3861 spec
->adc_nids
= alc880_adc_nids
;
3862 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
3863 spec
->mixers
[spec
->num_mixers
] = alc880_capture_mixer
;
3868 spec
->vmaster_nid
= 0x0c;
3870 codec
->patch_ops
= alc_patch_ops
;
3871 if (board_config
== ALC880_AUTO
)
3872 spec
->init_hook
= alc880_auto_init
;
3873 #ifdef CONFIG_SND_HDA_POWER_SAVE
3874 if (!spec
->loopback
.amplist
)
3875 spec
->loopback
.amplist
= alc880_loopbacks
;
3886 static hda_nid_t alc260_dac_nids
[1] = {
3891 static hda_nid_t alc260_adc_nids
[1] = {
3896 static hda_nid_t alc260_adc_nids_alt
[1] = {
3901 static hda_nid_t alc260_hp_adc_nids
[2] = {
3906 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3907 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3909 static hda_nid_t alc260_dual_adc_nids
[2] = {
3914 #define ALC260_DIGOUT_NID 0x03
3915 #define ALC260_DIGIN_NID 0x06
3917 static struct hda_input_mux alc260_capture_source
= {
3921 { "Front Mic", 0x1 },
3927 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3928 * headphone jack and the internal CD lines since these are the only pins at
3929 * which audio can appear. For flexibility, also allow the option of
3930 * recording the mixer output on the second ADC (ADC0 doesn't have a
3931 * connection to the mixer output).
3933 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
3937 { "Mic/Line", 0x0 },
3939 { "Headphone", 0x2 },
3945 { "Mic/Line", 0x0 },
3947 { "Headphone", 0x2 },
3954 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3955 * the Fujitsu S702x, but jacks are marked differently.
3957 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
3964 { "Headphone", 0x5 },
3973 { "Headphone", 0x6 },
3979 * This is just place-holder, so there's something for alc_build_pcms to look
3980 * at when it calculates the maximum number of channels. ALC260 has no mixer
3981 * element which allows changing the channel mode, so the verb list is
3984 static struct hda_channel_mode alc260_modes
[1] = {
3989 /* Mixer combinations
3991 * basic: base_output + input + pc_beep + capture
3992 * HP: base_output + input + capture_alt
3993 * HP_3013: hp_3013 + input + capture
3994 * fujitsu: fujitsu + capture
3995 * acer: acer + capture
3998 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
3999 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4000 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
4001 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4002 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
4003 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4004 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4008 static struct snd_kcontrol_new alc260_input_mixer
[] = {
4009 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4010 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4011 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4012 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4013 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4014 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4015 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
4016 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
4020 static struct snd_kcontrol_new alc260_pc_beep_mixer
[] = {
4021 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT
),
4022 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT
),
4026 /* update HP, line and mono out pins according to the master switch */
4027 static void alc260_hp_master_update(struct hda_codec
*codec
,
4028 hda_nid_t hp
, hda_nid_t line
,
4031 struct alc_spec
*spec
= codec
->spec
;
4032 unsigned int val
= spec
->master_sw
? PIN_HP
: 0;
4033 /* change HP and line-out pins */
4034 snd_hda_codec_write(codec
, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4036 snd_hda_codec_write(codec
, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4038 /* mono (speaker) depending on the HP jack sense */
4039 val
= (val
&& !spec
->jack_present
) ? PIN_OUT
: 0;
4040 snd_hda_codec_write(codec
, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4044 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
4045 struct snd_ctl_elem_value
*ucontrol
)
4047 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4048 struct alc_spec
*spec
= codec
->spec
;
4049 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
4053 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
4054 struct snd_ctl_elem_value
*ucontrol
)
4056 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4057 struct alc_spec
*spec
= codec
->spec
;
4058 int val
= !!*ucontrol
->value
.integer
.value
;
4059 hda_nid_t hp
, line
, mono
;
4061 if (val
== spec
->master_sw
)
4063 spec
->master_sw
= val
;
4064 hp
= (kcontrol
->private_value
>> 16) & 0xff;
4065 line
= (kcontrol
->private_value
>> 8) & 0xff;
4066 mono
= kcontrol
->private_value
& 0xff;
4067 alc260_hp_master_update(codec
, hp
, line
, mono
);
4071 static struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
4073 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4074 .name
= "Master Playback Switch",
4075 .info
= snd_ctl_boolean_mono_info
,
4076 .get
= alc260_hp_master_sw_get
,
4077 .put
= alc260_hp_master_sw_put
,
4078 .private_value
= (0x0f << 16) | (0x10 << 8) | 0x11
4080 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4081 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
4082 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4083 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
4084 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4086 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4090 static struct hda_verb alc260_hp_unsol_verbs
[] = {
4091 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4095 static void alc260_hp_automute(struct hda_codec
*codec
)
4097 struct alc_spec
*spec
= codec
->spec
;
4098 unsigned int present
;
4100 present
= snd_hda_codec_read(codec
, 0x10, 0,
4101 AC_VERB_GET_PIN_SENSE
, 0);
4102 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4103 alc260_hp_master_update(codec
, 0x0f, 0x10, 0x11);
4106 static void alc260_hp_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4108 if ((res
>> 26) == ALC880_HP_EVENT
)
4109 alc260_hp_automute(codec
);
4112 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
4114 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4115 .name
= "Master Playback Switch",
4116 .info
= snd_ctl_boolean_mono_info
,
4117 .get
= alc260_hp_master_sw_get
,
4118 .put
= alc260_hp_master_sw_put
,
4119 .private_value
= (0x10 << 16) | (0x15 << 8) | 0x11
4121 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4122 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
4123 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
4124 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
4125 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4126 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
4127 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4128 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
4132 static struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
4133 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4137 static void alc260_hp_3013_automute(struct hda_codec
*codec
)
4139 struct alc_spec
*spec
= codec
->spec
;
4140 unsigned int present
;
4142 present
= snd_hda_codec_read(codec
, 0x15, 0,
4143 AC_VERB_GET_PIN_SENSE
, 0);
4144 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4145 alc260_hp_master_update(codec
, 0x10, 0x15, 0x11);
4148 static void alc260_hp_3013_unsol_event(struct hda_codec
*codec
,
4151 if ((res
>> 26) == ALC880_HP_EVENT
)
4152 alc260_hp_3013_automute(codec
);
4155 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4156 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4158 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
4159 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4160 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
4161 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4162 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4163 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4164 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
4165 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
4166 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4167 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4168 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4169 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4170 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
4174 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4175 * versions of the ALC260 don't act on requests to enable mic bias from NID
4176 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4177 * datasheet doesn't mention this restriction. At this stage it's not clear
4178 * whether this behaviour is intentional or is a hardware bug in chip
4179 * revisions available in early 2006. Therefore for now allow the
4180 * "Headphone Jack Mode" control to span all choices, but if it turns out
4181 * that the lack of mic bias for this NID is intentional we could change the
4182 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4184 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4185 * don't appear to make the mic bias available from the "line" jack, even
4186 * though the NID used for this jack (0x14) can supply it. The theory is
4187 * that perhaps Acer have included blocking capacitors between the ALC260
4188 * and the output jack. If this turns out to be the case for all such
4189 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4190 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4192 * The C20x Tablet series have a mono internal speaker which is controlled
4193 * via the chip's Mono sum widget and pin complex, so include the necessary
4194 * controls for such models. On models without a "mono speaker" the control
4195 * won't do anything.
4197 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
4198 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4199 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
4200 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
4201 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4203 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4205 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4206 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4207 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4208 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4209 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4210 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4211 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4212 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4213 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4214 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4218 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4219 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4221 static struct snd_kcontrol_new alc260_will_mixer
[] = {
4222 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4223 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
4224 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4225 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4226 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4227 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4228 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4229 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4230 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4231 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4232 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4233 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4237 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4238 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4240 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
4241 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4242 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
4243 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4244 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4245 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4246 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
4247 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
4248 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4249 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4250 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4254 /* capture mixer elements */
4255 static struct snd_kcontrol_new alc260_capture_mixer
[] = {
4256 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT
),
4257 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT
),
4258 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT
),
4259 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT
),
4261 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4262 /* The multiple "Capture Source" controls confuse alsamixer
4263 * So call somewhat different..
4265 /* .name = "Capture Source", */
4266 .name
= "Input Source",
4268 .info
= alc_mux_enum_info
,
4269 .get
= alc_mux_enum_get
,
4270 .put
= alc_mux_enum_put
,
4275 static struct snd_kcontrol_new alc260_capture_alt_mixer
[] = {
4276 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT
),
4277 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT
),
4279 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4280 /* The multiple "Capture Source" controls confuse alsamixer
4281 * So call somewhat different..
4283 /* .name = "Capture Source", */
4284 .name
= "Input Source",
4286 .info
= alc_mux_enum_info
,
4287 .get
= alc_mux_enum_get
,
4288 .put
= alc_mux_enum_put
,
4294 * initialization verbs
4296 static struct hda_verb alc260_init_verbs
[] = {
4297 /* Line In pin widget for input */
4298 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4299 /* CD pin widget for input */
4300 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4301 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4302 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4303 /* Mic2 (front panel) pin widget for input and vref at 80% */
4304 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4305 /* LINE-2 is used for line-out in rear */
4306 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4307 /* select line-out */
4308 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
4310 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4312 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4314 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4315 /* mute capture amp left and right */
4316 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4317 /* set connection select to line in (default select for this ADC) */
4318 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4319 /* mute capture amp left and right */
4320 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4321 /* set connection select to line in (default select for this ADC) */
4322 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
4323 /* set vol=0 Line-Out mixer amp left and right */
4324 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4325 /* unmute pin widget amp left and right (no gain on this amp) */
4326 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4327 /* set vol=0 HP mixer amp left and right */
4328 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4329 /* unmute pin widget amp left and right (no gain on this amp) */
4330 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4331 /* set vol=0 Mono mixer amp left and right */
4332 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4333 /* unmute pin widget amp left and right (no gain on this amp) */
4334 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4335 /* unmute LINE-2 out pin */
4336 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4337 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4340 /* mute analog inputs */
4341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4342 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4343 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4344 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4345 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4346 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4347 /* mute Front out path */
4348 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4349 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4350 /* mute Headphone out path */
4351 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4352 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4353 /* mute Mono out path */
4354 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4355 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4359 #if 0 /* should be identical with alc260_init_verbs? */
4360 static struct hda_verb alc260_hp_init_verbs
[] = {
4361 /* Headphone and output */
4362 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
4364 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4365 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4366 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4367 /* Mic2 (front panel) pin widget for input and vref at 80% */
4368 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4369 /* Line In pin widget for input */
4370 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4371 /* Line-2 pin widget for output */
4372 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4373 /* CD pin widget for input */
4374 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4375 /* unmute amp left and right */
4376 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
4377 /* set connection select to line in (default select for this ADC) */
4378 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4379 /* unmute Line-Out mixer amp left and right (volume = 0) */
4380 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4381 /* mute pin widget amp left and right (no gain on this amp) */
4382 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4383 /* unmute HP mixer amp left and right (volume = 0) */
4384 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4385 /* mute pin widget amp left and right (no gain on this amp) */
4386 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4387 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4390 /* mute analog inputs */
4391 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4392 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4393 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4394 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4395 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4396 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4397 /* Unmute Front out path */
4398 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4399 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4400 /* Unmute Headphone out path */
4401 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4402 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4403 /* Unmute Mono out path */
4404 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4405 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4410 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
4411 /* Line out and output */
4412 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4414 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4415 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4416 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4417 /* Mic2 (front panel) pin widget for input and vref at 80% */
4418 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4419 /* Line In pin widget for input */
4420 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4421 /* Headphone pin widget for output */
4422 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
4423 /* CD pin widget for input */
4424 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4425 /* unmute amp left and right */
4426 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
4427 /* set connection select to line in (default select for this ADC) */
4428 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4429 /* unmute Line-Out mixer amp left and right (volume = 0) */
4430 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4431 /* mute pin widget amp left and right (no gain on this amp) */
4432 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4433 /* unmute HP mixer amp left and right (volume = 0) */
4434 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4435 /* mute pin widget amp left and right (no gain on this amp) */
4436 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4437 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4440 /* mute analog inputs */
4441 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4442 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4443 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4444 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4445 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4446 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4447 /* Unmute Front out path */
4448 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4449 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4450 /* Unmute Headphone out path */
4451 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4452 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4453 /* Unmute Mono out path */
4454 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4455 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4459 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4460 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4461 * audio = 0x16, internal speaker = 0x10.
4463 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
4464 /* Disable all GPIOs */
4465 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
4466 /* Internal speaker is connected to headphone pin */
4467 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4468 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4469 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4470 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4471 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4472 /* Ensure all other unused pins are disabled and muted. */
4473 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4474 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4475 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4476 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4477 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4478 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4479 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4480 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4482 /* Disable digital (SPDIF) pins */
4483 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4484 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4486 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4487 * when acting as an output.
4489 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4491 /* Start with output sum widgets muted and their output gains at min */
4492 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4493 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4494 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4495 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4496 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4497 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4498 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4499 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4500 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4502 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4503 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4504 /* Unmute Line1 pin widget output buffer since it starts as an output.
4505 * If the pin mode is changed by the user the pin mode control will
4506 * take care of enabling the pin's input/output buffers as needed.
4507 * Therefore there's no need to enable the input buffer at this
4510 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4511 /* Unmute input buffer of pin widget used for Line-in (no equiv
4514 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4516 /* Mute capture amp left and right */
4517 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4518 /* Set ADC connection select to match default mixer setting - line
4521 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4523 /* Do the same for the second ADC: mute capture input amp and
4524 * set ADC connection to line in (on mic1 pin)
4526 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4527 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4529 /* Mute all inputs to mixer widget (even unconnected ones) */
4530 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4531 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4532 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4534 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4535 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4536 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4537 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4542 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4543 * similar laptops (adapted from Fujitsu init verbs).
4545 static struct hda_verb alc260_acer_init_verbs
[] = {
4546 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4547 * the headphone jack. Turn this on and rely on the standard mute
4548 * methods whenever the user wants to turn these outputs off.
4550 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4551 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4552 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
4553 /* Internal speaker/Headphone jack is connected to Line-out pin */
4554 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4555 /* Internal microphone/Mic jack is connected to Mic1 pin */
4556 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
4557 /* Line In jack is connected to Line1 pin */
4558 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4559 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4560 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4561 /* Ensure all other unused pins are disabled and muted. */
4562 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4563 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4564 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4565 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4566 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4567 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4568 /* Disable digital (SPDIF) pins */
4569 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4570 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4572 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4573 * bus when acting as outputs.
4575 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4576 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4578 /* Start with output sum widgets muted and their output gains at min */
4579 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4580 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4581 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4582 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4583 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4584 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4585 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4586 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4587 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4589 /* Unmute Line-out pin widget amp left and right
4590 * (no equiv mixer ctrl)
4592 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4593 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4594 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4595 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4596 * inputs. If the pin mode is changed by the user the pin mode control
4597 * will take care of enabling the pin's input/output buffers as needed.
4598 * Therefore there's no need to enable the input buffer at this
4601 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4602 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4604 /* Mute capture amp left and right */
4605 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4606 /* Set ADC connection select to match default mixer setting - mic
4609 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4611 /* Do similar with the second ADC: mute capture input amp and
4612 * set ADC connection to mic to match ALSA's default state.
4614 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4615 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4617 /* Mute all inputs to mixer widget (even unconnected ones) */
4618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4619 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4620 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4622 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4623 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4624 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4625 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4630 static struct hda_verb alc260_will_verbs
[] = {
4631 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4632 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
4633 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
4634 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4635 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4636 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
4640 static struct hda_verb alc260_replacer_672v_verbs
[] = {
4641 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4642 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4643 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
4645 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4646 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4647 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4649 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4653 /* toggle speaker-output according to the hp-jack state */
4654 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
4656 unsigned int present
;
4658 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4659 present
= snd_hda_codec_read(codec
, 0x0f, 0,
4660 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
4662 snd_hda_codec_write_cache(codec
, 0x01, 0,
4663 AC_VERB_SET_GPIO_DATA
, 1);
4664 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4665 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4668 snd_hda_codec_write_cache(codec
, 0x01, 0,
4669 AC_VERB_SET_GPIO_DATA
, 0);
4670 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4671 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4676 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
4679 if ((res
>> 26) == ALC880_HP_EVENT
)
4680 alc260_replacer_672v_automute(codec
);
4683 /* Test configuration for debugging, modelled after the ALC880 test
4686 #ifdef CONFIG_SND_DEBUG
4687 static hda_nid_t alc260_test_dac_nids
[1] = {
4690 static hda_nid_t alc260_test_adc_nids
[2] = {
4693 /* For testing the ALC260, each input MUX needs its own definition since
4694 * the signal assignments are different. This assumes that the first ADC
4697 static struct hda_input_mux alc260_test_capture_sources
[2] = {
4701 { "MIC1 pin", 0x0 },
4702 { "MIC2 pin", 0x1 },
4703 { "LINE1 pin", 0x2 },
4704 { "LINE2 pin", 0x3 },
4706 { "LINE-OUT pin", 0x5 },
4707 { "HP-OUT pin", 0x6 },
4713 { "MIC1 pin", 0x0 },
4714 { "MIC2 pin", 0x1 },
4715 { "LINE1 pin", 0x2 },
4716 { "LINE2 pin", 0x3 },
4719 { "LINE-OUT pin", 0x6 },
4720 { "HP-OUT pin", 0x7 },
4724 static struct snd_kcontrol_new alc260_test_mixer
[] = {
4725 /* Output driver widgets */
4726 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4727 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4728 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4729 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
4730 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4731 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
4733 /* Modes for retasking pin widgets
4734 * Note: the ALC260 doesn't seem to act on requests to enable mic
4735 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4736 * mention this restriction. At this stage it's not clear whether
4737 * this behaviour is intentional or is a hardware bug in chip
4738 * revisions available at least up until early 2006. Therefore for
4739 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4740 * choices, but if it turns out that the lack of mic bias for these
4741 * NIDs is intentional we could change their modes from
4742 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4744 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
4745 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
4746 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
4747 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
4748 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
4749 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
4751 /* Loopback mixer controls */
4752 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
4753 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
4754 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
4755 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
4756 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
4757 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
4758 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
4759 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
4760 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4761 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4762 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4763 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4764 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
4765 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
4766 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
4767 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
4769 /* Controls for GPIO pins, assuming they are configured as outputs */
4770 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4771 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4772 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4773 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4775 /* Switches to allow the digital IO pins to be enabled. The datasheet
4776 * is ambigious as to which NID is which; testing on laptops which
4777 * make this output available should provide clarification.
4779 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4780 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4782 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4783 * this output to turn on an external amplifier.
4785 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4786 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4790 static struct hda_verb alc260_test_init_verbs
[] = {
4791 /* Enable all GPIOs as outputs with an initial value of 0 */
4792 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
4793 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4794 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
4796 /* Enable retasking pins as output, initially without power amp */
4797 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4798 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4799 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4800 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4801 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4802 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4804 /* Disable digital (SPDIF) pins initially, but users can enable
4805 * them via a mixer switch. In the case of SPDIF-out, this initverb
4806 * payload also sets the generation to 0, output to be in "consumer"
4807 * PCM format, copyright asserted, no pre-emphasis and no validity
4810 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4811 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4813 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4814 * OUT1 sum bus when acting as an output.
4816 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4817 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
4818 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4819 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
4821 /* Start with output sum widgets muted and their output gains at min */
4822 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4823 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4824 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4825 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4826 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4827 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4828 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4829 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4830 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4832 /* Unmute retasking pin widget output buffers since the default
4833 * state appears to be output. As the pin mode is changed by the
4834 * user the pin mode control will take care of enabling the pin's
4835 * input/output buffers as needed.
4837 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4838 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4839 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4840 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4841 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4842 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4843 /* Also unmute the mono-out pin widget */
4844 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4846 /* Mute capture amp left and right */
4847 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4848 /* Set ADC connection select to match default mixer setting (mic1
4851 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4853 /* Do the same for the second ADC: mute capture input amp and
4854 * set ADC connection to mic1 pin
4856 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4857 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4859 /* Mute all inputs to mixer widget (even unconnected ones) */
4860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4861 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4862 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4863 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4864 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4865 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4866 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4867 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4873 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4874 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4876 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4877 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4880 * for BIOS auto-configuration
4883 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
4887 unsigned long vol_val
, sw_val
;
4891 if (nid
>= 0x0f && nid
< 0x11) {
4892 nid_vol
= nid
- 0x7;
4893 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
4894 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4895 } else if (nid
== 0x11) {
4896 nid_vol
= nid
- 0x7;
4897 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
4898 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
4899 } else if (nid
>= 0x12 && nid
<= 0x15) {
4901 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
4902 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4906 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
4907 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
);
4910 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
4911 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
);
4917 /* add playback controls from the parsed DAC table */
4918 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
4919 const struct auto_pin_cfg
*cfg
)
4924 spec
->multiout
.num_dacs
= 1;
4925 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
4926 spec
->multiout
.dac_nids
[0] = 0x02;
4928 nid
= cfg
->line_out_pins
[0];
4930 err
= alc260_add_playback_controls(spec
, nid
, "Front");
4935 nid
= cfg
->speaker_pins
[0];
4937 err
= alc260_add_playback_controls(spec
, nid
, "Speaker");
4942 nid
= cfg
->hp_pins
[0];
4944 err
= alc260_add_playback_controls(spec
, nid
, "Headphone");
4951 /* create playback/capture controls for input pins */
4952 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
4953 const struct auto_pin_cfg
*cfg
)
4955 struct hda_input_mux
*imux
= &spec
->private_imux
;
4958 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4959 if (cfg
->input_pins
[i
] >= 0x12) {
4960 idx
= cfg
->input_pins
[i
] - 0x12;
4961 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4962 auto_pin_cfg_labels
[i
], idx
,
4966 imux
->items
[imux
->num_items
].label
=
4967 auto_pin_cfg_labels
[i
];
4968 imux
->items
[imux
->num_items
].index
= idx
;
4971 if (cfg
->input_pins
[i
] >= 0x0f && cfg
->input_pins
[i
] <= 0x10){
4972 idx
= cfg
->input_pins
[i
] - 0x09;
4973 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4974 auto_pin_cfg_labels
[i
], idx
,
4978 imux
->items
[imux
->num_items
].label
=
4979 auto_pin_cfg_labels
[i
];
4980 imux
->items
[imux
->num_items
].index
= idx
;
4987 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
4988 hda_nid_t nid
, int pin_type
,
4991 alc_set_pin_output(codec
, nid
, pin_type
);
4992 /* need the manual connection? */
4994 int idx
= nid
- 0x12;
4995 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
4996 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
5000 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
5002 struct alc_spec
*spec
= codec
->spec
;
5005 alc_subsystem_id(codec
, 0x10, 0x15, 0x0f);
5006 nid
= spec
->autocfg
.line_out_pins
[0];
5008 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5009 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
5012 nid
= spec
->autocfg
.speaker_pins
[0];
5014 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
5016 nid
= spec
->autocfg
.hp_pins
[0];
5018 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
5021 #define ALC260_PIN_CD_NID 0x16
5022 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
5024 struct alc_spec
*spec
= codec
->spec
;
5027 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5028 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5030 snd_hda_codec_write(codec
, nid
, 0,
5031 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5032 i
<= AUTO_PIN_FRONT_MIC
?
5033 PIN_VREF80
: PIN_IN
);
5034 if (nid
!= ALC260_PIN_CD_NID
)
5035 snd_hda_codec_write(codec
, nid
, 0,
5036 AC_VERB_SET_AMP_GAIN_MUTE
,
5043 * generic initialization of ADC, input mixers and output mixers
5045 static struct hda_verb alc260_volume_init_verbs
[] = {
5047 * Unmute ADC0-1 and set the default input to mic-in
5049 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5050 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5051 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5052 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5054 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5056 * Note: PASD motherboards uses the Line In 2 as the input for
5057 * front panel mic (mic 2)
5059 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5060 /* mute analog inputs */
5061 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5062 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5063 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5064 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5065 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5068 * Set up output mixers (0x08 - 0x0a)
5070 /* set vol=0 to output mixers */
5071 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5073 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5074 /* set up input amps for analog loopback */
5075 /* Amp Indices: DAC = 0, mixer = 1 */
5076 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5077 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5078 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5079 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5080 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5081 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5086 static int alc260_parse_auto_config(struct hda_codec
*codec
)
5088 struct alc_spec
*spec
= codec
->spec
;
5091 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
5093 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5097 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
5100 if (!spec
->kctl_alloc
)
5101 return 0; /* can't find valid BIOS pin config */
5102 err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
5106 spec
->multiout
.max_channels
= 2;
5108 if (spec
->autocfg
.dig_out_pin
)
5109 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
5110 if (spec
->kctl_alloc
)
5111 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
5113 spec
->init_verbs
[spec
->num_init_verbs
++] = alc260_volume_init_verbs
;
5115 spec
->num_mux_defs
= 1;
5116 spec
->input_mux
= &spec
->private_imux
;
5118 /* check whether NID 0x04 is valid */
5119 wcap
= get_wcaps(codec
, 0x04);
5120 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
5121 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
5122 spec
->adc_nids
= alc260_adc_nids_alt
;
5123 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
5124 spec
->mixers
[spec
->num_mixers
] = alc260_capture_alt_mixer
;
5126 spec
->adc_nids
= alc260_adc_nids
;
5127 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
5128 spec
->mixers
[spec
->num_mixers
] = alc260_capture_mixer
;
5135 /* additional initialization for auto-configuration model */
5136 static void alc260_auto_init(struct hda_codec
*codec
)
5138 struct alc_spec
*spec
= codec
->spec
;
5139 alc260_auto_init_multi_out(codec
);
5140 alc260_auto_init_analog_input(codec
);
5141 if (spec
->unsol_event
)
5142 alc_sku_automute(codec
);
5145 #ifdef CONFIG_SND_HDA_POWER_SAVE
5146 static struct hda_amp_list alc260_loopbacks
[] = {
5147 { 0x07, HDA_INPUT
, 0 },
5148 { 0x07, HDA_INPUT
, 1 },
5149 { 0x07, HDA_INPUT
, 2 },
5150 { 0x07, HDA_INPUT
, 3 },
5151 { 0x07, HDA_INPUT
, 4 },
5157 * ALC260 configurations
5159 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
5160 [ALC260_BASIC
] = "basic",
5162 [ALC260_HP_3013
] = "hp-3013",
5163 [ALC260_FUJITSU_S702X
] = "fujitsu",
5164 [ALC260_ACER
] = "acer",
5165 [ALC260_WILL
] = "will",
5166 [ALC260_REPLACER_672V
] = "replacer",
5167 #ifdef CONFIG_SND_DEBUG
5168 [ALC260_TEST
] = "test",
5170 [ALC260_AUTO
] = "auto",
5173 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
5174 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
5175 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
5176 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
5177 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013
),
5178 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
5179 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013
),
5180 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013
),
5181 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
5182 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
5183 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
5184 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
5185 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
5186 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
5187 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
5188 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
5189 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
5190 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
5191 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
5195 static struct alc_config_preset alc260_presets
[] = {
5197 .mixers
= { alc260_base_output_mixer
,
5199 alc260_pc_beep_mixer
,
5200 alc260_capture_mixer
},
5201 .init_verbs
= { alc260_init_verbs
},
5202 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5203 .dac_nids
= alc260_dac_nids
,
5204 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5205 .adc_nids
= alc260_adc_nids
,
5206 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5207 .channel_mode
= alc260_modes
,
5208 .input_mux
= &alc260_capture_source
,
5211 .mixers
= { alc260_hp_output_mixer
,
5213 alc260_capture_alt_mixer
},
5214 .init_verbs
= { alc260_init_verbs
,
5215 alc260_hp_unsol_verbs
},
5216 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5217 .dac_nids
= alc260_dac_nids
,
5218 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
5219 .adc_nids
= alc260_hp_adc_nids
,
5220 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5221 .channel_mode
= alc260_modes
,
5222 .input_mux
= &alc260_capture_source
,
5223 .unsol_event
= alc260_hp_unsol_event
,
5224 .init_hook
= alc260_hp_automute
,
5226 [ALC260_HP_3013
] = {
5227 .mixers
= { alc260_hp_3013_mixer
,
5229 alc260_capture_alt_mixer
},
5230 .init_verbs
= { alc260_hp_3013_init_verbs
,
5231 alc260_hp_3013_unsol_verbs
},
5232 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5233 .dac_nids
= alc260_dac_nids
,
5234 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
5235 .adc_nids
= alc260_hp_adc_nids
,
5236 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5237 .channel_mode
= alc260_modes
,
5238 .input_mux
= &alc260_capture_source
,
5239 .unsol_event
= alc260_hp_3013_unsol_event
,
5240 .init_hook
= alc260_hp_3013_automute
,
5242 [ALC260_FUJITSU_S702X
] = {
5243 .mixers
= { alc260_fujitsu_mixer
,
5244 alc260_capture_mixer
},
5245 .init_verbs
= { alc260_fujitsu_init_verbs
},
5246 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5247 .dac_nids
= alc260_dac_nids
,
5248 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5249 .adc_nids
= alc260_dual_adc_nids
,
5250 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5251 .channel_mode
= alc260_modes
,
5252 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
5253 .input_mux
= alc260_fujitsu_capture_sources
,
5256 .mixers
= { alc260_acer_mixer
,
5257 alc260_capture_mixer
},
5258 .init_verbs
= { alc260_acer_init_verbs
},
5259 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5260 .dac_nids
= alc260_dac_nids
,
5261 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5262 .adc_nids
= alc260_dual_adc_nids
,
5263 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5264 .channel_mode
= alc260_modes
,
5265 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
5266 .input_mux
= alc260_acer_capture_sources
,
5269 .mixers
= { alc260_will_mixer
,
5270 alc260_capture_mixer
},
5271 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
5272 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5273 .dac_nids
= alc260_dac_nids
,
5274 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5275 .adc_nids
= alc260_adc_nids
,
5276 .dig_out_nid
= ALC260_DIGOUT_NID
,
5277 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5278 .channel_mode
= alc260_modes
,
5279 .input_mux
= &alc260_capture_source
,
5281 [ALC260_REPLACER_672V
] = {
5282 .mixers
= { alc260_replacer_672v_mixer
,
5283 alc260_capture_mixer
},
5284 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
5285 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5286 .dac_nids
= alc260_dac_nids
,
5287 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5288 .adc_nids
= alc260_adc_nids
,
5289 .dig_out_nid
= ALC260_DIGOUT_NID
,
5290 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5291 .channel_mode
= alc260_modes
,
5292 .input_mux
= &alc260_capture_source
,
5293 .unsol_event
= alc260_replacer_672v_unsol_event
,
5294 .init_hook
= alc260_replacer_672v_automute
,
5296 #ifdef CONFIG_SND_DEBUG
5298 .mixers
= { alc260_test_mixer
,
5299 alc260_capture_mixer
},
5300 .init_verbs
= { alc260_test_init_verbs
},
5301 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
5302 .dac_nids
= alc260_test_dac_nids
,
5303 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
5304 .adc_nids
= alc260_test_adc_nids
,
5305 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5306 .channel_mode
= alc260_modes
,
5307 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
5308 .input_mux
= alc260_test_capture_sources
,
5313 static int patch_alc260(struct hda_codec
*codec
)
5315 struct alc_spec
*spec
;
5316 int err
, board_config
;
5318 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5324 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
5327 if (board_config
< 0) {
5328 snd_printd(KERN_INFO
"hda_codec: Unknown model for ALC260, "
5329 "trying auto-probe from BIOS...\n");
5330 board_config
= ALC260_AUTO
;
5333 if (board_config
== ALC260_AUTO
) {
5334 /* automatic parse from the BIOS config */
5335 err
= alc260_parse_auto_config(codec
);
5341 "hda_codec: Cannot set up configuration "
5342 "from BIOS. Using base mode...\n");
5343 board_config
= ALC260_BASIC
;
5347 if (board_config
!= ALC260_AUTO
)
5348 setup_preset(spec
, &alc260_presets
[board_config
]);
5350 spec
->stream_name_analog
= "ALC260 Analog";
5351 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
5352 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
5354 spec
->stream_name_digital
= "ALC260 Digital";
5355 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
5356 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
5358 spec
->vmaster_nid
= 0x08;
5360 codec
->patch_ops
= alc_patch_ops
;
5361 if (board_config
== ALC260_AUTO
)
5362 spec
->init_hook
= alc260_auto_init
;
5363 #ifdef CONFIG_SND_HDA_POWER_SAVE
5364 if (!spec
->loopback
.amplist
)
5365 spec
->loopback
.amplist
= alc260_loopbacks
;
5375 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5376 * configuration. Each pin widget can choose any input DACs and a mixer.
5377 * Each ADC is connected from a mixer of all inputs. This makes possible
5378 * 6-channel independent captures.
5380 * In addition, an independent DAC for the multi-playback (not used in this
5383 #define ALC882_DIGOUT_NID 0x06
5384 #define ALC882_DIGIN_NID 0x0a
5386 static struct hda_channel_mode alc882_ch_modes
[1] = {
5390 static hda_nid_t alc882_dac_nids
[4] = {
5391 /* front, rear, clfe, rear_surr */
5392 0x02, 0x03, 0x04, 0x05
5395 /* identical with ALC880 */
5396 #define alc882_adc_nids alc880_adc_nids
5397 #define alc882_adc_nids_alt alc880_adc_nids_alt
5399 static hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
5400 static hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
5403 /* FIXME: should be a matrix-type input source selection */
5405 static struct hda_input_mux alc882_capture_source
= {
5409 { "Front Mic", 0x1 },
5414 #define alc882_mux_enum_info alc_mux_enum_info
5415 #define alc882_mux_enum_get alc_mux_enum_get
5417 static int alc882_mux_enum_put(struct snd_kcontrol
*kcontrol
,
5418 struct snd_ctl_elem_value
*ucontrol
)
5420 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5421 struct alc_spec
*spec
= codec
->spec
;
5422 const struct hda_input_mux
*imux
= spec
->input_mux
;
5423 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
5424 hda_nid_t nid
= spec
->capsrc_nids
?
5425 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
5426 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
5427 unsigned int i
, idx
;
5429 idx
= ucontrol
->value
.enumerated
.item
[0];
5430 if (idx
>= imux
->num_items
)
5431 idx
= imux
->num_items
- 1;
5432 if (*cur_val
== idx
)
5434 for (i
= 0; i
< imux
->num_items
; i
++) {
5435 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
5436 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
5437 imux
->items
[i
].index
,
5447 static struct hda_verb alc882_3ST_ch2_init
[] = {
5448 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5449 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5450 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5451 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5458 static struct hda_verb alc882_3ST_ch6_init
[] = {
5459 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5460 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5461 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
5462 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5463 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5464 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5468 static struct hda_channel_mode alc882_3ST_6ch_modes
[2] = {
5469 { 2, alc882_3ST_ch2_init
},
5470 { 6, alc882_3ST_ch6_init
},
5476 static struct hda_verb alc882_sixstack_ch6_init
[] = {
5477 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
5478 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5479 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5480 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5487 static struct hda_verb alc882_sixstack_ch8_init
[] = {
5488 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5489 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5490 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5491 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5495 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
5496 { 6, alc882_sixstack_ch6_init
},
5497 { 8, alc882_sixstack_ch8_init
},
5501 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5507 static struct hda_verb alc885_mbp_ch2_init
[] = {
5508 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5509 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5510 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5517 static struct hda_verb alc885_mbp_ch6_init
[] = {
5518 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5519 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5520 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5521 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5522 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5526 static struct hda_channel_mode alc885_mbp_6ch_modes
[2] = {
5527 { 2, alc885_mbp_ch2_init
},
5528 { 6, alc885_mbp_ch6_init
},
5532 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5533 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5535 static struct snd_kcontrol_new alc882_base_mixer
[] = {
5536 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5537 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5538 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5539 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5540 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5541 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5542 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5543 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5544 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
5545 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
5546 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5547 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5548 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5549 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5550 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5551 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5552 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5553 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5554 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5555 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5556 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5557 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5558 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5562 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
5563 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
5564 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
5565 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT
),
5566 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
5567 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5568 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5569 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
5570 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
5571 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT
),
5572 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
5575 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
5576 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5577 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5578 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5579 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5580 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5581 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5582 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5583 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5584 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5585 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5586 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5590 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
5591 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5592 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5593 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5594 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5595 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5596 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5597 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5598 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5599 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5600 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5601 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5602 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5603 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5607 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5608 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5610 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
5611 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5612 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5613 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5614 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
5615 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5616 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5617 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5618 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5619 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
5620 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
5621 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5622 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5623 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5627 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
5628 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5629 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5630 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5631 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5632 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5633 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5634 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5635 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5636 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5637 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5638 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5639 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5643 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
5645 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5646 .name
= "Channel Mode",
5647 .info
= alc_ch_mode_info
,
5648 .get
= alc_ch_mode_get
,
5649 .put
= alc_ch_mode_put
,
5654 static struct hda_verb alc882_init_verbs
[] = {
5655 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5657 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5660 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5662 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5664 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5665 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5666 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5668 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5669 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5670 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5672 /* Front Pin: output 0 (0x0c) */
5673 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5674 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5675 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5676 /* Rear Pin: output 1 (0x0d) */
5677 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5678 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5679 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5680 /* CLFE Pin: output 2 (0x0e) */
5681 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5682 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5683 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
5684 /* Side Pin: output 3 (0x0f) */
5685 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5686 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5687 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
5688 /* Mic (rear) pin: input vref at 80% */
5689 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5690 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5691 /* Front Mic pin: input vref at 80% */
5692 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5693 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5694 /* Line In pin: input */
5695 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5696 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5697 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5698 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5699 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5700 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5701 /* CD pin widget for input */
5702 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5704 /* FIXME: use matrix-type input source selection */
5705 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5706 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5709 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5710 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5712 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5713 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5714 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5715 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5717 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5719 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5720 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5721 /* ADC1: mute amp left and right */
5722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5723 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5724 /* ADC2: mute amp left and right */
5725 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5726 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5727 /* ADC3: mute amp left and right */
5728 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5729 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5734 static struct hda_verb alc882_eapd_verbs
[] = {
5735 /* change to EAPD mode */
5736 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
5737 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
5742 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
5743 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5744 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5745 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
5746 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5747 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5748 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5749 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5753 static struct hda_verb alc882_macpro_init_verbs
[] = {
5754 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5755 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5756 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5757 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5758 /* Front Pin: output 0 (0x0c) */
5759 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5760 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5761 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5762 /* Front Mic pin: input vref at 80% */
5763 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5764 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5765 /* Speaker: output */
5766 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5767 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5768 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
5769 /* Headphone output (output 0 - 0x0c) */
5770 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5771 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5772 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5774 /* FIXME: use matrix-type input source selection */
5775 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5776 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5779 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5780 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5782 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5784 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5785 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5787 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5789 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5791 /* ADC1: mute amp left and right */
5792 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5793 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5794 /* ADC2: mute amp left and right */
5795 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5796 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5797 /* ADC3: mute amp left and right */
5798 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5799 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5804 /* Macbook Pro rev3 */
5805 static struct hda_verb alc885_mbp3_init_verbs
[] = {
5806 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5807 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5808 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5809 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5811 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5812 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5813 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5814 /* Front Pin: output 0 (0x0c) */
5815 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5816 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5817 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5818 /* HP Pin: output 0 (0x0d) */
5819 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
5820 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5821 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5822 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5823 /* Mic (rear) pin: input vref at 80% */
5824 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5825 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5826 /* Front Mic pin: input vref at 80% */
5827 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5828 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5829 /* Line In pin: use output 1 when in LineOut mode */
5830 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5832 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
5834 /* FIXME: use matrix-type input source selection */
5835 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5836 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5837 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5838 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5839 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5840 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5842 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5843 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5844 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5845 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5847 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5848 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5849 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5850 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5851 /* ADC1: mute amp left and right */
5852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5853 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5854 /* ADC2: mute amp left and right */
5855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5856 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5857 /* ADC3: mute amp left and right */
5858 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5859 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5864 /* iMac 24 mixer. */
5865 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
5866 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
5867 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
5871 /* iMac 24 init verbs. */
5872 static struct hda_verb alc885_imac24_init_verbs
[] = {
5873 /* Internal speakers: output 0 (0x0c) */
5874 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5875 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5876 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5877 /* Internal speakers: output 0 (0x0c) */
5878 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5879 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5880 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
5881 /* Headphone: output 0 (0x0c) */
5882 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5883 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5884 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5885 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5886 /* Front Mic: input vref at 80% */
5887 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5888 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5892 /* Toggle speaker-output according to the hp-jack state */
5893 static void alc885_imac24_automute(struct hda_codec
*codec
)
5895 unsigned int present
;
5897 present
= snd_hda_codec_read(codec
, 0x14, 0,
5898 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5899 snd_hda_codec_amp_stereo(codec
, 0x18, HDA_OUTPUT
, 0,
5900 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5901 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_OUTPUT
, 0,
5902 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5905 /* Processes unsolicited events. */
5906 static void alc885_imac24_unsol_event(struct hda_codec
*codec
,
5909 /* Headphone insertion or removal. */
5910 if ((res
>> 26) == ALC880_HP_EVENT
)
5911 alc885_imac24_automute(codec
);
5914 static void alc885_mbp3_automute(struct hda_codec
*codec
)
5916 unsigned int present
;
5918 present
= snd_hda_codec_read(codec
, 0x15, 0,
5919 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5920 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
5921 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5922 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
5923 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
5926 static void alc885_mbp3_unsol_event(struct hda_codec
*codec
,
5929 /* Headphone insertion or removal. */
5930 if ((res
>> 26) == ALC880_HP_EVENT
)
5931 alc885_mbp3_automute(codec
);
5935 static struct hda_verb alc882_targa_verbs
[] = {
5936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5939 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5940 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5942 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5943 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5944 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5946 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5947 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
5948 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
5949 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
5953 /* toggle speaker-output according to the hp-jack state */
5954 static void alc882_targa_automute(struct hda_codec
*codec
)
5956 unsigned int present
;
5958 present
= snd_hda_codec_read(codec
, 0x14, 0,
5959 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5960 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
5961 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5962 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
5966 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
5968 /* Looks like the unsol event is incompatible with the standard
5969 * definition. 4bit tag is placed at 26 bit!
5971 if (((res
>> 26) == ALC880_HP_EVENT
)) {
5972 alc882_targa_automute(codec
);
5976 static struct hda_verb alc882_asus_a7j_verbs
[] = {
5977 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5978 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5980 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5981 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5982 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5984 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5985 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5986 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5988 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5989 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5990 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5994 static struct hda_verb alc882_asus_a7m_verbs
[] = {
5995 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5996 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5998 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5999 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6000 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6002 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6003 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6004 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
6006 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6007 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6008 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6012 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
6014 unsigned int gpiostate
, gpiomask
, gpiodir
;
6016 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6017 AC_VERB_GET_GPIO_DATA
, 0);
6020 gpiostate
|= (1 << pin
);
6022 gpiostate
&= ~(1 << pin
);
6024 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6025 AC_VERB_GET_GPIO_MASK
, 0);
6026 gpiomask
|= (1 << pin
);
6028 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6029 AC_VERB_GET_GPIO_DIRECTION
, 0);
6030 gpiodir
|= (1 << pin
);
6033 snd_hda_codec_write(codec
, codec
->afg
, 0,
6034 AC_VERB_SET_GPIO_MASK
, gpiomask
);
6035 snd_hda_codec_write(codec
, codec
->afg
, 0,
6036 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
6040 snd_hda_codec_write(codec
, codec
->afg
, 0,
6041 AC_VERB_SET_GPIO_DATA
, gpiostate
);
6044 /* set up GPIO at initialization */
6045 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
6047 alc882_gpio_mute(codec
, 0, 0);
6048 alc882_gpio_mute(codec
, 1, 0);
6051 /* set up GPIO and update auto-muting at initialization */
6052 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
6054 alc885_macpro_init_hook(codec
);
6055 alc885_imac24_automute(codec
);
6059 * generic initialization of ADC, input mixers and output mixers
6061 static struct hda_verb alc882_auto_init_verbs
[] = {
6063 * Unmute ADC0-2 and set the default input to mic-in
6065 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6066 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6067 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6068 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6069 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6070 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6072 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6074 * Note: PASD motherboards uses the Line In 2 as the input for
6075 * front panel mic (mic 2)
6077 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6078 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6079 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6080 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6081 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6082 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6085 * Set up output mixers (0x0c - 0x0f)
6087 /* set vol=0 to output mixers */
6088 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6089 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6090 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6091 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6092 /* set up input amps for analog loopback */
6093 /* Amp Indices: DAC = 0, mixer = 1 */
6094 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6095 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6096 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6097 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6098 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6099 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6100 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6101 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6102 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6103 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6105 /* FIXME: use matrix-type input source selection */
6106 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6107 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6108 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6109 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6110 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6111 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6113 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6114 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6115 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6116 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6118 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6119 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6120 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6121 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6126 /* capture mixer elements */
6127 static struct snd_kcontrol_new alc882_capture_alt_mixer
[] = {
6128 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6129 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6130 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6131 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6133 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6134 /* The multiple "Capture Source" controls confuse alsamixer
6135 * So call somewhat different..
6137 /* .name = "Capture Source", */
6138 .name
= "Input Source",
6140 .info
= alc882_mux_enum_info
,
6141 .get
= alc882_mux_enum_get
,
6142 .put
= alc882_mux_enum_put
,
6147 static struct snd_kcontrol_new alc882_capture_mixer
[] = {
6148 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
6149 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
6150 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
6151 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
6152 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
6153 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
6155 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6156 /* The multiple "Capture Source" controls confuse alsamixer
6157 * So call somewhat different..
6159 /* .name = "Capture Source", */
6160 .name
= "Input Source",
6162 .info
= alc882_mux_enum_info
,
6163 .get
= alc882_mux_enum_get
,
6164 .put
= alc882_mux_enum_put
,
6169 #ifdef CONFIG_SND_HDA_POWER_SAVE
6170 #define alc882_loopbacks alc880_loopbacks
6173 /* pcm configuration: identiacal with ALC880 */
6174 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6175 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6176 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6177 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6180 * configuration and preset
6182 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
6183 [ALC882_3ST_DIG
] = "3stack-dig",
6184 [ALC882_6ST_DIG
] = "6stack-dig",
6185 [ALC882_ARIMA
] = "arima",
6186 [ALC882_W2JC
] = "w2jc",
6187 [ALC882_TARGA
] = "targa",
6188 [ALC882_ASUS_A7J
] = "asus-a7j",
6189 [ALC882_ASUS_A7M
] = "asus-a7m",
6190 [ALC885_MACPRO
] = "macpro",
6191 [ALC885_MBP3
] = "mbp3",
6192 [ALC885_IMAC24
] = "imac24",
6193 [ALC882_AUTO
] = "auto",
6196 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
6197 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
6198 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
6199 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
6200 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
6201 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
6202 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
6203 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
6204 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
6205 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
6206 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
6207 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
6208 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA
),
6212 static struct alc_config_preset alc882_presets
[] = {
6213 [ALC882_3ST_DIG
] = {
6214 .mixers
= { alc882_base_mixer
},
6215 .init_verbs
= { alc882_init_verbs
},
6216 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6217 .dac_nids
= alc882_dac_nids
,
6218 .dig_out_nid
= ALC882_DIGOUT_NID
,
6219 .dig_in_nid
= ALC882_DIGIN_NID
,
6220 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6221 .channel_mode
= alc882_ch_modes
,
6223 .input_mux
= &alc882_capture_source
,
6225 [ALC882_6ST_DIG
] = {
6226 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
6227 .init_verbs
= { alc882_init_verbs
},
6228 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6229 .dac_nids
= alc882_dac_nids
,
6230 .dig_out_nid
= ALC882_DIGOUT_NID
,
6231 .dig_in_nid
= ALC882_DIGIN_NID
,
6232 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
6233 .channel_mode
= alc882_sixstack_modes
,
6234 .input_mux
= &alc882_capture_source
,
6237 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
6238 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
},
6239 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6240 .dac_nids
= alc882_dac_nids
,
6241 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
6242 .channel_mode
= alc882_sixstack_modes
,
6243 .input_mux
= &alc882_capture_source
,
6246 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
6247 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
6248 alc880_gpio1_init_verbs
},
6249 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6250 .dac_nids
= alc882_dac_nids
,
6251 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
6252 .channel_mode
= alc880_threestack_modes
,
6254 .input_mux
= &alc882_capture_source
,
6255 .dig_out_nid
= ALC882_DIGOUT_NID
,
6258 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
6259 .init_verbs
= { alc885_mbp3_init_verbs
,
6260 alc880_gpio1_init_verbs
},
6261 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6262 .dac_nids
= alc882_dac_nids
,
6263 .channel_mode
= alc885_mbp_6ch_modes
,
6264 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_6ch_modes
),
6265 .input_mux
= &alc882_capture_source
,
6266 .dig_out_nid
= ALC882_DIGOUT_NID
,
6267 .dig_in_nid
= ALC882_DIGIN_NID
,
6268 .unsol_event
= alc885_mbp3_unsol_event
,
6269 .init_hook
= alc885_mbp3_automute
,
6272 .mixers
= { alc882_macpro_mixer
},
6273 .init_verbs
= { alc882_macpro_init_verbs
},
6274 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6275 .dac_nids
= alc882_dac_nids
,
6276 .dig_out_nid
= ALC882_DIGOUT_NID
,
6277 .dig_in_nid
= ALC882_DIGIN_NID
,
6278 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6279 .channel_mode
= alc882_ch_modes
,
6280 .input_mux
= &alc882_capture_source
,
6281 .init_hook
= alc885_macpro_init_hook
,
6284 .mixers
= { alc885_imac24_mixer
},
6285 .init_verbs
= { alc885_imac24_init_verbs
},
6286 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6287 .dac_nids
= alc882_dac_nids
,
6288 .dig_out_nid
= ALC882_DIGOUT_NID
,
6289 .dig_in_nid
= ALC882_DIGIN_NID
,
6290 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6291 .channel_mode
= alc882_ch_modes
,
6292 .input_mux
= &alc882_capture_source
,
6293 .unsol_event
= alc885_imac24_unsol_event
,
6294 .init_hook
= alc885_imac24_init_hook
,
6297 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
,
6298 alc882_capture_mixer
},
6299 .init_verbs
= { alc882_init_verbs
, alc882_targa_verbs
},
6300 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6301 .dac_nids
= alc882_dac_nids
,
6302 .dig_out_nid
= ALC882_DIGOUT_NID
,
6303 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
6304 .adc_nids
= alc882_adc_nids
,
6305 .capsrc_nids
= alc882_capsrc_nids
,
6306 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
6307 .channel_mode
= alc882_3ST_6ch_modes
,
6309 .input_mux
= &alc882_capture_source
,
6310 .unsol_event
= alc882_targa_unsol_event
,
6311 .init_hook
= alc882_targa_automute
,
6313 [ALC882_ASUS_A7J
] = {
6314 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
,
6315 alc882_capture_mixer
},
6316 .init_verbs
= { alc882_init_verbs
, alc882_asus_a7j_verbs
},
6317 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6318 .dac_nids
= alc882_dac_nids
,
6319 .dig_out_nid
= ALC882_DIGOUT_NID
,
6320 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
6321 .adc_nids
= alc882_adc_nids
,
6322 .capsrc_nids
= alc882_capsrc_nids
,
6323 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
6324 .channel_mode
= alc882_3ST_6ch_modes
,
6326 .input_mux
= &alc882_capture_source
,
6328 [ALC882_ASUS_A7M
] = {
6329 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
6330 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
6331 alc880_gpio1_init_verbs
,
6332 alc882_asus_a7m_verbs
},
6333 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6334 .dac_nids
= alc882_dac_nids
,
6335 .dig_out_nid
= ALC882_DIGOUT_NID
,
6336 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
6337 .channel_mode
= alc880_threestack_modes
,
6339 .input_mux
= &alc882_capture_source
,
6348 PINFIX_ABIT_AW9D_MAX
6351 static struct alc_pincfg alc882_abit_aw9d_pinfix
[] = {
6352 { 0x15, 0x01080104 }, /* side */
6353 { 0x16, 0x01011012 }, /* rear */
6354 { 0x17, 0x01016011 }, /* clfe */
6358 static const struct alc_pincfg
*alc882_pin_fixes
[] = {
6359 [PINFIX_ABIT_AW9D_MAX
] = alc882_abit_aw9d_pinfix
,
6362 static struct snd_pci_quirk alc882_pinfix_tbl
[] = {
6363 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
6368 * BIOS auto configuration
6370 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
6371 hda_nid_t nid
, int pin_type
,
6375 struct alc_spec
*spec
= codec
->spec
;
6378 alc_set_pin_output(codec
, nid
, pin_type
);
6379 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
6382 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
6383 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
6387 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
6389 struct alc_spec
*spec
= codec
->spec
;
6392 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
6393 for (i
= 0; i
<= HDA_SIDE
; i
++) {
6394 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
6395 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
6397 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
6402 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
6404 struct alc_spec
*spec
= codec
->spec
;
6407 pin
= spec
->autocfg
.hp_pins
[0];
6408 if (pin
) /* connect to front */
6410 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
6411 pin
= spec
->autocfg
.speaker_pins
[0];
6413 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
6416 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6417 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6419 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
6421 struct alc_spec
*spec
= codec
->spec
;
6424 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
6425 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
6430 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6431 unsigned int pincap
;
6432 pincap
= snd_hda_param_read(codec
, nid
, AC_PAR_PIN_CAP
);
6433 if ((pincap
>> AC_PINCAP_VREF_SHIFT
) &
6437 snd_hda_codec_write(codec
, nid
, 0,
6438 AC_VERB_SET_PIN_WIDGET_CONTROL
, vref
);
6439 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
6440 snd_hda_codec_write(codec
, nid
, 0,
6441 AC_VERB_SET_AMP_GAIN_MUTE
,
6446 static void alc882_auto_init_input_src(struct hda_codec
*codec
)
6448 struct alc_spec
*spec
= codec
->spec
;
6449 const struct hda_input_mux
*imux
= spec
->input_mux
;
6452 for (c
= 0; c
< spec
->num_adc_nids
; c
++) {
6453 hda_nid_t conn_list
[HDA_MAX_NUM_INPUTS
];
6454 hda_nid_t nid
= spec
->capsrc_nids
[c
];
6455 int conns
, mute
, idx
, item
;
6457 conns
= snd_hda_get_connections(codec
, nid
, conn_list
,
6458 ARRAY_SIZE(conn_list
));
6461 for (idx
= 0; idx
< conns
; idx
++) {
6462 /* if the current connection is the selected one,
6463 * unmute it as default - otherwise mute it
6465 mute
= AMP_IN_MUTE(idx
);
6466 for (item
= 0; item
< imux
->num_items
; item
++) {
6467 if (imux
->items
[item
].index
== idx
) {
6468 if (spec
->cur_mux
[c
] == item
)
6469 mute
= AMP_IN_UNMUTE(idx
);
6473 snd_hda_codec_write(codec
, nid
, 0,
6474 AC_VERB_SET_AMP_GAIN_MUTE
, mute
);
6479 /* add mic boosts if needed */
6480 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
6482 struct alc_spec
*spec
= codec
->spec
;
6486 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
6487 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
6488 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6490 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6494 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
6495 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
6496 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6498 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6505 /* almost identical with ALC880 parser... */
6506 static int alc882_parse_auto_config(struct hda_codec
*codec
)
6508 struct alc_spec
*spec
= codec
->spec
;
6509 int err
= alc880_parse_auto_config(codec
);
6514 return 0; /* no config found */
6516 err
= alc_auto_add_mic_boost(codec
);
6520 /* hack - override the init verbs */
6521 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
6523 return 1; /* config found */
6526 /* additional initialization for auto-configuration model */
6527 static void alc882_auto_init(struct hda_codec
*codec
)
6529 struct alc_spec
*spec
= codec
->spec
;
6530 alc882_auto_init_multi_out(codec
);
6531 alc882_auto_init_hp_out(codec
);
6532 alc882_auto_init_analog_input(codec
);
6533 alc882_auto_init_input_src(codec
);
6534 if (spec
->unsol_event
)
6535 alc_sku_automute(codec
);
6538 static int patch_alc883(struct hda_codec
*codec
); /* called in patch_alc882() */
6540 static int patch_alc882(struct hda_codec
*codec
)
6542 struct alc_spec
*spec
;
6543 int err
, board_config
;
6545 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6551 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
6555 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
6556 /* Pick up systems that don't supply PCI SSID */
6557 switch (codec
->subsystem_id
) {
6558 case 0x106b0c00: /* Mac Pro */
6559 board_config
= ALC885_MACPRO
;
6561 case 0x106b1000: /* iMac 24 */
6562 board_config
= ALC885_IMAC24
;
6564 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
6565 case 0x106b2c00: /* Macbook Pro rev3 */
6566 case 0x106b3600: /* Macbook 3.1 */
6567 board_config
= ALC885_MBP3
;
6570 /* ALC889A is handled better as ALC888-compatible */
6571 if (codec
->revision_id
== 0x100103) {
6573 return patch_alc883(codec
);
6575 printk(KERN_INFO
"hda_codec: Unknown model for ALC882, "
6576 "trying auto-probe from BIOS...\n");
6577 board_config
= ALC882_AUTO
;
6581 alc_fix_pincfg(codec
, alc882_pinfix_tbl
, alc882_pin_fixes
);
6583 if (board_config
== ALC882_AUTO
) {
6584 /* automatic parse from the BIOS config */
6585 err
= alc882_parse_auto_config(codec
);
6591 "hda_codec: Cannot set up configuration "
6592 "from BIOS. Using base mode...\n");
6593 board_config
= ALC882_3ST_DIG
;
6597 if (board_config
!= ALC882_AUTO
)
6598 setup_preset(spec
, &alc882_presets
[board_config
]);
6600 if (codec
->vendor_id
== 0x10ec0885) {
6601 spec
->stream_name_analog
= "ALC885 Analog";
6602 spec
->stream_name_digital
= "ALC885 Digital";
6604 spec
->stream_name_analog
= "ALC882 Analog";
6605 spec
->stream_name_digital
= "ALC882 Digital";
6608 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
6609 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
6610 /* FIXME: setup DAC5 */
6611 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6612 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
6614 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
6615 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
6617 if (!spec
->adc_nids
&& spec
->input_mux
) {
6618 /* check whether NID 0x07 is valid */
6619 unsigned int wcap
= get_wcaps(codec
, 0x07);
6621 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
6622 if (wcap
!= AC_WID_AUD_IN
) {
6623 spec
->adc_nids
= alc882_adc_nids_alt
;
6624 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
6625 spec
->capsrc_nids
= alc882_capsrc_nids_alt
;
6626 spec
->mixers
[spec
->num_mixers
] =
6627 alc882_capture_alt_mixer
;
6630 spec
->adc_nids
= alc882_adc_nids
;
6631 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
6632 spec
->capsrc_nids
= alc882_capsrc_nids
;
6633 spec
->mixers
[spec
->num_mixers
] = alc882_capture_mixer
;
6638 spec
->vmaster_nid
= 0x0c;
6640 codec
->patch_ops
= alc_patch_ops
;
6641 if (board_config
== ALC882_AUTO
)
6642 spec
->init_hook
= alc882_auto_init
;
6643 #ifdef CONFIG_SND_HDA_POWER_SAVE
6644 if (!spec
->loopback
.amplist
)
6645 spec
->loopback
.amplist
= alc882_loopbacks
;
6654 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6655 * configuration. Each pin widget can choose any input DACs and a mixer.
6656 * Each ADC is connected from a mixer of all inputs. This makes possible
6657 * 6-channel independent captures.
6659 * In addition, an independent DAC for the multi-playback (not used in this
6662 #define ALC883_DIGOUT_NID 0x06
6663 #define ALC883_DIGIN_NID 0x0a
6665 static hda_nid_t alc883_dac_nids
[4] = {
6666 /* front, rear, clfe, rear_surr */
6667 0x02, 0x03, 0x04, 0x05
6670 static hda_nid_t alc883_adc_nids
[2] = {
6675 static hda_nid_t alc883_capsrc_nids
[2] = { 0x23, 0x22 };
6678 /* FIXME: should be a matrix-type input source selection */
6680 static struct hda_input_mux alc883_capture_source
= {
6684 { "Front Mic", 0x1 },
6690 static struct hda_input_mux alc883_3stack_6ch_intel
= {
6694 { "Front Mic", 0x0 },
6700 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
6708 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
6718 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
6726 #define alc883_mux_enum_info alc_mux_enum_info
6727 #define alc883_mux_enum_get alc_mux_enum_get
6728 /* ALC883 has the ALC882-type input selection */
6729 #define alc883_mux_enum_put alc882_mux_enum_put
6734 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
6741 static struct hda_verb alc883_3ST_ch2_init
[] = {
6742 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6743 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6744 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6745 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6752 static struct hda_verb alc883_3ST_ch4_init
[] = {
6753 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6754 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6755 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6756 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6757 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6764 static struct hda_verb alc883_3ST_ch6_init
[] = {
6765 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6766 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6767 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6768 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6769 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6770 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6774 static struct hda_channel_mode alc883_3ST_6ch_modes
[3] = {
6775 { 2, alc883_3ST_ch2_init
},
6776 { 4, alc883_3ST_ch4_init
},
6777 { 6, alc883_3ST_ch6_init
},
6783 static struct hda_verb alc883_3ST_ch2_intel_init
[] = {
6784 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6785 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6786 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6787 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6794 static struct hda_verb alc883_3ST_ch4_intel_init
[] = {
6795 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6796 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6797 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6798 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6799 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6806 static struct hda_verb alc883_3ST_ch6_intel_init
[] = {
6807 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6808 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6809 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6810 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6811 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6812 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6816 static struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
6817 { 2, alc883_3ST_ch2_intel_init
},
6818 { 4, alc883_3ST_ch4_intel_init
},
6819 { 6, alc883_3ST_ch6_intel_init
},
6825 static struct hda_verb alc883_sixstack_ch6_init
[] = {
6826 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6827 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6828 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6829 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6836 static struct hda_verb alc883_sixstack_ch8_init
[] = {
6837 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6838 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6839 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6840 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6844 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
6845 { 6, alc883_sixstack_ch6_init
},
6846 { 8, alc883_sixstack_ch8_init
},
6849 static struct hda_verb alc883_medion_eapd_verbs
[] = {
6850 /* eanable EAPD on medion laptop */
6851 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
6852 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
6856 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6857 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6860 static struct snd_kcontrol_new alc883_base_mixer
[] = {
6861 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6862 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6863 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6864 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6865 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6866 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6867 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6868 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6869 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
6870 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
6871 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6872 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6873 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6874 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6875 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6876 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6877 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6878 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6879 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6880 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6881 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6882 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6883 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6884 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6885 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6886 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6887 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6889 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6890 /* .name = "Capture Source", */
6891 .name
= "Input Source",
6893 .info
= alc883_mux_enum_info
,
6894 .get
= alc883_mux_enum_get
,
6895 .put
= alc883_mux_enum_put
,
6900 static struct snd_kcontrol_new alc883_mitac_mixer
[] = {
6901 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6902 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6903 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6904 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6905 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6906 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6907 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6908 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6909 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6910 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6911 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6912 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6913 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6914 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6915 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6916 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6917 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6919 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6920 /* .name = "Capture Source", */
6921 .name
= "Input Source",
6923 .info
= alc883_mux_enum_info
,
6924 .get
= alc883_mux_enum_get
,
6925 .put
= alc883_mux_enum_put
,
6930 static struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
6931 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6932 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
6933 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6934 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
6935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6936 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6937 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6938 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6939 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
6940 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6941 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6942 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6943 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6944 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6946 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6947 /* .name = "Capture Source", */
6948 .name
= "Input Source",
6950 .info
= alc883_mux_enum_info
,
6951 .get
= alc883_mux_enum_get
,
6952 .put
= alc883_mux_enum_put
,
6957 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
6958 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6959 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
6960 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6961 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
6962 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6963 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6964 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6965 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6966 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
6967 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6968 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6969 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6970 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6971 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6973 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6974 /* .name = "Capture Source", */
6975 .name
= "Input Source",
6977 .info
= alc883_mux_enum_info
,
6978 .get
= alc883_mux_enum_get
,
6979 .put
= alc883_mux_enum_put
,
6984 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
6985 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6986 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6987 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6988 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6989 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6990 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6991 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6993 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6996 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6997 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6998 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6999 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7000 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7001 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7002 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7003 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7005 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7006 /* .name = "Capture Source", */
7007 .name
= "Input Source",
7009 .info
= alc883_mux_enum_info
,
7010 .get
= alc883_mux_enum_get
,
7011 .put
= alc883_mux_enum_put
,
7016 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
7017 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7018 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7019 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7020 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7021 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7022 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7023 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7024 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7025 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7026 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7027 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7028 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7029 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7031 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7032 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7033 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7034 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7035 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7036 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7037 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7038 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7039 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7040 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7041 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7043 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7044 /* .name = "Capture Source", */
7045 .name
= "Input Source",
7047 .info
= alc883_mux_enum_info
,
7048 .get
= alc883_mux_enum_get
,
7049 .put
= alc883_mux_enum_put
,
7054 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer
[] = {
7055 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7056 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7057 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7058 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7059 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7061 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7062 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7063 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7064 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7065 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7066 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7067 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7068 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7069 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7070 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
7071 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7072 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7073 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT
),
7074 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7075 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7076 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7077 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7078 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7079 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7080 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7082 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7083 /* .name = "Capture Source", */
7084 .name
= "Input Source",
7086 .info
= alc883_mux_enum_info
,
7087 .get
= alc883_mux_enum_get
,
7088 .put
= alc883_mux_enum_put
,
7093 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
7094 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7095 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7096 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7097 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7098 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7099 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7100 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7101 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7102 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7103 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7104 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7105 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7106 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7108 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7110 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7111 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7112 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7113 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7114 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7115 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7116 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7119 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7120 /* .name = "Capture Source", */
7121 .name
= "Input Source",
7123 .info
= alc883_mux_enum_info
,
7124 .get
= alc883_mux_enum_get
,
7125 .put
= alc883_mux_enum_put
,
7130 static struct snd_kcontrol_new alc883_tagra_mixer
[] = {
7131 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7132 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7133 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7134 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7135 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7136 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7137 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7138 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7139 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7140 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7141 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7142 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7143 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7145 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7147 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7148 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7149 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7150 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7152 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7153 /* .name = "Capture Source", */
7154 .name
= "Input Source",
7156 .info
= alc883_mux_enum_info
,
7157 .get
= alc883_mux_enum_get
,
7158 .put
= alc883_mux_enum_put
,
7163 static struct snd_kcontrol_new alc883_tagra_2ch_mixer
[] = {
7164 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7166 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7167 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7168 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7170 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7171 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7172 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7173 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
7174 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7175 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7176 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7177 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7178 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7180 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7181 /* .name = "Capture Source", */
7182 .name
= "Input Source",
7184 .info
= alc883_mux_enum_info
,
7185 .get
= alc883_mux_enum_get
,
7186 .put
= alc883_mux_enum_put
,
7191 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
7192 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7193 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7194 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7195 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
7196 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7198 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7200 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7201 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7203 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7204 /* .name = "Capture Source", */
7205 .name
= "Input Source",
7207 .info
= alc883_mux_enum_info
,
7208 .get
= alc883_mux_enum_get
,
7209 .put
= alc883_mux_enum_put
,
7214 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
7215 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7216 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
7217 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7218 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7219 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7222 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7223 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7224 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7225 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7226 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7227 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7229 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7230 /* .name = "Capture Source", */
7231 .name
= "Input Source",
7233 .info
= alc883_mux_enum_info
,
7234 .get
= alc883_mux_enum_get
,
7235 .put
= alc883_mux_enum_put
,
7240 static struct snd_kcontrol_new alc883_medion_md2_mixer
[] = {
7241 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7242 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7243 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7244 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7245 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7248 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7249 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7250 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7251 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7252 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7253 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7255 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7256 /* .name = "Capture Source", */
7257 .name
= "Input Source",
7259 .info
= alc883_mux_enum_info
,
7260 .get
= alc883_mux_enum_get
,
7261 .put
= alc883_mux_enum_put
,
7266 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
7267 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7268 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7269 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7270 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7271 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7274 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7275 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7276 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7277 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7278 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7280 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7281 /* .name = "Capture Source", */
7282 .name
= "Input Source",
7284 .info
= alc883_mux_enum_info
,
7285 .get
= alc883_mux_enum_get
,
7286 .put
= alc883_mux_enum_put
,
7291 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
7293 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7294 .name
= "Channel Mode",
7295 .info
= alc_ch_mode_info
,
7296 .get
= alc_ch_mode_get
,
7297 .put
= alc_ch_mode_put
,
7302 static struct hda_verb alc883_init_verbs
[] = {
7303 /* ADC1: mute amp left and right */
7304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7305 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7306 /* ADC2: mute amp left and right */
7307 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7308 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7309 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7310 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7314 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7315 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7316 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7318 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7320 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7322 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7323 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7324 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7326 /* mute analog input loopbacks */
7327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7329 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7330 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7331 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7333 /* Front Pin: output 0 (0x0c) */
7334 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7335 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7336 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7337 /* Rear Pin: output 1 (0x0d) */
7338 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7339 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7340 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7341 /* CLFE Pin: output 2 (0x0e) */
7342 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7343 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7344 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
7345 /* Side Pin: output 3 (0x0f) */
7346 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7347 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7348 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
7349 /* Mic (rear) pin: input vref at 80% */
7350 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7351 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7352 /* Front Mic pin: input vref at 80% */
7353 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7354 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7355 /* Line In pin: input */
7356 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7357 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7358 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7359 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7360 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7361 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7362 /* CD pin widget for input */
7363 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7365 /* FIXME: use matrix-type input source selection */
7366 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7368 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7369 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7370 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7371 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7375 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7376 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7380 /* toggle speaker-output according to the hp-jack state */
7381 static void alc883_mitac_hp_automute(struct hda_codec
*codec
)
7383 unsigned int present
;
7385 present
= snd_hda_codec_read(codec
, 0x15, 0,
7386 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7387 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7388 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7389 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
7390 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7393 /* auto-toggle front mic */
7395 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7397 unsigned int present;
7400 present = snd_hda_codec_read(codec, 0x18, 0,
7401 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7402 bits = present ? HDA_AMP_MUTE : 0;
7403 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7407 static void alc883_mitac_automute(struct hda_codec
*codec
)
7409 alc883_mitac_hp_automute(codec
);
7410 /* alc883_mitac_mic_automute(codec); */
7413 static void alc883_mitac_unsol_event(struct hda_codec
*codec
,
7416 switch (res
>> 26) {
7417 case ALC880_HP_EVENT
:
7418 alc883_mitac_hp_automute(codec
);
7420 case ALC880_MIC_EVENT
:
7421 /* alc883_mitac_mic_automute(codec); */
7426 static struct hda_verb alc883_mitac_verbs
[] = {
7428 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7429 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7431 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
7432 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7434 /* enable unsolicited event */
7435 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7436 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7441 static struct hda_verb alc883_clevo_m720_verbs
[] = {
7443 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7444 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7446 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
7447 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7449 /* enable unsolicited event */
7450 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7451 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
7456 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
7458 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7459 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7461 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7462 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7464 /* enable unsolicited event */
7465 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7470 static struct hda_verb alc883_tagra_verbs
[] = {
7471 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7475 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7477 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
7478 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
7479 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
7481 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7482 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
7483 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
7484 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
7489 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
7490 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7491 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
7492 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
7496 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
7497 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7498 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7499 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7500 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7504 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
7505 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7506 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7507 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7508 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
7509 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7513 static struct hda_verb alc883_haier_w66_verbs
[] = {
7514 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7515 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7517 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7519 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7520 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7521 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7522 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7526 static struct hda_verb alc888_3st_hp_verbs
[] = {
7527 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
7528 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
7529 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
7533 static struct hda_verb alc888_6st_dell_verbs
[] = {
7534 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7538 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
7539 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7540 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7541 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7542 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7546 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
7547 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7548 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7549 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7550 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7554 static struct hda_channel_mode alc888_3st_hp_modes
[2] = {
7555 { 2, alc888_3st_hp_2ch_init
},
7556 { 6, alc888_3st_hp_6ch_init
},
7559 /* toggle front-jack and RCA according to the hp-jack state */
7560 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
7562 unsigned int present
;
7564 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7565 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7566 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7567 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7568 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7569 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7572 /* toggle RCA according to the front-jack state */
7573 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
7575 unsigned int present
;
7577 present
= snd_hda_codec_read(codec
, 0x14, 0,
7578 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7579 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7580 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7583 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
7586 if ((res
>> 26) == ALC880_HP_EVENT
)
7587 alc888_lenovo_ms7195_front_automute(codec
);
7588 if ((res
>> 26) == ALC880_FRONT_EVENT
)
7589 alc888_lenovo_ms7195_rca_automute(codec
);
7592 static struct hda_verb alc883_medion_md2_verbs
[] = {
7593 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7594 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7596 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7598 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7602 /* toggle speaker-output according to the hp-jack state */
7603 static void alc883_medion_md2_automute(struct hda_codec
*codec
)
7605 unsigned int present
;
7607 present
= snd_hda_codec_read(codec
, 0x14, 0,
7608 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7609 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7610 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7613 static void alc883_medion_md2_unsol_event(struct hda_codec
*codec
,
7616 if ((res
>> 26) == ALC880_HP_EVENT
)
7617 alc883_medion_md2_automute(codec
);
7620 /* toggle speaker-output according to the hp-jack state */
7621 static void alc883_tagra_automute(struct hda_codec
*codec
)
7623 unsigned int present
;
7626 present
= snd_hda_codec_read(codec
, 0x14, 0,
7627 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7628 bits
= present
? HDA_AMP_MUTE
: 0;
7629 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
7630 HDA_AMP_MUTE
, bits
);
7631 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
7635 static void alc883_tagra_unsol_event(struct hda_codec
*codec
, unsigned int res
)
7637 if ((res
>> 26) == ALC880_HP_EVENT
)
7638 alc883_tagra_automute(codec
);
7641 /* toggle speaker-output according to the hp-jack state */
7642 static void alc883_clevo_m720_hp_automute(struct hda_codec
*codec
)
7644 unsigned int present
;
7647 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0)
7648 & AC_PINSENSE_PRESENCE
;
7649 bits
= present
? HDA_AMP_MUTE
: 0;
7650 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7651 HDA_AMP_MUTE
, bits
);
7654 static void alc883_clevo_m720_mic_automute(struct hda_codec
*codec
)
7656 unsigned int present
;
7658 present
= snd_hda_codec_read(codec
, 0x18, 0,
7659 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7660 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
7661 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7664 static void alc883_clevo_m720_automute(struct hda_codec
*codec
)
7666 alc883_clevo_m720_hp_automute(codec
);
7667 alc883_clevo_m720_mic_automute(codec
);
7670 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
7673 switch (res
>> 26) {
7674 case ALC880_HP_EVENT
:
7675 alc883_clevo_m720_hp_automute(codec
);
7677 case ALC880_MIC_EVENT
:
7678 alc883_clevo_m720_mic_automute(codec
);
7683 /* toggle speaker-output according to the hp-jack state */
7684 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec
*codec
)
7686 unsigned int present
;
7689 present
= snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_GET_PIN_SENSE
, 0)
7690 & AC_PINSENSE_PRESENCE
;
7691 bits
= present
? HDA_AMP_MUTE
: 0;
7692 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7693 HDA_AMP_MUTE
, bits
);
7696 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec
*codec
,
7699 if ((res
>> 26) == ALC880_HP_EVENT
)
7700 alc883_2ch_fujitsu_pi2515_automute(codec
);
7703 static void alc883_haier_w66_automute(struct hda_codec
*codec
)
7705 unsigned int present
;
7708 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7709 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7710 bits
= present
? 0x80 : 0;
7711 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7715 static void alc883_haier_w66_unsol_event(struct hda_codec
*codec
,
7718 if ((res
>> 26) == ALC880_HP_EVENT
)
7719 alc883_haier_w66_automute(codec
);
7722 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
7724 unsigned int present
;
7727 present
= snd_hda_codec_read(codec
, 0x14, 0,
7728 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7729 bits
= present
? HDA_AMP_MUTE
: 0;
7730 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7731 HDA_AMP_MUTE
, bits
);
7734 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
7736 unsigned int present
;
7739 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7740 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7741 bits
= present
? HDA_AMP_MUTE
: 0;
7742 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7743 HDA_AMP_MUTE
, bits
);
7744 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7745 HDA_AMP_MUTE
, bits
);
7748 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
7751 if ((res
>> 26) == ALC880_HP_EVENT
)
7752 alc883_lenovo_101e_all_automute(codec
);
7753 if ((res
>> 26) == ALC880_FRONT_EVENT
)
7754 alc883_lenovo_101e_ispeaker_automute(codec
);
7757 /* toggle speaker-output according to the hp-jack state */
7758 static void alc883_acer_aspire_automute(struct hda_codec
*codec
)
7760 unsigned int present
;
7762 present
= snd_hda_codec_read(codec
, 0x14, 0,
7763 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7764 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7765 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7766 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
7767 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7770 static void alc883_acer_aspire_unsol_event(struct hda_codec
*codec
,
7773 if ((res
>> 26) == ALC880_HP_EVENT
)
7774 alc883_acer_aspire_automute(codec
);
7777 static struct hda_verb alc883_acer_eapd_verbs
[] = {
7778 /* HP Pin: output 0 (0x0c) */
7779 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7780 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7781 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7782 /* Front Pin: output 0 (0x0c) */
7783 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7784 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7785 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7786 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
7787 /* eanable EAPD on medion laptop */
7788 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
7789 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
7790 /* enable unsolicited event */
7791 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7795 static void alc888_6st_dell_front_automute(struct hda_codec
*codec
)
7797 unsigned int present
;
7799 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7800 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7801 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7802 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7803 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7804 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7805 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
7806 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7807 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
7808 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7811 static void alc888_6st_dell_unsol_event(struct hda_codec
*codec
,
7814 switch (res
>> 26) {
7815 case ALC880_HP_EVENT
:
7816 printk("hp_event\n");
7817 alc888_6st_dell_front_automute(codec
);
7823 * generic initialization of ADC, input mixers and output mixers
7825 static struct hda_verb alc883_auto_init_verbs
[] = {
7827 * Unmute ADC0-2 and set the default input to mic-in
7829 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7830 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7831 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7832 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7834 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7836 * Note: PASD motherboards uses the Line In 2 as the input for
7837 * front panel mic (mic 2)
7839 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7840 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7841 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7842 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7843 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7844 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7847 * Set up output mixers (0x0c - 0x0f)
7849 /* set vol=0 to output mixers */
7850 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7851 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7852 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7853 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7854 /* set up input amps for analog loopback */
7855 /* Amp Indices: DAC = 0, mixer = 1 */
7856 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7857 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7858 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7859 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7860 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7861 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7862 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7863 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7864 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7865 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7867 /* FIXME: use matrix-type input source selection */
7868 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7870 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7871 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7872 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7873 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7874 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7876 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7877 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7878 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7879 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7880 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7885 /* capture mixer elements */
7886 static struct snd_kcontrol_new alc883_capture_mixer
[] = {
7887 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7888 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7889 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7890 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7892 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7893 /* The multiple "Capture Source" controls confuse alsamixer
7894 * So call somewhat different..
7896 /* .name = "Capture Source", */
7897 .name
= "Input Source",
7899 .info
= alc882_mux_enum_info
,
7900 .get
= alc882_mux_enum_get
,
7901 .put
= alc882_mux_enum_put
,
7906 #ifdef CONFIG_SND_HDA_POWER_SAVE
7907 #define alc883_loopbacks alc880_loopbacks
7910 /* pcm configuration: identiacal with ALC880 */
7911 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7912 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7913 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7914 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7915 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7918 * configuration and preset
7920 static const char *alc883_models
[ALC883_MODEL_LAST
] = {
7921 [ALC883_3ST_2ch_DIG
] = "3stack-dig",
7922 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
7923 [ALC883_3ST_6ch
] = "3stack-6ch",
7924 [ALC883_6ST_DIG
] = "6stack-dig",
7925 [ALC883_TARGA_DIG
] = "targa-dig",
7926 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
7927 [ALC883_ACER
] = "acer",
7928 [ALC883_ACER_ASPIRE
] = "acer-aspire",
7929 [ALC883_MEDION
] = "medion",
7930 [ALC883_MEDION_MD2
] = "medion-md2",
7931 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
7932 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
7933 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
7934 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
7935 [ALC883_HAIER_W66
] = "haier-w66",
7936 [ALC888_3ST_HP
] = "3stack-hp",
7937 [ALC888_6ST_DELL
] = "6stack-dell",
7938 [ALC883_MITAC
] = "mitac",
7939 [ALC883_CLEVO_M720
] = "clevo-m720",
7940 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
7941 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
7942 [ALC883_AUTO
] = "auto",
7945 static struct snd_pci_quirk alc883_cfg_tbl
[] = {
7946 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG
),
7947 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
7948 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
7949 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
7950 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE
),
7951 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER
), /* default Acer */
7952 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
7953 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
7954 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
7955 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
7956 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
7957 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
7958 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
7959 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG
),
7960 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
7961 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
7962 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
7963 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG
),
7964 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
7965 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
7966 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
7967 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG
),
7968 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
7969 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
7970 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
7971 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
7972 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
7973 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
7974 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
7975 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
7976 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
7977 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
7978 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
7979 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
7980 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
7981 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
7982 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
7983 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
7984 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
7985 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
7986 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
7987 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
7988 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
7989 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD
),
7990 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
7991 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
7992 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515
),
7993 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
7994 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7995 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7996 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7997 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2
),
7998 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
7999 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
8000 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
8001 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
8002 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch
),
8006 static struct alc_config_preset alc883_presets
[] = {
8007 [ALC883_3ST_2ch_DIG
] = {
8008 .mixers
= { alc883_3ST_2ch_mixer
},
8009 .init_verbs
= { alc883_init_verbs
},
8010 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8011 .dac_nids
= alc883_dac_nids
,
8012 .dig_out_nid
= ALC883_DIGOUT_NID
,
8013 .dig_in_nid
= ALC883_DIGIN_NID
,
8014 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8015 .channel_mode
= alc883_3ST_2ch_modes
,
8016 .input_mux
= &alc883_capture_source
,
8018 [ALC883_3ST_6ch_DIG
] = {
8019 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8020 .init_verbs
= { alc883_init_verbs
},
8021 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8022 .dac_nids
= alc883_dac_nids
,
8023 .dig_out_nid
= ALC883_DIGOUT_NID
,
8024 .dig_in_nid
= ALC883_DIGIN_NID
,
8025 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8026 .channel_mode
= alc883_3ST_6ch_modes
,
8028 .input_mux
= &alc883_capture_source
,
8030 [ALC883_3ST_6ch
] = {
8031 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8032 .init_verbs
= { alc883_init_verbs
},
8033 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8034 .dac_nids
= alc883_dac_nids
,
8035 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8036 .channel_mode
= alc883_3ST_6ch_modes
,
8038 .input_mux
= &alc883_capture_source
,
8040 [ALC883_3ST_6ch_INTEL
] = {
8041 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
8042 .init_verbs
= { alc883_init_verbs
},
8043 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8044 .dac_nids
= alc883_dac_nids
,
8045 .dig_out_nid
= ALC883_DIGOUT_NID
,
8046 .dig_in_nid
= ALC883_DIGIN_NID
,
8047 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
8048 .channel_mode
= alc883_3ST_6ch_intel_modes
,
8050 .input_mux
= &alc883_3stack_6ch_intel
,
8052 [ALC883_6ST_DIG
] = {
8053 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
8054 .init_verbs
= { alc883_init_verbs
},
8055 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8056 .dac_nids
= alc883_dac_nids
,
8057 .dig_out_nid
= ALC883_DIGOUT_NID
,
8058 .dig_in_nid
= ALC883_DIGIN_NID
,
8059 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8060 .channel_mode
= alc883_sixstack_modes
,
8061 .input_mux
= &alc883_capture_source
,
8063 [ALC883_TARGA_DIG
] = {
8064 .mixers
= { alc883_tagra_mixer
, alc883_chmode_mixer
},
8065 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
8066 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8067 .dac_nids
= alc883_dac_nids
,
8068 .dig_out_nid
= ALC883_DIGOUT_NID
,
8069 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8070 .channel_mode
= alc883_3ST_6ch_modes
,
8072 .input_mux
= &alc883_capture_source
,
8073 .unsol_event
= alc883_tagra_unsol_event
,
8074 .init_hook
= alc883_tagra_automute
,
8076 [ALC883_TARGA_2ch_DIG
] = {
8077 .mixers
= { alc883_tagra_2ch_mixer
},
8078 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
8079 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8080 .dac_nids
= alc883_dac_nids
,
8081 .dig_out_nid
= ALC883_DIGOUT_NID
,
8082 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8083 .channel_mode
= alc883_3ST_2ch_modes
,
8084 .input_mux
= &alc883_capture_source
,
8085 .unsol_event
= alc883_tagra_unsol_event
,
8086 .init_hook
= alc883_tagra_automute
,
8089 .mixers
= { alc883_base_mixer
},
8090 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8091 * and the headphone jack. Turn this on and rely on the
8092 * standard mute methods whenever the user wants to turn
8093 * these outputs off.
8095 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
8096 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8097 .dac_nids
= alc883_dac_nids
,
8098 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8099 .channel_mode
= alc883_3ST_2ch_modes
,
8100 .input_mux
= &alc883_capture_source
,
8102 [ALC883_ACER_ASPIRE
] = {
8103 .mixers
= { alc883_acer_aspire_mixer
},
8104 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
8105 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8106 .dac_nids
= alc883_dac_nids
,
8107 .dig_out_nid
= ALC883_DIGOUT_NID
,
8108 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8109 .channel_mode
= alc883_3ST_2ch_modes
,
8110 .input_mux
= &alc883_capture_source
,
8111 .unsol_event
= alc883_acer_aspire_unsol_event
,
8112 .init_hook
= alc883_acer_aspire_automute
,
8115 .mixers
= { alc883_fivestack_mixer
,
8116 alc883_chmode_mixer
},
8117 .init_verbs
= { alc883_init_verbs
,
8118 alc883_medion_eapd_verbs
},
8119 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8120 .dac_nids
= alc883_dac_nids
,
8121 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8122 .channel_mode
= alc883_sixstack_modes
,
8123 .input_mux
= &alc883_capture_source
,
8125 [ALC883_MEDION_MD2
] = {
8126 .mixers
= { alc883_medion_md2_mixer
},
8127 .init_verbs
= { alc883_init_verbs
, alc883_medion_md2_verbs
},
8128 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8129 .dac_nids
= alc883_dac_nids
,
8130 .dig_out_nid
= ALC883_DIGOUT_NID
,
8131 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8132 .channel_mode
= alc883_3ST_2ch_modes
,
8133 .input_mux
= &alc883_capture_source
,
8134 .unsol_event
= alc883_medion_md2_unsol_event
,
8135 .init_hook
= alc883_medion_md2_automute
,
8137 [ALC883_LAPTOP_EAPD
] = {
8138 .mixers
= { alc883_base_mixer
},
8139 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
8140 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8141 .dac_nids
= alc883_dac_nids
,
8142 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8143 .channel_mode
= alc883_3ST_2ch_modes
,
8144 .input_mux
= &alc883_capture_source
,
8146 [ALC883_CLEVO_M720
] = {
8147 .mixers
= { alc883_clevo_m720_mixer
},
8148 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_verbs
},
8149 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8150 .dac_nids
= alc883_dac_nids
,
8151 .dig_out_nid
= ALC883_DIGOUT_NID
,
8152 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8153 .channel_mode
= alc883_3ST_2ch_modes
,
8154 .input_mux
= &alc883_capture_source
,
8155 .unsol_event
= alc883_clevo_m720_unsol_event
,
8156 .init_hook
= alc883_clevo_m720_automute
,
8158 [ALC883_LENOVO_101E_2ch
] = {
8159 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
8160 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
8161 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8162 .dac_nids
= alc883_dac_nids
,
8163 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8164 .channel_mode
= alc883_3ST_2ch_modes
,
8165 .input_mux
= &alc883_lenovo_101e_capture_source
,
8166 .unsol_event
= alc883_lenovo_101e_unsol_event
,
8167 .init_hook
= alc883_lenovo_101e_all_automute
,
8169 [ALC883_LENOVO_NB0763
] = {
8170 .mixers
= { alc883_lenovo_nb0763_mixer
},
8171 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
8172 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8173 .dac_nids
= alc883_dac_nids
,
8174 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8175 .channel_mode
= alc883_3ST_2ch_modes
,
8177 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
8178 .unsol_event
= alc883_medion_md2_unsol_event
,
8179 .init_hook
= alc883_medion_md2_automute
,
8181 [ALC888_LENOVO_MS7195_DIG
] = {
8182 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8183 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
8184 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8185 .dac_nids
= alc883_dac_nids
,
8186 .dig_out_nid
= ALC883_DIGOUT_NID
,
8187 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8188 .channel_mode
= alc883_3ST_6ch_modes
,
8190 .input_mux
= &alc883_capture_source
,
8191 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
8192 .init_hook
= alc888_lenovo_ms7195_front_automute
,
8194 [ALC883_HAIER_W66
] = {
8195 .mixers
= { alc883_tagra_2ch_mixer
},
8196 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
8197 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8198 .dac_nids
= alc883_dac_nids
,
8199 .dig_out_nid
= ALC883_DIGOUT_NID
,
8200 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8201 .channel_mode
= alc883_3ST_2ch_modes
,
8202 .input_mux
= &alc883_capture_source
,
8203 .unsol_event
= alc883_haier_w66_unsol_event
,
8204 .init_hook
= alc883_haier_w66_automute
,
8207 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8208 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
8209 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8210 .dac_nids
= alc883_dac_nids
,
8211 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
8212 .channel_mode
= alc888_3st_hp_modes
,
8214 .input_mux
= &alc883_capture_source
,
8216 [ALC888_6ST_DELL
] = {
8217 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
8218 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
8219 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8220 .dac_nids
= alc883_dac_nids
,
8221 .dig_out_nid
= ALC883_DIGOUT_NID
,
8222 .dig_in_nid
= ALC883_DIGIN_NID
,
8223 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8224 .channel_mode
= alc883_sixstack_modes
,
8225 .input_mux
= &alc883_capture_source
,
8226 .unsol_event
= alc888_6st_dell_unsol_event
,
8227 .init_hook
= alc888_6st_dell_front_automute
,
8230 .mixers
= { alc883_mitac_mixer
},
8231 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
8232 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8233 .dac_nids
= alc883_dac_nids
,
8234 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8235 .channel_mode
= alc883_3ST_2ch_modes
,
8236 .input_mux
= &alc883_capture_source
,
8237 .unsol_event
= alc883_mitac_unsol_event
,
8238 .init_hook
= alc883_mitac_automute
,
8240 [ALC883_FUJITSU_PI2515
] = {
8241 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
8242 .init_verbs
= { alc883_init_verbs
,
8243 alc883_2ch_fujitsu_pi2515_verbs
},
8244 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8245 .dac_nids
= alc883_dac_nids
,
8246 .dig_out_nid
= ALC883_DIGOUT_NID
,
8247 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8248 .channel_mode
= alc883_3ST_2ch_modes
,
8249 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
8250 .unsol_event
= alc883_2ch_fujitsu_pi2515_unsol_event
,
8251 .init_hook
= alc883_2ch_fujitsu_pi2515_automute
,
8257 * BIOS auto configuration
8259 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
8260 hda_nid_t nid
, int pin_type
,
8264 struct alc_spec
*spec
= codec
->spec
;
8267 alc_set_pin_output(codec
, nid
, pin_type
);
8268 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
8271 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
8272 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
8276 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
8278 struct alc_spec
*spec
= codec
->spec
;
8281 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
8282 for (i
= 0; i
<= HDA_SIDE
; i
++) {
8283 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
8284 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
8286 alc883_auto_set_output_and_unmute(codec
, nid
, pin_type
,
8291 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
8293 struct alc_spec
*spec
= codec
->spec
;
8296 pin
= spec
->autocfg
.hp_pins
[0];
8297 if (pin
) /* connect to front */
8299 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
8300 pin
= spec
->autocfg
.speaker_pins
[0];
8302 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
8305 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8306 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8308 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
8310 struct alc_spec
*spec
= codec
->spec
;
8313 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
8314 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
8315 if (alc883_is_input_pin(nid
)) {
8316 snd_hda_codec_write(codec
, nid
, 0,
8317 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8318 (i
<= AUTO_PIN_FRONT_MIC
?
8319 PIN_VREF80
: PIN_IN
));
8320 if (nid
!= ALC883_PIN_CD_NID
)
8321 snd_hda_codec_write(codec
, nid
, 0,
8322 AC_VERB_SET_AMP_GAIN_MUTE
,
8328 #define alc883_auto_init_input_src alc882_auto_init_input_src
8330 /* almost identical with ALC880 parser... */
8331 static int alc883_parse_auto_config(struct hda_codec
*codec
)
8333 struct alc_spec
*spec
= codec
->spec
;
8334 int err
= alc880_parse_auto_config(codec
);
8339 return 0; /* no config found */
8341 err
= alc_auto_add_mic_boost(codec
);
8345 /* hack - override the init verbs */
8346 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
8347 spec
->mixers
[spec
->num_mixers
] = alc883_capture_mixer
;
8350 return 1; /* config found */
8353 /* additional initialization for auto-configuration model */
8354 static void alc883_auto_init(struct hda_codec
*codec
)
8356 struct alc_spec
*spec
= codec
->spec
;
8357 alc883_auto_init_multi_out(codec
);
8358 alc883_auto_init_hp_out(codec
);
8359 alc883_auto_init_analog_input(codec
);
8360 alc883_auto_init_input_src(codec
);
8361 if (spec
->unsol_event
)
8362 alc_sku_automute(codec
);
8365 static int patch_alc883(struct hda_codec
*codec
)
8367 struct alc_spec
*spec
;
8368 int err
, board_config
;
8370 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
8376 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
8378 board_config
= snd_hda_check_board_config(codec
, ALC883_MODEL_LAST
,
8381 if (board_config
< 0) {
8382 printk(KERN_INFO
"hda_codec: Unknown model for ALC883, "
8383 "trying auto-probe from BIOS...\n");
8384 board_config
= ALC883_AUTO
;
8387 if (board_config
== ALC883_AUTO
) {
8388 /* automatic parse from the BIOS config */
8389 err
= alc883_parse_auto_config(codec
);
8395 "hda_codec: Cannot set up configuration "
8396 "from BIOS. Using base mode...\n");
8397 board_config
= ALC883_3ST_2ch_DIG
;
8401 if (board_config
!= ALC883_AUTO
)
8402 setup_preset(spec
, &alc883_presets
[board_config
]);
8404 switch (codec
->vendor_id
) {
8406 spec
->stream_name_analog
= "ALC888 Analog";
8407 spec
->stream_name_digital
= "ALC888 Digital";
8410 spec
->stream_name_analog
= "ALC889 Analog";
8411 spec
->stream_name_digital
= "ALC889 Digital";
8414 spec
->stream_name_analog
= "ALC883 Analog";
8415 spec
->stream_name_digital
= "ALC883 Digital";
8419 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
8420 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
8421 spec
->stream_analog_alt_capture
= &alc883_pcm_analog_alt_capture
;
8423 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
8424 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
8426 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
8427 spec
->adc_nids
= alc883_adc_nids
;
8428 spec
->capsrc_nids
= alc883_capsrc_nids
;
8430 spec
->vmaster_nid
= 0x0c;
8432 codec
->patch_ops
= alc_patch_ops
;
8433 if (board_config
== ALC883_AUTO
)
8434 spec
->init_hook
= alc883_auto_init
;
8436 #ifdef CONFIG_SND_HDA_POWER_SAVE
8437 if (!spec
->loopback
.amplist
)
8438 spec
->loopback
.amplist
= alc883_loopbacks
;
8448 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8449 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8451 #define alc262_dac_nids alc260_dac_nids
8452 #define alc262_adc_nids alc882_adc_nids
8453 #define alc262_adc_nids_alt alc882_adc_nids_alt
8454 #define alc262_capsrc_nids alc882_capsrc_nids
8455 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8457 #define alc262_modes alc260_modes
8458 #define alc262_capture_source alc882_capture_source
8460 static struct snd_kcontrol_new alc262_base_mixer
[] = {
8461 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8462 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8463 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8464 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8465 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8466 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8467 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8468 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8469 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8470 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8471 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8472 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8473 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8474 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8475 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
8476 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8477 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8478 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
8482 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
8483 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8484 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8485 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8486 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8487 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8488 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8489 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8490 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8491 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8492 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8493 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8494 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8495 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8496 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8497 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8498 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8502 /* update HP, line and mono-out pins according to the master switch */
8503 static void alc262_hp_master_update(struct hda_codec
*codec
)
8505 struct alc_spec
*spec
= codec
->spec
;
8506 int val
= spec
->master_sw
;
8509 snd_hda_codec_write_cache(codec
, 0x1b, 0,
8510 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8512 snd_hda_codec_write_cache(codec
, 0x15, 0,
8513 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8515 /* mono (speaker) depending on the HP jack sense */
8516 val
= val
&& !spec
->jack_present
;
8517 snd_hda_codec_write_cache(codec
, 0x16, 0,
8518 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8522 static void alc262_hp_bpc_automute(struct hda_codec
*codec
)
8524 struct alc_spec
*spec
= codec
->spec
;
8525 unsigned int presence
;
8526 presence
= snd_hda_codec_read(codec
, 0x1b, 0,
8527 AC_VERB_GET_PIN_SENSE
, 0);
8528 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
8529 alc262_hp_master_update(codec
);
8532 static void alc262_hp_bpc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
8534 if ((res
>> 26) != ALC880_HP_EVENT
)
8536 alc262_hp_bpc_automute(codec
);
8539 static void alc262_hp_wildwest_automute(struct hda_codec
*codec
)
8541 struct alc_spec
*spec
= codec
->spec
;
8542 unsigned int presence
;
8543 presence
= snd_hda_codec_read(codec
, 0x15, 0,
8544 AC_VERB_GET_PIN_SENSE
, 0);
8545 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
8546 alc262_hp_master_update(codec
);
8549 static void alc262_hp_wildwest_unsol_event(struct hda_codec
*codec
,
8552 if ((res
>> 26) != ALC880_HP_EVENT
)
8554 alc262_hp_wildwest_automute(codec
);
8557 static int alc262_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
8558 struct snd_ctl_elem_value
*ucontrol
)
8560 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8561 struct alc_spec
*spec
= codec
->spec
;
8562 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
8566 static int alc262_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
8567 struct snd_ctl_elem_value
*ucontrol
)
8569 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8570 struct alc_spec
*spec
= codec
->spec
;
8571 int val
= !!*ucontrol
->value
.integer
.value
;
8573 if (val
== spec
->master_sw
)
8575 spec
->master_sw
= val
;
8576 alc262_hp_master_update(codec
);
8580 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
8582 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8583 .name
= "Master Playback Switch",
8584 .info
= snd_ctl_boolean_mono_info
,
8585 .get
= alc262_hp_master_sw_get
,
8586 .put
= alc262_hp_master_sw_put
,
8588 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8589 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8591 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8593 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8595 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8596 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8597 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8598 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8599 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8600 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8601 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8602 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8603 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8604 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8605 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
8606 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
8607 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
8608 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
8612 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
8614 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8615 .name
= "Master Playback Switch",
8616 .info
= snd_ctl_boolean_mono_info
,
8617 .get
= alc262_hp_master_sw_get
,
8618 .put
= alc262_hp_master_sw_put
,
8620 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8621 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8622 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8623 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8624 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8626 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8628 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8629 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8630 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT
),
8631 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8632 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8633 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8634 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8635 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
8636 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
8640 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
8641 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8642 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8643 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT
),
8647 /* mute/unmute internal speaker according to the hp jack and mute state */
8648 static void alc262_hp_t5735_automute(struct hda_codec
*codec
, int force
)
8650 struct alc_spec
*spec
= codec
->spec
;
8652 if (force
|| !spec
->sense_updated
) {
8653 unsigned int present
;
8654 present
= snd_hda_codec_read(codec
, 0x15, 0,
8655 AC_VERB_GET_PIN_SENSE
, 0);
8656 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
8657 spec
->sense_updated
= 1;
8659 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0, HDA_AMP_MUTE
,
8660 spec
->jack_present
? HDA_AMP_MUTE
: 0);
8663 static void alc262_hp_t5735_unsol_event(struct hda_codec
*codec
,
8666 if ((res
>> 26) != ALC880_HP_EVENT
)
8668 alc262_hp_t5735_automute(codec
, 1);
8671 static void alc262_hp_t5735_init_hook(struct hda_codec
*codec
)
8673 alc262_hp_t5735_automute(codec
, 1);
8676 static struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
8677 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8678 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8679 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8680 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8682 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8687 static struct hda_verb alc262_hp_t5735_verbs
[] = {
8688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8689 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8691 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8695 static struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
8696 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8697 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8698 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
8699 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
8700 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8701 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8705 static struct hda_verb alc262_hp_rp5700_verbs
[] = {
8706 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8707 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8708 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8709 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8710 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8711 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8712 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8713 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8714 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
8715 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
8719 static struct hda_input_mux alc262_hp_rp5700_capture_source
= {
8726 /* bind hp and internal speaker mute (with plug check) */
8727 static int alc262_sony_master_sw_put(struct snd_kcontrol
*kcontrol
,
8728 struct snd_ctl_elem_value
*ucontrol
)
8730 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8731 long *valp
= ucontrol
->value
.integer
.value
;
8734 /* change hp mute */
8735 change
= snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
8737 valp
[0] ? 0 : HDA_AMP_MUTE
);
8738 change
|= snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
8740 valp
[1] ? 0 : HDA_AMP_MUTE
);
8742 /* change speaker according to HP jack state */
8743 struct alc_spec
*spec
= codec
->spec
;
8745 if (spec
->jack_present
)
8746 mute
= HDA_AMP_MUTE
;
8748 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0,
8750 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8751 HDA_AMP_MUTE
, mute
);
8756 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
8757 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8759 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8760 .name
= "Master Playback Switch",
8761 .info
= snd_hda_mixer_amp_switch_info
,
8762 .get
= snd_hda_mixer_amp_switch_get
,
8763 .put
= alc262_sony_master_sw_put
,
8764 .private_value
= HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
8766 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8767 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8768 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8769 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8773 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
8774 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8775 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8776 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8778 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8779 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8780 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8784 #define alc262_capture_mixer alc882_capture_mixer
8785 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8788 * generic initialization of ADC, input mixers and output mixers
8790 static struct hda_verb alc262_init_verbs
[] = {
8792 * Unmute ADC0-2 and set the default input to mic-in
8794 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8795 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8796 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8797 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8798 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8799 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8801 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8803 * Note: PASD motherboards uses the Line In 2 as the input for
8804 * front panel mic (mic 2)
8806 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8807 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8808 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8809 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8810 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8811 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8814 * Set up output mixers (0x0c - 0x0e)
8816 /* set vol=0 to output mixers */
8817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8818 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8819 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8820 /* set up input amps for analog loopback */
8821 /* Amp Indices: DAC = 0, mixer = 1 */
8822 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8823 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8824 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8825 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8826 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8827 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8829 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8830 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8831 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8832 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8833 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8834 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8836 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8837 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8838 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8839 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8840 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8842 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8843 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8845 /* FIXME: use matrix-type input source selection */
8846 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8847 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8848 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8849 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8850 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8851 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8853 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8854 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8855 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8856 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8858 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8859 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8860 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8861 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8866 static struct hda_verb alc262_hippo_unsol_verbs
[] = {
8867 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8868 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8872 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
8873 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8874 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8875 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8877 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8878 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8882 static struct hda_verb alc262_sony_unsol_verbs
[] = {
8883 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8884 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8885 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
8887 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8888 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8892 /* mute/unmute internal speaker according to the hp jack and mute state */
8893 static void alc262_hippo_automute(struct hda_codec
*codec
)
8895 struct alc_spec
*spec
= codec
->spec
;
8897 unsigned int present
;
8899 /* need to execute and sync at first */
8900 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
8901 present
= snd_hda_codec_read(codec
, 0x15, 0,
8902 AC_VERB_GET_PIN_SENSE
, 0);
8903 spec
->jack_present
= (present
& 0x80000000) != 0;
8904 if (spec
->jack_present
) {
8905 /* mute internal speaker */
8906 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8907 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8909 /* unmute internal speaker if necessary */
8910 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
8911 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8912 HDA_AMP_MUTE
, mute
);
8916 /* unsolicited event for HP jack sensing */
8917 static void alc262_hippo_unsol_event(struct hda_codec
*codec
,
8920 if ((res
>> 26) != ALC880_HP_EVENT
)
8922 alc262_hippo_automute(codec
);
8925 static void alc262_hippo1_automute(struct hda_codec
*codec
)
8928 unsigned int present
;
8930 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
8931 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8932 AC_VERB_GET_PIN_SENSE
, 0);
8933 present
= (present
& 0x80000000) != 0;
8935 /* mute internal speaker */
8936 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8937 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8939 /* unmute internal speaker if necessary */
8940 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
8941 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8942 HDA_AMP_MUTE
, mute
);
8946 /* unsolicited event for HP jack sensing */
8947 static void alc262_hippo1_unsol_event(struct hda_codec
*codec
,
8950 if ((res
>> 26) != ALC880_HP_EVENT
)
8952 alc262_hippo1_automute(codec
);
8958 * 0x16 = internal speaker
8959 * 0x18 = external mic
8962 static struct snd_kcontrol_new alc262_nec_mixer
[] = {
8963 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
8964 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT
),
8966 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8967 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8968 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8970 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8971 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8975 static struct hda_verb alc262_nec_verbs
[] = {
8976 /* Unmute Speaker */
8977 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8980 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8981 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8983 /* External mic to headphone */
8984 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8985 /* External mic to speaker */
8986 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8992 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8993 * 0x1b = port replicator headphone out
8996 #define ALC_HP_EVENT 0x37
8998 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
8999 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
9000 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9001 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
9002 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9006 static struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
9007 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
9008 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9012 static struct hda_input_mux alc262_fujitsu_capture_source
= {
9021 static struct hda_input_mux alc262_HP_capture_source
= {
9025 { "Front Mic", 0x1 },
9032 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
9036 { "Front Mic", 0x2 },
9042 /* mute/unmute internal speaker according to the hp jacks and mute state */
9043 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
9045 struct alc_spec
*spec
= codec
->spec
;
9048 if (force
|| !spec
->sense_updated
) {
9049 unsigned int present
;
9050 /* need to execute and sync at first */
9051 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
9052 /* check laptop HP jack */
9053 present
= snd_hda_codec_read(codec
, 0x14, 0,
9054 AC_VERB_GET_PIN_SENSE
, 0);
9055 /* need to execute and sync at first */
9056 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
9057 /* check docking HP jack */
9058 present
|= snd_hda_codec_read(codec
, 0x1b, 0,
9059 AC_VERB_GET_PIN_SENSE
, 0);
9060 if (present
& AC_PINSENSE_PRESENCE
)
9061 spec
->jack_present
= 1;
9063 spec
->jack_present
= 0;
9064 spec
->sense_updated
= 1;
9066 /* unmute internal speaker only if both HPs are unplugged and
9067 * master switch is on
9069 if (spec
->jack_present
)
9070 mute
= HDA_AMP_MUTE
;
9072 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
9073 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9074 HDA_AMP_MUTE
, mute
);
9077 /* unsolicited event for HP jack sensing */
9078 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
9081 if ((res
>> 26) != ALC_HP_EVENT
)
9083 alc262_fujitsu_automute(codec
, 1);
9086 static void alc262_fujitsu_init_hook(struct hda_codec
*codec
)
9088 alc262_fujitsu_automute(codec
, 1);
9091 /* bind volumes of both NID 0x0c and 0x0d */
9092 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
9093 .ops
= &snd_hda_bind_vol
,
9095 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
9096 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
9101 /* mute/unmute internal speaker according to the hp jack and mute state */
9102 static void alc262_lenovo_3000_automute(struct hda_codec
*codec
, int force
)
9104 struct alc_spec
*spec
= codec
->spec
;
9107 if (force
|| !spec
->sense_updated
) {
9108 unsigned int present_int_hp
;
9109 /* need to execute and sync at first */
9110 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
9111 present_int_hp
= snd_hda_codec_read(codec
, 0x1b, 0,
9112 AC_VERB_GET_PIN_SENSE
, 0);
9113 spec
->jack_present
= (present_int_hp
& 0x80000000) != 0;
9114 spec
->sense_updated
= 1;
9116 if (spec
->jack_present
) {
9117 /* mute internal speaker */
9118 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9119 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9120 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9121 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9123 /* unmute internal speaker if necessary */
9124 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
9125 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9126 HDA_AMP_MUTE
, mute
);
9127 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9128 HDA_AMP_MUTE
, mute
);
9132 /* unsolicited event for HP jack sensing */
9133 static void alc262_lenovo_3000_unsol_event(struct hda_codec
*codec
,
9136 if ((res
>> 26) != ALC_HP_EVENT
)
9138 alc262_lenovo_3000_automute(codec
, 1);
9141 /* bind hp and internal speaker mute (with plug check) */
9142 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
9143 struct snd_ctl_elem_value
*ucontrol
)
9145 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9146 long *valp
= ucontrol
->value
.integer
.value
;
9149 change
= snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9151 valp
? 0 : HDA_AMP_MUTE
);
9152 change
|= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
9154 valp
? 0 : HDA_AMP_MUTE
);
9157 alc262_fujitsu_automute(codec
, 0);
9161 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
9162 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
9164 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9165 .name
= "Master Playback Switch",
9166 .info
= snd_hda_mixer_amp_switch_info
,
9167 .get
= snd_hda_mixer_amp_switch_get
,
9168 .put
= alc262_fujitsu_master_sw_put
,
9169 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
9171 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9172 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9173 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT
),
9174 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT
),
9175 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9176 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9177 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9178 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
9179 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9180 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9184 /* bind hp and internal speaker mute (with plug check) */
9185 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol
*kcontrol
,
9186 struct snd_ctl_elem_value
*ucontrol
)
9188 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9189 long *valp
= ucontrol
->value
.integer
.value
;
9192 change
= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
9194 valp
? 0 : HDA_AMP_MUTE
);
9197 alc262_lenovo_3000_automute(codec
, 0);
9201 static struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
9202 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
9204 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9205 .name
= "Master Playback Switch",
9206 .info
= snd_hda_mixer_amp_switch_info
,
9207 .get
= snd_hda_mixer_amp_switch_get
,
9208 .put
= alc262_lenovo_3000_master_sw_put
,
9209 .private_value
= HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
9211 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9212 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9213 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9214 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9215 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9216 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
9217 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9218 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9222 /* additional init verbs for Benq laptops */
9223 static struct hda_verb alc262_EAPD_verbs
[] = {
9224 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9225 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
9229 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
9230 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9231 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9233 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9234 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
9238 /* Samsung Q1 Ultra Vista model setup */
9239 static struct snd_kcontrol_new alc262_ultra_mixer
[] = {
9240 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9241 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
9242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9243 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9244 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
9245 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT
),
9249 static struct hda_verb alc262_ultra_verbs
[] = {
9251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9253 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9255 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9256 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9257 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9258 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9260 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9261 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9262 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9263 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9264 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9266 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9268 /* ADC, choose mic */
9269 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9270 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9271 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9272 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9273 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9274 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9275 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
9278 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
9282 /* mute/unmute internal speaker according to the hp jack and mute state */
9283 static void alc262_ultra_automute(struct hda_codec
*codec
)
9285 struct alc_spec
*spec
= codec
->spec
;
9289 /* auto-mute only when HP is used as HP */
9290 if (!spec
->cur_mux
[0]) {
9291 unsigned int present
;
9292 /* need to execute and sync at first */
9293 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
9294 present
= snd_hda_codec_read(codec
, 0x15, 0,
9295 AC_VERB_GET_PIN_SENSE
, 0);
9296 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
9297 if (spec
->jack_present
)
9298 mute
= HDA_AMP_MUTE
;
9300 /* mute/unmute internal speaker */
9301 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9302 HDA_AMP_MUTE
, mute
);
9303 /* mute/unmute HP */
9304 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9305 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
9308 /* unsolicited event for HP jack sensing */
9309 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
9312 if ((res
>> 26) != ALC880_HP_EVENT
)
9314 alc262_ultra_automute(codec
);
9317 static struct hda_input_mux alc262_ultra_capture_source
= {
9321 { "Headphone", 0x7 },
9325 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
9326 struct snd_ctl_elem_value
*ucontrol
)
9328 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9329 struct alc_spec
*spec
= codec
->spec
;
9332 ret
= alc882_mux_enum_put(kcontrol
, ucontrol
);
9335 /* reprogram the HP pin as mic or HP according to the input source */
9336 snd_hda_codec_write_cache(codec
, 0x15, 0,
9337 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9338 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
9339 alc262_ultra_automute(codec
); /* mute/unmute HP */
9343 static struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
9344 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
9345 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
9347 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9348 .name
= "Capture Source",
9349 .info
= alc882_mux_enum_info
,
9350 .get
= alc882_mux_enum_get
,
9351 .put
= alc262_ultra_mux_enum_put
,
9356 /* add playback controls from the parsed DAC table */
9357 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
9358 const struct auto_pin_cfg
*cfg
)
9363 spec
->multiout
.num_dacs
= 1; /* only use one dac */
9364 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
9365 spec
->multiout
.dac_nids
[0] = 2;
9367 nid
= cfg
->line_out_pins
[0];
9369 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9370 "Front Playback Volume",
9371 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
));
9374 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9375 "Front Playback Switch",
9376 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
9381 nid
= cfg
->speaker_pins
[0];
9384 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9385 "Speaker Playback Volume",
9386 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9390 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9391 "Speaker Playback Switch",
9392 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
9397 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9398 "Speaker Playback Switch",
9399 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
9405 nid
= cfg
->hp_pins
[0];
9407 /* spec->multiout.hp_nid = 2; */
9409 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9410 "Headphone Playback Volume",
9411 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9415 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9416 "Headphone Playback Switch",
9417 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
9422 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9423 "Headphone Playback Switch",
9424 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
9433 /* identical with ALC880 */
9434 #define alc262_auto_create_analog_input_ctls \
9435 alc880_auto_create_analog_input_ctls
9438 * generic initialization of ADC, input mixers and output mixers
9440 static struct hda_verb alc262_volume_init_verbs
[] = {
9442 * Unmute ADC0-2 and set the default input to mic-in
9444 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9445 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9446 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9447 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9448 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9449 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9451 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9453 * Note: PASD motherboards uses the Line In 2 as the input for
9454 * front panel mic (mic 2)
9456 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9461 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9464 * Set up output mixers (0x0c - 0x0f)
9466 /* set vol=0 to output mixers */
9467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9468 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9469 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9471 /* set up input amps for analog loopback */
9472 /* Amp Indices: DAC = 0, mixer = 1 */
9473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9475 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9476 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9477 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9478 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9480 /* FIXME: use matrix-type input source selection */
9481 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9482 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9483 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9484 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9485 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9486 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9488 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9489 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9490 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9491 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9493 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9495 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9496 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9501 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
9503 * Unmute ADC0-2 and set the default input to mic-in
9505 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9506 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9507 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9509 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9512 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9514 * Note: PASD motherboards uses the Line In 2 as the input for
9515 * front panel mic (mic 2)
9517 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9521 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9527 * Set up output mixers (0x0c - 0x0e)
9529 /* set vol=0 to output mixers */
9530 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9531 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9532 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9534 /* set up input amps for analog loopback */
9535 /* Amp Indices: DAC = 0, mixer = 1 */
9536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9537 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9538 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9539 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9540 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9541 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9543 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9544 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9545 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9547 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9548 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9550 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9551 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9553 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9554 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9555 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9556 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9557 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9559 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
9560 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9561 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9562 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
9563 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9564 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9567 /* FIXME: use matrix-type input source selection */
9568 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9569 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9570 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9571 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9572 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9573 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9575 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9576 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9577 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9578 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9580 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9582 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9583 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9585 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9590 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
9592 * Unmute ADC0-2 and set the default input to mic-in
9594 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9595 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9596 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9597 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9598 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9599 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9601 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9603 * Note: PASD motherboards uses the Line In 2 as the input for front
9606 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9607 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9614 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
9616 * Set up output mixers (0x0c - 0x0e)
9618 /* set vol=0 to output mixers */
9619 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9620 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9621 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9623 /* set up input amps for analog loopback */
9624 /* Amp Indices: DAC = 0, mixer = 1 */
9625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9627 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9629 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9630 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9633 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
9634 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
9635 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
9636 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
9637 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
9638 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
9639 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
9641 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9642 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9644 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9645 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
9647 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9648 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9649 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9650 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
9651 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9652 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9654 /* FIXME: use matrix-type input source selection */
9655 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9656 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
9659 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
9660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
9661 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
9662 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
9665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9666 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9668 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9669 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9670 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9671 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
9673 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9674 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9676 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9677 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9678 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9679 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
9681 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9686 #ifdef CONFIG_SND_HDA_POWER_SAVE
9687 #define alc262_loopbacks alc880_loopbacks
9690 /* pcm configuration: identiacal with ALC880 */
9691 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9692 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9693 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9694 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9697 * BIOS auto configuration
9699 static int alc262_parse_auto_config(struct hda_codec
*codec
)
9701 struct alc_spec
*spec
= codec
->spec
;
9703 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
9705 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
9709 if (!spec
->autocfg
.line_outs
)
9710 return 0; /* can't find valid BIOS pin config */
9711 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
9714 err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
9718 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
9720 if (spec
->autocfg
.dig_out_pin
)
9721 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
9722 if (spec
->autocfg
.dig_in_pin
)
9723 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
9725 if (spec
->kctl_alloc
)
9726 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
9728 spec
->init_verbs
[spec
->num_init_verbs
++] = alc262_volume_init_verbs
;
9729 spec
->num_mux_defs
= 1;
9730 spec
->input_mux
= &spec
->private_imux
;
9732 err
= alc_auto_add_mic_boost(codec
);
9739 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9740 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9741 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9742 #define alc262_auto_init_input_src alc882_auto_init_input_src
9745 /* init callback for auto-configuration model -- overriding the default init */
9746 static void alc262_auto_init(struct hda_codec
*codec
)
9748 struct alc_spec
*spec
= codec
->spec
;
9749 alc262_auto_init_multi_out(codec
);
9750 alc262_auto_init_hp_out(codec
);
9751 alc262_auto_init_analog_input(codec
);
9752 alc262_auto_init_input_src(codec
);
9753 if (spec
->unsol_event
)
9754 alc_sku_automute(codec
);
9758 * configuration and preset
9760 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
9761 [ALC262_BASIC
] = "basic",
9762 [ALC262_HIPPO
] = "hippo",
9763 [ALC262_HIPPO_1
] = "hippo_1",
9764 [ALC262_FUJITSU
] = "fujitsu",
9765 [ALC262_HP_BPC
] = "hp-bpc",
9766 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
9767 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
9768 [ALC262_HP_RP5700
] = "hp-rp5700",
9769 [ALC262_BENQ_ED8
] = "benq",
9770 [ALC262_BENQ_T31
] = "benq-t31",
9771 [ALC262_SONY_ASSAMD
] = "sony-assamd",
9772 [ALC262_ULTRA
] = "ultra",
9773 [ALC262_LENOVO_3000
] = "lenovo-3000",
9774 [ALC262_NEC
] = "nec",
9775 [ALC262_AUTO
] = "auto",
9778 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
9779 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
9780 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC
),
9781 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC
),
9782 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC
),
9783 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC
),
9784 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC
),
9785 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC
),
9786 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC
),
9787 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC
),
9788 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC
),
9789 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9790 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9791 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9792 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9793 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9794 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9795 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9796 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9797 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
9798 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
9799 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
9800 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9801 ALC262_HP_TC_T5735
),
9802 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
9803 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
9804 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
9805 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
9806 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
9807 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD
),
9808 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
9809 ALC262_SONY_ASSAMD
),
9810 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
9811 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
9812 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA
),
9813 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA
),
9814 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
9815 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
9816 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
9817 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
9821 static struct alc_config_preset alc262_presets
[] = {
9823 .mixers
= { alc262_base_mixer
},
9824 .init_verbs
= { alc262_init_verbs
},
9825 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9826 .dac_nids
= alc262_dac_nids
,
9828 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9829 .channel_mode
= alc262_modes
,
9830 .input_mux
= &alc262_capture_source
,
9833 .mixers
= { alc262_base_mixer
},
9834 .init_verbs
= { alc262_init_verbs
, alc262_hippo_unsol_verbs
},
9835 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9836 .dac_nids
= alc262_dac_nids
,
9838 .dig_out_nid
= ALC262_DIGOUT_NID
,
9839 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9840 .channel_mode
= alc262_modes
,
9841 .input_mux
= &alc262_capture_source
,
9842 .unsol_event
= alc262_hippo_unsol_event
,
9843 .init_hook
= alc262_hippo_automute
,
9845 [ALC262_HIPPO_1
] = {
9846 .mixers
= { alc262_hippo1_mixer
},
9847 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
9848 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9849 .dac_nids
= alc262_dac_nids
,
9851 .dig_out_nid
= ALC262_DIGOUT_NID
,
9852 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9853 .channel_mode
= alc262_modes
,
9854 .input_mux
= &alc262_capture_source
,
9855 .unsol_event
= alc262_hippo1_unsol_event
,
9856 .init_hook
= alc262_hippo1_automute
,
9858 [ALC262_FUJITSU
] = {
9859 .mixers
= { alc262_fujitsu_mixer
},
9860 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
9861 alc262_fujitsu_unsol_verbs
},
9862 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9863 .dac_nids
= alc262_dac_nids
,
9865 .dig_out_nid
= ALC262_DIGOUT_NID
,
9866 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9867 .channel_mode
= alc262_modes
,
9868 .input_mux
= &alc262_fujitsu_capture_source
,
9869 .unsol_event
= alc262_fujitsu_unsol_event
,
9870 .init_hook
= alc262_fujitsu_init_hook
,
9873 .mixers
= { alc262_HP_BPC_mixer
},
9874 .init_verbs
= { alc262_HP_BPC_init_verbs
},
9875 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9876 .dac_nids
= alc262_dac_nids
,
9878 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9879 .channel_mode
= alc262_modes
,
9880 .input_mux
= &alc262_HP_capture_source
,
9881 .unsol_event
= alc262_hp_bpc_unsol_event
,
9882 .init_hook
= alc262_hp_bpc_automute
,
9884 [ALC262_HP_BPC_D7000_WF
] = {
9885 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
9886 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
9887 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9888 .dac_nids
= alc262_dac_nids
,
9890 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9891 .channel_mode
= alc262_modes
,
9892 .input_mux
= &alc262_HP_D7000_capture_source
,
9893 .unsol_event
= alc262_hp_wildwest_unsol_event
,
9894 .init_hook
= alc262_hp_wildwest_automute
,
9896 [ALC262_HP_BPC_D7000_WL
] = {
9897 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
9898 alc262_HP_BPC_WildWest_option_mixer
},
9899 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
9900 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9901 .dac_nids
= alc262_dac_nids
,
9903 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9904 .channel_mode
= alc262_modes
,
9905 .input_mux
= &alc262_HP_D7000_capture_source
,
9906 .unsol_event
= alc262_hp_wildwest_unsol_event
,
9907 .init_hook
= alc262_hp_wildwest_automute
,
9909 [ALC262_HP_TC_T5735
] = {
9910 .mixers
= { alc262_hp_t5735_mixer
},
9911 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
9912 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9913 .dac_nids
= alc262_dac_nids
,
9915 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9916 .channel_mode
= alc262_modes
,
9917 .input_mux
= &alc262_capture_source
,
9918 .unsol_event
= alc262_hp_t5735_unsol_event
,
9919 .init_hook
= alc262_hp_t5735_init_hook
,
9921 [ALC262_HP_RP5700
] = {
9922 .mixers
= { alc262_hp_rp5700_mixer
},
9923 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
9924 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9925 .dac_nids
= alc262_dac_nids
,
9926 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9927 .channel_mode
= alc262_modes
,
9928 .input_mux
= &alc262_hp_rp5700_capture_source
,
9930 [ALC262_BENQ_ED8
] = {
9931 .mixers
= { alc262_base_mixer
},
9932 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
9933 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9934 .dac_nids
= alc262_dac_nids
,
9936 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9937 .channel_mode
= alc262_modes
,
9938 .input_mux
= &alc262_capture_source
,
9940 [ALC262_SONY_ASSAMD
] = {
9941 .mixers
= { alc262_sony_mixer
},
9942 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
9943 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9944 .dac_nids
= alc262_dac_nids
,
9946 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9947 .channel_mode
= alc262_modes
,
9948 .input_mux
= &alc262_capture_source
,
9949 .unsol_event
= alc262_hippo_unsol_event
,
9950 .init_hook
= alc262_hippo_automute
,
9952 [ALC262_BENQ_T31
] = {
9953 .mixers
= { alc262_benq_t31_mixer
},
9954 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
, alc262_hippo_unsol_verbs
},
9955 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9956 .dac_nids
= alc262_dac_nids
,
9958 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9959 .channel_mode
= alc262_modes
,
9960 .input_mux
= &alc262_capture_source
,
9961 .unsol_event
= alc262_hippo_unsol_event
,
9962 .init_hook
= alc262_hippo_automute
,
9965 .mixers
= { alc262_ultra_mixer
, alc262_ultra_capture_mixer
},
9966 .init_verbs
= { alc262_ultra_verbs
},
9967 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9968 .dac_nids
= alc262_dac_nids
,
9969 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9970 .channel_mode
= alc262_modes
,
9971 .input_mux
= &alc262_ultra_capture_source
,
9972 .adc_nids
= alc262_adc_nids
, /* ADC0 */
9973 .capsrc_nids
= alc262_capsrc_nids
,
9974 .num_adc_nids
= 1, /* single ADC */
9975 .unsol_event
= alc262_ultra_unsol_event
,
9976 .init_hook
= alc262_ultra_automute
,
9978 [ALC262_LENOVO_3000
] = {
9979 .mixers
= { alc262_lenovo_3000_mixer
},
9980 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
9981 alc262_lenovo_3000_unsol_verbs
},
9982 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9983 .dac_nids
= alc262_dac_nids
,
9985 .dig_out_nid
= ALC262_DIGOUT_NID
,
9986 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9987 .channel_mode
= alc262_modes
,
9988 .input_mux
= &alc262_fujitsu_capture_source
,
9989 .unsol_event
= alc262_lenovo_3000_unsol_event
,
9992 .mixers
= { alc262_nec_mixer
},
9993 .init_verbs
= { alc262_nec_verbs
},
9994 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9995 .dac_nids
= alc262_dac_nids
,
9997 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9998 .channel_mode
= alc262_modes
,
9999 .input_mux
= &alc262_capture_source
,
10003 static int patch_alc262(struct hda_codec
*codec
)
10005 struct alc_spec
*spec
;
10009 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
10013 codec
->spec
= spec
;
10015 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
10020 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
10021 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
10022 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
10023 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
10027 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
10029 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
10033 if (board_config
< 0) {
10034 printk(KERN_INFO
"hda_codec: Unknown model for ALC262, "
10035 "trying auto-probe from BIOS...\n");
10036 board_config
= ALC262_AUTO
;
10039 if (board_config
== ALC262_AUTO
) {
10040 /* automatic parse from the BIOS config */
10041 err
= alc262_parse_auto_config(codec
);
10047 "hda_codec: Cannot set up configuration "
10048 "from BIOS. Using base mode...\n");
10049 board_config
= ALC262_BASIC
;
10053 if (board_config
!= ALC262_AUTO
)
10054 setup_preset(spec
, &alc262_presets
[board_config
]);
10056 spec
->stream_name_analog
= "ALC262 Analog";
10057 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
10058 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
10060 spec
->stream_name_digital
= "ALC262 Digital";
10061 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
10062 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
10064 if (!spec
->adc_nids
&& spec
->input_mux
) {
10065 /* check whether NID 0x07 is valid */
10066 unsigned int wcap
= get_wcaps(codec
, 0x07);
10069 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
10070 if (wcap
!= AC_WID_AUD_IN
) {
10071 spec
->adc_nids
= alc262_adc_nids_alt
;
10072 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids_alt
);
10073 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
10074 spec
->mixers
[spec
->num_mixers
] =
10075 alc262_capture_alt_mixer
;
10076 spec
->num_mixers
++;
10078 spec
->adc_nids
= alc262_adc_nids
;
10079 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids
);
10080 spec
->capsrc_nids
= alc262_capsrc_nids
;
10081 spec
->mixers
[spec
->num_mixers
] = alc262_capture_mixer
;
10082 spec
->num_mixers
++;
10086 spec
->vmaster_nid
= 0x0c;
10088 codec
->patch_ops
= alc_patch_ops
;
10089 if (board_config
== ALC262_AUTO
)
10090 spec
->init_hook
= alc262_auto_init
;
10091 #ifdef CONFIG_SND_HDA_POWER_SAVE
10092 if (!spec
->loopback
.amplist
)
10093 spec
->loopback
.amplist
= alc262_loopbacks
;
10100 * ALC268 channel source setting (2 channel)
10102 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10103 #define alc268_modes alc260_modes
10105 static hda_nid_t alc268_dac_nids
[2] = {
10110 static hda_nid_t alc268_adc_nids
[2] = {
10115 static hda_nid_t alc268_adc_nids_alt
[1] = {
10120 static hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
10122 static struct snd_kcontrol_new alc268_base_mixer
[] = {
10123 /* output mixer control */
10124 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
10125 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10126 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
10127 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10128 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10129 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10130 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
10134 /* bind Beep switches of both NID 0x0f and 0x10 */
10135 static struct hda_bind_ctls alc268_bind_beep_sw
= {
10136 .ops
= &snd_hda_bind_sw
,
10138 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
10139 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
10144 static struct snd_kcontrol_new alc268_beep_mixer
[] = {
10145 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
10146 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
10150 static struct hda_verb alc268_eapd_verbs
[] = {
10151 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10152 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10156 /* Toshiba specific */
10157 #define alc268_toshiba_automute alc262_hippo_automute
10159 static struct hda_verb alc268_toshiba_verbs
[] = {
10160 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10164 /* Acer specific */
10165 /* bind volumes of both NID 0x02 and 0x03 */
10166 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
10167 .ops
= &snd_hda_bind_vol
,
10169 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
10170 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
10175 /* mute/unmute internal speaker according to the hp jack and mute state */
10176 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
10178 struct alc_spec
*spec
= codec
->spec
;
10181 if (force
|| !spec
->sense_updated
) {
10182 unsigned int present
;
10183 present
= snd_hda_codec_read(codec
, 0x14, 0,
10184 AC_VERB_GET_PIN_SENSE
, 0);
10185 spec
->jack_present
= (present
& 0x80000000) != 0;
10186 spec
->sense_updated
= 1;
10188 if (spec
->jack_present
)
10189 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
10190 else /* unmute internal speaker if necessary */
10191 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
10192 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
10193 HDA_AMP_MUTE
, mute
);
10197 /* bind hp and internal speaker mute (with plug check) */
10198 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
10199 struct snd_ctl_elem_value
*ucontrol
)
10201 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10202 long *valp
= ucontrol
->value
.integer
.value
;
10205 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
10207 valp
[0] ? 0 : HDA_AMP_MUTE
);
10208 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
10210 valp
[1] ? 0 : HDA_AMP_MUTE
);
10212 alc268_acer_automute(codec
, 0);
10216 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
10217 /* output mixer control */
10218 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
10220 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10221 .name
= "Master Playback Switch",
10222 .info
= snd_hda_mixer_amp_switch_info
,
10223 .get
= snd_hda_mixer_amp_switch_get
,
10224 .put
= alc268_acer_master_sw_put
,
10225 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
10227 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10228 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
10229 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
10233 static struct hda_verb alc268_acer_verbs
[] = {
10234 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
10235 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10236 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10237 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10238 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10239 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10241 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10245 /* unsolicited event for HP jack sensing */
10246 static void alc268_toshiba_unsol_event(struct hda_codec
*codec
,
10249 if ((res
>> 26) != ALC880_HP_EVENT
)
10251 alc268_toshiba_automute(codec
);
10254 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
10257 if ((res
>> 26) != ALC880_HP_EVENT
)
10259 alc268_acer_automute(codec
, 1);
10262 static void alc268_acer_init_hook(struct hda_codec
*codec
)
10264 alc268_acer_automute(codec
, 1);
10267 static struct snd_kcontrol_new alc268_dell_mixer
[] = {
10268 /* output mixer control */
10269 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10270 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10271 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10272 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10274 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
10278 static struct hda_verb alc268_dell_verbs
[] = {
10279 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10280 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10281 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10285 /* mute/unmute internal speaker according to the hp jack and mute state */
10286 static void alc268_dell_automute(struct hda_codec
*codec
)
10288 unsigned int present
;
10291 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0);
10292 if (present
& 0x80000000)
10293 mute
= HDA_AMP_MUTE
;
10295 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
10296 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10297 HDA_AMP_MUTE
, mute
);
10300 static void alc268_dell_unsol_event(struct hda_codec
*codec
,
10303 if ((res
>> 26) != ALC880_HP_EVENT
)
10305 alc268_dell_automute(codec
);
10308 #define alc268_dell_init_hook alc268_dell_automute
10310 static struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
10311 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
10312 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10313 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
10314 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10315 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10316 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
10317 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
10318 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
10322 static struct hda_verb alc267_quanta_il1_verbs
[] = {
10323 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10324 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
10328 static void alc267_quanta_il1_hp_automute(struct hda_codec
*codec
)
10330 unsigned int present
;
10332 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0)
10333 & AC_PINSENSE_PRESENCE
;
10334 snd_hda_codec_write(codec
, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
10335 present
? 0 : PIN_OUT
);
10338 static void alc267_quanta_il1_mic_automute(struct hda_codec
*codec
)
10340 unsigned int present
;
10342 present
= snd_hda_codec_read(codec
, 0x18, 0,
10343 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
10344 snd_hda_codec_write(codec
, 0x23, 0,
10345 AC_VERB_SET_CONNECT_SEL
,
10346 present
? 0x00 : 0x01);
10349 static void alc267_quanta_il1_automute(struct hda_codec
*codec
)
10351 alc267_quanta_il1_hp_automute(codec
);
10352 alc267_quanta_il1_mic_automute(codec
);
10355 static void alc267_quanta_il1_unsol_event(struct hda_codec
*codec
,
10358 switch (res
>> 26) {
10359 case ALC880_HP_EVENT
:
10360 alc267_quanta_il1_hp_automute(codec
);
10362 case ALC880_MIC_EVENT
:
10363 alc267_quanta_il1_mic_automute(codec
);
10369 * generic initialization of ADC, input mixers and output mixers
10371 static struct hda_verb alc268_base_init_verbs
[] = {
10372 /* Unmute DAC0-1 and set vol = 0 */
10373 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10374 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10375 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10376 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10377 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10378 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10381 * Set up output mixers (0x0c - 0x0e)
10383 /* set vol=0 to output mixers */
10384 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10385 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10386 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10387 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
10389 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10390 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10392 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
10393 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
10394 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
10395 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10396 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10397 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10398 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10399 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10401 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10402 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10403 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10404 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10405 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10406 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10407 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10409 /* set PCBEEP vol = 0, mute connections */
10410 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10411 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10412 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10414 /* Unmute Selector 23h,24h and set the default input to mic-in */
10416 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
10417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10418 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
10419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10425 * generic initialization of ADC, input mixers and output mixers
10427 static struct hda_verb alc268_volume_init_verbs
[] = {
10428 /* set output DAC */
10429 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10430 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10431 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10432 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10434 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10435 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10436 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10437 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10438 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10440 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10441 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10442 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10443 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10444 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10446 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10447 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10448 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10449 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10451 /* set PCBEEP vol = 0, mute connections */
10452 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10453 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10454 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10459 #define alc268_mux_enum_info alc_mux_enum_info
10460 #define alc268_mux_enum_get alc_mux_enum_get
10461 #define alc268_mux_enum_put alc_mux_enum_put
10463 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
10464 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10465 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
10467 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10468 /* The multiple "Capture Source" controls confuse alsamixer
10469 * So call somewhat different..
10471 /* .name = "Capture Source", */
10472 .name
= "Input Source",
10474 .info
= alc268_mux_enum_info
,
10475 .get
= alc268_mux_enum_get
,
10476 .put
= alc268_mux_enum_put
,
10481 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
10482 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10483 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
10484 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
10485 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
10487 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10488 /* The multiple "Capture Source" controls confuse alsamixer
10489 * So call somewhat different..
10491 /* .name = "Capture Source", */
10492 .name
= "Input Source",
10494 .info
= alc268_mux_enum_info
,
10495 .get
= alc268_mux_enum_get
,
10496 .put
= alc268_mux_enum_put
,
10501 static struct hda_input_mux alc268_capture_source
= {
10505 { "Front Mic", 0x1 },
10511 static struct hda_input_mux alc268_acer_capture_source
= {
10515 { "Internal Mic", 0x6 },
10520 #ifdef CONFIG_SND_DEBUG
10521 static struct snd_kcontrol_new alc268_test_mixer
[] = {
10522 /* Volume widgets */
10523 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10524 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10525 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
10526 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
10527 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
10528 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
10529 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
10530 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
10531 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
10532 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
10533 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
10534 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
10535 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
10536 /* The below appears problematic on some hardwares */
10537 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10538 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10539 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
10540 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
10541 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
10543 /* Modes for retasking pin widgets */
10544 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
10545 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
10546 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
10547 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
10549 /* Controls for GPIO pins, assuming they are configured as outputs */
10550 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10551 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10552 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10553 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10555 /* Switches to allow the digital SPDIF output pin to be enabled.
10556 * The ALC268 does not have an SPDIF input.
10558 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10560 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10561 * this output to turn on an external amplifier.
10563 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10564 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10570 /* create input playback/capture controls for the given pin */
10571 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
10572 const char *ctlname
, int idx
)
10577 sprintf(name
, "%s Playback Volume", ctlname
);
10579 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
10580 HDA_COMPOSE_AMP_VAL(0x02, 3, idx
,
10584 } else if (nid
== 0x15) {
10585 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
10586 HDA_COMPOSE_AMP_VAL(0x03, 3, idx
,
10592 sprintf(name
, "%s Playback Switch", ctlname
);
10593 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
10594 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
10600 /* add playback controls from the parsed DAC table */
10601 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
10602 const struct auto_pin_cfg
*cfg
)
10607 spec
->multiout
.num_dacs
= 2; /* only use one dac */
10608 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
10609 spec
->multiout
.dac_nids
[0] = 2;
10610 spec
->multiout
.dac_nids
[1] = 3;
10612 nid
= cfg
->line_out_pins
[0];
10614 alc268_new_analog_output(spec
, nid
, "Front", 0);
10616 nid
= cfg
->speaker_pins
[0];
10618 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10619 "Speaker Playback Volume",
10620 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
10624 nid
= cfg
->hp_pins
[0];
10626 alc268_new_analog_output(spec
, nid
, "Headphone", 0);
10628 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
10630 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10631 "Mono Playback Switch",
10632 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_INPUT
));
10639 /* create playback/capture controls for input pins */
10640 static int alc268_auto_create_analog_input_ctls(struct alc_spec
*spec
,
10641 const struct auto_pin_cfg
*cfg
)
10643 struct hda_input_mux
*imux
= &spec
->private_imux
;
10646 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
10647 switch(cfg
->input_pins
[i
]) {
10649 idx1
= 0; /* Mic 1 */
10652 idx1
= 1; /* Mic 2 */
10655 idx1
= 2; /* Line In */
10662 idx1
= 6; /* digital mics */
10667 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
10668 imux
->items
[imux
->num_items
].index
= idx1
;
10674 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
10676 struct alc_spec
*spec
= codec
->spec
;
10677 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
10678 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
10679 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
10680 unsigned int dac_vol1
, dac_vol2
;
10683 snd_hda_codec_write(codec
, speaker_nid
, 0,
10684 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
10685 snd_hda_codec_write(codec
, 0x0f, 0,
10686 AC_VERB_SET_AMP_GAIN_MUTE
,
10688 snd_hda_codec_write(codec
, 0x10, 0,
10689 AC_VERB_SET_AMP_GAIN_MUTE
,
10692 snd_hda_codec_write(codec
, 0x0f, 0,
10693 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
10694 snd_hda_codec_write(codec
, 0x10, 0,
10695 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
10698 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
10699 if (line_nid
== 0x14)
10700 dac_vol2
= AMP_OUT_ZERO
;
10701 else if (line_nid
== 0x15)
10702 dac_vol1
= AMP_OUT_ZERO
;
10703 if (hp_nid
== 0x14)
10704 dac_vol2
= AMP_OUT_ZERO
;
10705 else if (hp_nid
== 0x15)
10706 dac_vol1
= AMP_OUT_ZERO
;
10707 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
10708 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
10709 spec
->autocfg
.line_out_pins
[2] != 0x16)
10710 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
10712 snd_hda_codec_write(codec
, 0x02, 0,
10713 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
10714 snd_hda_codec_write(codec
, 0x03, 0,
10715 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
10718 /* pcm configuration: identiacal with ALC880 */
10719 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10720 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10721 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10722 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10725 * BIOS auto configuration
10727 static int alc268_parse_auto_config(struct hda_codec
*codec
)
10729 struct alc_spec
*spec
= codec
->spec
;
10731 static hda_nid_t alc268_ignore
[] = { 0 };
10733 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10737 if (!spec
->autocfg
.line_outs
)
10738 return 0; /* can't find valid BIOS pin config */
10740 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
10743 err
= alc268_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
10747 spec
->multiout
.max_channels
= 2;
10749 /* digital only support output */
10750 if (spec
->autocfg
.dig_out_pin
)
10751 spec
->multiout
.dig_out_nid
= ALC268_DIGOUT_NID
;
10753 if (spec
->kctl_alloc
)
10754 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
10756 if (spec
->autocfg
.speaker_pins
[0] != 0x1d)
10757 spec
->mixers
[spec
->num_mixers
++] = alc268_beep_mixer
;
10759 spec
->init_verbs
[spec
->num_init_verbs
++] = alc268_volume_init_verbs
;
10760 spec
->num_mux_defs
= 1;
10761 spec
->input_mux
= &spec
->private_imux
;
10763 err
= alc_auto_add_mic_boost(codec
);
10770 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10771 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10772 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10774 /* init callback for auto-configuration model -- overriding the default init */
10775 static void alc268_auto_init(struct hda_codec
*codec
)
10777 struct alc_spec
*spec
= codec
->spec
;
10778 alc268_auto_init_multi_out(codec
);
10779 alc268_auto_init_hp_out(codec
);
10780 alc268_auto_init_mono_speaker_out(codec
);
10781 alc268_auto_init_analog_input(codec
);
10782 if (spec
->unsol_event
)
10783 alc_sku_automute(codec
);
10787 * configuration and preset
10789 static const char *alc268_models
[ALC268_MODEL_LAST
] = {
10790 [ALC267_QUANTA_IL1
] = "quanta-il1",
10791 [ALC268_3ST
] = "3stack",
10792 [ALC268_TOSHIBA
] = "toshiba",
10793 [ALC268_ACER
] = "acer",
10794 [ALC268_DELL
] = "dell",
10795 [ALC268_ZEPTO
] = "zepto",
10796 #ifdef CONFIG_SND_DEBUG
10797 [ALC268_TEST
] = "test",
10799 [ALC268_AUTO
] = "auto",
10802 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
10803 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
10804 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
10805 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
10806 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
10807 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
10808 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
10809 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA
),
10810 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
10811 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA
),
10812 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA
),
10813 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
10814 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
10815 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
10816 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
10820 static struct alc_config_preset alc268_presets
[] = {
10821 [ALC267_QUANTA_IL1
] = {
10822 .mixers
= { alc267_quanta_il1_mixer
},
10823 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10824 alc267_quanta_il1_verbs
},
10825 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10826 .dac_nids
= alc268_dac_nids
,
10827 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10828 .adc_nids
= alc268_adc_nids_alt
,
10830 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10831 .channel_mode
= alc268_modes
,
10832 .input_mux
= &alc268_capture_source
,
10833 .unsol_event
= alc267_quanta_il1_unsol_event
,
10834 .init_hook
= alc267_quanta_il1_automute
,
10837 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
10838 alc268_beep_mixer
},
10839 .init_verbs
= { alc268_base_init_verbs
},
10840 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10841 .dac_nids
= alc268_dac_nids
,
10842 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10843 .adc_nids
= alc268_adc_nids_alt
,
10844 .capsrc_nids
= alc268_capsrc_nids
,
10846 .dig_out_nid
= ALC268_DIGOUT_NID
,
10847 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10848 .channel_mode
= alc268_modes
,
10849 .input_mux
= &alc268_capture_source
,
10851 [ALC268_TOSHIBA
] = {
10852 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
10853 alc268_beep_mixer
},
10854 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10855 alc268_toshiba_verbs
},
10856 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10857 .dac_nids
= alc268_dac_nids
,
10858 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10859 .adc_nids
= alc268_adc_nids_alt
,
10860 .capsrc_nids
= alc268_capsrc_nids
,
10862 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10863 .channel_mode
= alc268_modes
,
10864 .input_mux
= &alc268_capture_source
,
10865 .unsol_event
= alc268_toshiba_unsol_event
,
10866 .init_hook
= alc268_toshiba_automute
,
10869 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
10870 alc268_beep_mixer
},
10871 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10872 alc268_acer_verbs
},
10873 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10874 .dac_nids
= alc268_dac_nids
,
10875 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10876 .adc_nids
= alc268_adc_nids_alt
,
10877 .capsrc_nids
= alc268_capsrc_nids
,
10879 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10880 .channel_mode
= alc268_modes
,
10881 .input_mux
= &alc268_acer_capture_source
,
10882 .unsol_event
= alc268_acer_unsol_event
,
10883 .init_hook
= alc268_acer_init_hook
,
10886 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
},
10887 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10888 alc268_dell_verbs
},
10889 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10890 .dac_nids
= alc268_dac_nids
,
10892 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10893 .channel_mode
= alc268_modes
,
10894 .unsol_event
= alc268_dell_unsol_event
,
10895 .init_hook
= alc268_dell_init_hook
,
10896 .input_mux
= &alc268_capture_source
,
10899 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
10900 alc268_beep_mixer
},
10901 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10902 alc268_toshiba_verbs
},
10903 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10904 .dac_nids
= alc268_dac_nids
,
10905 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10906 .adc_nids
= alc268_adc_nids_alt
,
10907 .capsrc_nids
= alc268_capsrc_nids
,
10909 .dig_out_nid
= ALC268_DIGOUT_NID
,
10910 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10911 .channel_mode
= alc268_modes
,
10912 .input_mux
= &alc268_capture_source
,
10913 .unsol_event
= alc268_toshiba_unsol_event
,
10914 .init_hook
= alc268_toshiba_automute
10916 #ifdef CONFIG_SND_DEBUG
10918 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
10919 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10920 alc268_volume_init_verbs
},
10921 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10922 .dac_nids
= alc268_dac_nids
,
10923 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10924 .adc_nids
= alc268_adc_nids_alt
,
10925 .capsrc_nids
= alc268_capsrc_nids
,
10927 .dig_out_nid
= ALC268_DIGOUT_NID
,
10928 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10929 .channel_mode
= alc268_modes
,
10930 .input_mux
= &alc268_capture_source
,
10935 static int patch_alc268(struct hda_codec
*codec
)
10937 struct alc_spec
*spec
;
10941 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
10945 codec
->spec
= spec
;
10947 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
10951 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
10952 printk(KERN_INFO
"hda_codec: Unknown model for ALC268, "
10953 "trying auto-probe from BIOS...\n");
10954 board_config
= ALC268_AUTO
;
10957 if (board_config
== ALC268_AUTO
) {
10958 /* automatic parse from the BIOS config */
10959 err
= alc268_parse_auto_config(codec
);
10965 "hda_codec: Cannot set up configuration "
10966 "from BIOS. Using base mode...\n");
10967 board_config
= ALC268_3ST
;
10971 if (board_config
!= ALC268_AUTO
)
10972 setup_preset(spec
, &alc268_presets
[board_config
]);
10974 if (codec
->vendor_id
== 0x10ec0267) {
10975 spec
->stream_name_analog
= "ALC267 Analog";
10976 spec
->stream_name_digital
= "ALC267 Digital";
10978 spec
->stream_name_analog
= "ALC268 Analog";
10979 spec
->stream_name_digital
= "ALC268 Digital";
10982 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
10983 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
10984 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
10986 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
10988 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
10989 /* override the amp caps for beep generator */
10990 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
10991 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
10992 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
10993 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
10994 (0 << AC_AMPCAP_MUTE_SHIFT
));
10996 if (!spec
->adc_nids
&& spec
->input_mux
) {
10997 /* check whether NID 0x07 is valid */
10998 unsigned int wcap
= get_wcaps(codec
, 0x07);
11002 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
11003 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
11004 spec
->adc_nids
= alc268_adc_nids_alt
;
11005 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
11006 spec
->mixers
[spec
->num_mixers
] =
11007 alc268_capture_alt_mixer
;
11008 spec
->num_mixers
++;
11010 spec
->adc_nids
= alc268_adc_nids
;
11011 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
11012 spec
->mixers
[spec
->num_mixers
] =
11013 alc268_capture_mixer
;
11014 spec
->num_mixers
++;
11016 spec
->capsrc_nids
= alc268_capsrc_nids
;
11017 /* set default input source */
11018 for (i
= 0; i
< spec
->num_adc_nids
; i
++)
11019 snd_hda_codec_write_cache(codec
, alc268_capsrc_nids
[i
],
11020 0, AC_VERB_SET_CONNECT_SEL
,
11021 spec
->input_mux
->items
[0].index
);
11024 spec
->vmaster_nid
= 0x02;
11026 codec
->patch_ops
= alc_patch_ops
;
11027 if (board_config
== ALC268_AUTO
)
11028 spec
->init_hook
= alc268_auto_init
;
11034 * ALC269 channel source setting (2 channel)
11036 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
11038 #define alc269_dac_nids alc260_dac_nids
11040 static hda_nid_t alc269_adc_nids
[1] = {
11045 static struct hda_input_mux alc269_eeepc_dmic_capture_source
= {
11053 static struct hda_input_mux alc269_eeepc_amic_capture_source
= {
11061 #define alc269_modes alc260_modes
11062 #define alc269_capture_source alc880_lg_lw_capture_source
11064 static struct snd_kcontrol_new alc269_base_mixer
[] = {
11065 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11066 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11067 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11068 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11069 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11070 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11071 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
11072 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
11073 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
11074 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
11075 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11076 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
11080 /* bind volumes of both NID 0x0c and 0x0d */
11081 static struct hda_bind_ctls alc269_epc_bind_vol
= {
11082 .ops
= &snd_hda_bind_vol
,
11084 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
11085 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
11090 static struct snd_kcontrol_new alc269_eeepc_mixer
[] = {
11091 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11092 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol
),
11093 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11097 /* capture mixer elements */
11098 static struct snd_kcontrol_new alc269_capture_mixer
[] = {
11099 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11100 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11102 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11103 /* The multiple "Capture Source" controls confuse alsamixer
11104 * So call somewhat different..
11106 /* .name = "Capture Source", */
11107 .name
= "Input Source",
11109 .info
= alc_mux_enum_info
,
11110 .get
= alc_mux_enum_get
,
11111 .put
= alc_mux_enum_put
,
11116 /* capture mixer elements */
11117 static struct snd_kcontrol_new alc269_epc_capture_mixer
[] = {
11118 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11119 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11124 * generic initialization of ADC, input mixers and output mixers
11126 static struct hda_verb alc269_init_verbs
[] = {
11128 * Unmute ADC0 and set the default input to mic-in
11130 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11132 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
11133 * analog-loopback mixer widget
11134 * Note: PASD motherboards uses the Line In 2 as the input for
11135 * front panel mic (mic 2)
11137 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11138 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11139 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11140 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11141 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11142 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11145 * Set up output mixers (0x0c - 0x0e)
11147 /* set vol=0 to output mixers */
11148 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11149 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11151 /* set up input amps for analog loopback */
11152 /* Amp Indices: DAC = 0, mixer = 1 */
11153 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11154 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11155 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11156 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11157 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11158 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11160 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11161 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11162 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11163 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11164 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11165 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11166 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11168 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11169 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11170 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11171 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11172 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11173 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11174 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11176 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11177 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11179 /* FIXME: use matrix-type input source selection */
11180 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
11181 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11184 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11185 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11188 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11189 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11193 static struct hda_verb alc269_eeepc_dmic_init_verbs
[] = {
11194 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11195 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x05},
11196 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
11197 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7019 | (0x00 << 8))},
11198 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11199 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11200 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11204 static struct hda_verb alc269_eeepc_amic_init_verbs
[] = {
11205 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11206 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
11207 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb026 },
11208 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x701b | (0x00 << 8))},
11209 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11210 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11214 /* toggle speaker-output according to the hp-jack state */
11215 static void alc269_speaker_automute(struct hda_codec
*codec
)
11217 unsigned int present
;
11220 present
= snd_hda_codec_read(codec
, 0x15, 0,
11221 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11222 bits
= present
? AMP_IN_MUTE(0) : 0;
11223 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 0,
11224 AMP_IN_MUTE(0), bits
);
11225 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_INPUT
, 1,
11226 AMP_IN_MUTE(0), bits
);
11229 static void alc269_eeepc_dmic_automute(struct hda_codec
*codec
)
11231 unsigned int present
;
11233 present
= snd_hda_codec_read(codec
, 0x18, 0, AC_VERB_GET_PIN_SENSE
, 0)
11234 & AC_PINSENSE_PRESENCE
;
11235 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_CONNECT_SEL
,
11239 static void alc269_eeepc_amic_automute(struct hda_codec
*codec
)
11241 unsigned int present
;
11243 present
= snd_hda_codec_read(codec
, 0x18, 0, AC_VERB_GET_PIN_SENSE
, 0)
11244 & AC_PINSENSE_PRESENCE
;
11245 snd_hda_codec_write(codec
, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
11246 present
? AMP_IN_UNMUTE(0) : AMP_IN_MUTE(0));
11247 snd_hda_codec_write(codec
, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
11248 present
? AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1));
11251 /* unsolicited event for HP jack sensing */
11252 static void alc269_eeepc_dmic_unsol_event(struct hda_codec
*codec
,
11255 if ((res
>> 26) == ALC880_HP_EVENT
)
11256 alc269_speaker_automute(codec
);
11258 if ((res
>> 26) == ALC880_MIC_EVENT
)
11259 alc269_eeepc_dmic_automute(codec
);
11262 static void alc269_eeepc_dmic_inithook(struct hda_codec
*codec
)
11264 alc269_speaker_automute(codec
);
11265 alc269_eeepc_dmic_automute(codec
);
11268 /* unsolicited event for HP jack sensing */
11269 static void alc269_eeepc_amic_unsol_event(struct hda_codec
*codec
,
11272 if ((res
>> 26) == ALC880_HP_EVENT
)
11273 alc269_speaker_automute(codec
);
11275 if ((res
>> 26) == ALC880_MIC_EVENT
)
11276 alc269_eeepc_amic_automute(codec
);
11279 static void alc269_eeepc_amic_inithook(struct hda_codec
*codec
)
11281 alc269_speaker_automute(codec
);
11282 alc269_eeepc_amic_automute(codec
);
11285 /* add playback controls from the parsed DAC table */
11286 static int alc269_auto_create_multi_out_ctls(struct alc_spec
*spec
,
11287 const struct auto_pin_cfg
*cfg
)
11292 spec
->multiout
.num_dacs
= 1; /* only use one dac */
11293 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
11294 spec
->multiout
.dac_nids
[0] = 2;
11296 nid
= cfg
->line_out_pins
[0];
11298 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11299 "Front Playback Volume",
11300 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
));
11303 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11304 "Front Playback Switch",
11305 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
11310 nid
= cfg
->speaker_pins
[0];
11312 if (!cfg
->line_out_pins
[0]) {
11313 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11314 "Speaker Playback Volume",
11315 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11321 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11322 "Speaker Playback Switch",
11323 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
11328 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11329 "Speaker Playback Switch",
11330 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
11336 nid
= cfg
->hp_pins
[0];
11338 /* spec->multiout.hp_nid = 2; */
11339 if (!cfg
->line_out_pins
[0] && !cfg
->speaker_pins
[0]) {
11340 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11341 "Headphone Playback Volume",
11342 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11348 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11349 "Headphone Playback Switch",
11350 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
11355 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11356 "Headphone Playback Switch",
11357 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
11366 #define alc269_auto_create_analog_input_ctls \
11367 alc880_auto_create_analog_input_ctls
11369 #ifdef CONFIG_SND_HDA_POWER_SAVE
11370 #define alc269_loopbacks alc880_loopbacks
11373 /* pcm configuration: identiacal with ALC880 */
11374 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
11375 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
11376 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
11377 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
11380 * BIOS auto configuration
11382 static int alc269_parse_auto_config(struct hda_codec
*codec
)
11384 struct alc_spec
*spec
= codec
->spec
;
11386 static hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
11388 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
11393 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
11396 err
= alc269_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
11400 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
11402 if (spec
->autocfg
.dig_out_pin
)
11403 spec
->multiout
.dig_out_nid
= ALC269_DIGOUT_NID
;
11405 if (spec
->kctl_alloc
)
11406 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
11408 spec
->init_verbs
[spec
->num_init_verbs
++] = alc269_init_verbs
;
11409 spec
->num_mux_defs
= 1;
11410 spec
->input_mux
= &spec
->private_imux
;
11412 err
= alc_auto_add_mic_boost(codec
);
11416 spec
->mixers
[spec
->num_mixers
] = alc269_capture_mixer
;
11417 spec
->num_mixers
++;
11422 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
11423 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
11424 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
11427 /* init callback for auto-configuration model -- overriding the default init */
11428 static void alc269_auto_init(struct hda_codec
*codec
)
11430 struct alc_spec
*spec
= codec
->spec
;
11431 alc269_auto_init_multi_out(codec
);
11432 alc269_auto_init_hp_out(codec
);
11433 alc269_auto_init_analog_input(codec
);
11434 if (spec
->unsol_event
)
11435 alc_sku_automute(codec
);
11439 * configuration and preset
11441 static const char *alc269_models
[ALC269_MODEL_LAST
] = {
11442 [ALC269_BASIC
] = "basic",
11445 static struct snd_pci_quirk alc269_cfg_tbl
[] = {
11446 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
11447 ALC269_ASUS_EEEPC_P703
),
11448 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
11449 ALC269_ASUS_EEEPC_P901
),
11453 static struct alc_config_preset alc269_presets
[] = {
11455 .mixers
= { alc269_base_mixer
, alc269_capture_mixer
},
11456 .init_verbs
= { alc269_init_verbs
},
11457 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
11458 .dac_nids
= alc269_dac_nids
,
11460 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
11461 .channel_mode
= alc269_modes
,
11462 .input_mux
= &alc269_capture_source
,
11464 [ALC269_ASUS_EEEPC_P703
] = {
11465 .mixers
= { alc269_eeepc_mixer
, alc269_epc_capture_mixer
},
11466 .init_verbs
= { alc269_init_verbs
,
11467 alc269_eeepc_amic_init_verbs
},
11468 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
11469 .dac_nids
= alc269_dac_nids
,
11471 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
11472 .channel_mode
= alc269_modes
,
11473 .input_mux
= &alc269_eeepc_amic_capture_source
,
11474 .unsol_event
= alc269_eeepc_amic_unsol_event
,
11475 .init_hook
= alc269_eeepc_amic_inithook
,
11477 [ALC269_ASUS_EEEPC_P901
] = {
11478 .mixers
= { alc269_eeepc_mixer
, alc269_epc_capture_mixer
},
11479 .init_verbs
= { alc269_init_verbs
,
11480 alc269_eeepc_dmic_init_verbs
},
11481 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
11482 .dac_nids
= alc269_dac_nids
,
11484 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
11485 .channel_mode
= alc269_modes
,
11486 .input_mux
= &alc269_eeepc_dmic_capture_source
,
11487 .unsol_event
= alc269_eeepc_dmic_unsol_event
,
11488 .init_hook
= alc269_eeepc_dmic_inithook
,
11492 static int patch_alc269(struct hda_codec
*codec
)
11494 struct alc_spec
*spec
;
11498 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
11502 codec
->spec
= spec
;
11504 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
11506 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
11510 if (board_config
< 0) {
11511 printk(KERN_INFO
"hda_codec: Unknown model for ALC269, "
11512 "trying auto-probe from BIOS...\n");
11513 board_config
= ALC269_AUTO
;
11516 if (board_config
== ALC269_AUTO
) {
11517 /* automatic parse from the BIOS config */
11518 err
= alc269_parse_auto_config(codec
);
11524 "hda_codec: Cannot set up configuration "
11525 "from BIOS. Using base mode...\n");
11526 board_config
= ALC269_BASIC
;
11530 if (board_config
!= ALC269_AUTO
)
11531 setup_preset(spec
, &alc269_presets
[board_config
]);
11533 spec
->stream_name_analog
= "ALC269 Analog";
11534 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
11535 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
11537 spec
->stream_name_digital
= "ALC269 Digital";
11538 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
11539 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
11541 spec
->adc_nids
= alc269_adc_nids
;
11542 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
11544 codec
->patch_ops
= alc_patch_ops
;
11545 if (board_config
== ALC269_AUTO
)
11546 spec
->init_hook
= alc269_auto_init
;
11547 #ifdef CONFIG_SND_HDA_POWER_SAVE
11548 if (!spec
->loopback
.amplist
)
11549 spec
->loopback
.amplist
= alc269_loopbacks
;
11556 * ALC861 channel source setting (2/6 channel selection for 3-stack)
11560 * set the path ways for 2 channel output
11561 * need to set the codec line out and mic 1 pin widgets to inputs
11563 static struct hda_verb alc861_threestack_ch2_init
[] = {
11564 /* set pin widget 1Ah (line in) for input */
11565 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11566 /* set pin widget 18h (mic1/2) for input, for mic also enable
11569 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11571 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
11573 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
11574 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
11580 * need to set the codec line out and mic 1 pin widgets to outputs
11582 static struct hda_verb alc861_threestack_ch6_init
[] = {
11583 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11584 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11585 /* set pin widget 18h (mic1) for output (CLFE)*/
11586 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11588 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11589 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11591 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
11593 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
11594 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
11599 static struct hda_channel_mode alc861_threestack_modes
[2] = {
11600 { 2, alc861_threestack_ch2_init
},
11601 { 6, alc861_threestack_ch6_init
},
11603 /* Set mic1 as input and unmute the mixer */
11604 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
11605 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11606 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
11609 /* Set mic1 as output and mute mixer */
11610 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
11611 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11612 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
11616 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
11617 { 2, alc861_uniwill_m31_ch2_init
},
11618 { 4, alc861_uniwill_m31_ch4_init
},
11621 /* Set mic1 and line-in as input and unmute the mixer */
11622 static struct hda_verb alc861_asus_ch2_init
[] = {
11623 /* set pin widget 1Ah (line in) for input */
11624 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11625 /* set pin widget 18h (mic1/2) for input, for mic also enable
11628 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11630 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
11632 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
11633 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
11637 /* Set mic1 nad line-in as output and mute mixer */
11638 static struct hda_verb alc861_asus_ch6_init
[] = {
11639 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11640 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11641 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11642 /* set pin widget 18h (mic1) for output (CLFE)*/
11643 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11644 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11645 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11646 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11648 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
11650 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
11651 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
11656 static struct hda_channel_mode alc861_asus_modes
[2] = {
11657 { 2, alc861_asus_ch2_init
},
11658 { 6, alc861_asus_ch6_init
},
11663 static struct snd_kcontrol_new alc861_base_mixer
[] = {
11664 /* output mixer control */
11665 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11666 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11667 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11668 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11669 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
11671 /*Input mixer control */
11672 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11673 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11674 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11675 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11676 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11677 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11678 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11679 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11680 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
11683 /* Capture mixer control */
11684 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11685 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11687 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11688 .name
= "Capture Source",
11690 .info
= alc_mux_enum_info
,
11691 .get
= alc_mux_enum_get
,
11692 .put
= alc_mux_enum_put
,
11697 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
11698 /* output mixer control */
11699 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11700 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11701 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11702 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11703 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11705 /* Input mixer control */
11706 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11707 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11708 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11709 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11710 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11711 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11712 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11713 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11714 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11715 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
11717 /* Capture mixer control */
11718 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11719 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11721 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11722 .name
= "Capture Source",
11724 .info
= alc_mux_enum_info
,
11725 .get
= alc_mux_enum_get
,
11726 .put
= alc_mux_enum_put
,
11729 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11730 .name
= "Channel Mode",
11731 .info
= alc_ch_mode_info
,
11732 .get
= alc_ch_mode_get
,
11733 .put
= alc_ch_mode_put
,
11734 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
11739 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
11740 /* output mixer control */
11741 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11743 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11745 /*Capture mixer control */
11746 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11747 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11749 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11750 .name
= "Capture Source",
11752 .info
= alc_mux_enum_info
,
11753 .get
= alc_mux_enum_get
,
11754 .put
= alc_mux_enum_put
,
11760 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
11761 /* output mixer control */
11762 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11763 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11764 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11765 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11766 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11768 /* Input mixer control */
11769 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11770 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11771 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11772 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11773 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11774 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11776 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11777 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11778 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
11780 /* Capture mixer control */
11781 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11782 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11784 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11785 .name
= "Capture Source",
11787 .info
= alc_mux_enum_info
,
11788 .get
= alc_mux_enum_get
,
11789 .put
= alc_mux_enum_put
,
11792 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11793 .name
= "Channel Mode",
11794 .info
= alc_ch_mode_info
,
11795 .get
= alc_ch_mode_get
,
11796 .put
= alc_ch_mode_put
,
11797 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
11802 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
11803 /* output mixer control */
11804 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11805 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11806 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11807 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11808 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
11810 /* Input mixer control */
11811 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
11812 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11813 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11814 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11815 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11816 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11818 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11819 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11820 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
11822 /* Capture mixer control */
11823 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11824 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11826 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11827 .name
= "Capture Source",
11829 .info
= alc_mux_enum_info
,
11830 .get
= alc_mux_enum_get
,
11831 .put
= alc_mux_enum_put
,
11834 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11835 .name
= "Channel Mode",
11836 .info
= alc_ch_mode_info
,
11837 .get
= alc_ch_mode_get
,
11838 .put
= alc_ch_mode_put
,
11839 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
11844 /* additional mixer */
11845 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
11846 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11847 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11848 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT
),
11849 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT
),
11854 * generic initialization of ADC, input mixers and output mixers
11856 static struct hda_verb alc861_base_init_verbs
[] = {
11858 * Unmute ADC0 and set the default input to mic-in
11860 /* port-A for surround (rear panel) */
11861 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11862 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11863 /* port-B for mic-in (rear panel) with vref */
11864 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11865 /* port-C for line-in (rear panel) */
11866 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11867 /* port-D for Front */
11868 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11869 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11870 /* port-E for HP out (front panel) */
11871 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
11872 /* route front PCM to HP */
11873 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11874 /* port-F for mic-in (front panel) with vref */
11875 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11876 /* port-G for CLFE (rear panel) */
11877 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11878 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11879 /* port-H for side (rear panel) */
11880 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11881 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11883 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11884 /* route front mic to ADC1*/
11885 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11886 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11888 /* Unmute DAC0~3 & spdif out*/
11889 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11890 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11891 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11892 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11893 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11895 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11896 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11897 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11898 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11899 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11901 /* Unmute Stereo Mixer 15 */
11902 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11903 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11904 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
11907 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11908 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11909 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11910 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11911 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11912 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11913 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11914 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11915 /* hp used DAC 3 (Front) */
11916 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11917 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11922 static struct hda_verb alc861_threestack_init_verbs
[] = {
11924 * Unmute ADC0 and set the default input to mic-in
11926 /* port-A for surround (rear panel) */
11927 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11928 /* port-B for mic-in (rear panel) with vref */
11929 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11930 /* port-C for line-in (rear panel) */
11931 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11932 /* port-D for Front */
11933 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11934 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11935 /* port-E for HP out (front panel) */
11936 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
11937 /* route front PCM to HP */
11938 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11939 /* port-F for mic-in (front panel) with vref */
11940 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11941 /* port-G for CLFE (rear panel) */
11942 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11943 /* port-H for side (rear panel) */
11944 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11946 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11947 /* route front mic to ADC1*/
11948 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11949 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11950 /* Unmute DAC0~3 & spdif out*/
11951 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11952 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11953 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11954 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11955 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11957 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11958 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11959 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11960 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11961 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11963 /* Unmute Stereo Mixer 15 */
11964 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11965 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11966 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11967 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
11969 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11970 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11971 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11972 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11973 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11974 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11975 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11976 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11977 /* hp used DAC 3 (Front) */
11978 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11979 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11983 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
11985 * Unmute ADC0 and set the default input to mic-in
11987 /* port-A for surround (rear panel) */
11988 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11989 /* port-B for mic-in (rear panel) with vref */
11990 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11991 /* port-C for line-in (rear panel) */
11992 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11993 /* port-D for Front */
11994 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11995 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11996 /* port-E for HP out (front panel) */
11997 /* this has to be set to VREF80 */
11998 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11999 /* route front PCM to HP */
12000 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12001 /* port-F for mic-in (front panel) with vref */
12002 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12003 /* port-G for CLFE (rear panel) */
12004 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12005 /* port-H for side (rear panel) */
12006 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12008 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12009 /* route front mic to ADC1*/
12010 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12011 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12012 /* Unmute DAC0~3 & spdif out*/
12013 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12014 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12015 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12016 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12019 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12020 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12021 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12022 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12023 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12025 /* Unmute Stereo Mixer 15 */
12026 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12027 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12028 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12029 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
12031 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12032 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12033 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12034 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12035 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12036 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12037 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12038 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12039 /* hp used DAC 3 (Front) */
12040 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12041 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12045 static struct hda_verb alc861_asus_init_verbs
[] = {
12047 * Unmute ADC0 and set the default input to mic-in
12049 /* port-A for surround (rear panel)
12050 * according to codec#0 this is the HP jack
12052 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
12053 /* route front PCM to HP */
12054 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
12055 /* port-B for mic-in (rear panel) with vref */
12056 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12057 /* port-C for line-in (rear panel) */
12058 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12059 /* port-D for Front */
12060 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12061 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12062 /* port-E for HP out (front panel) */
12063 /* this has to be set to VREF80 */
12064 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12065 /* route front PCM to HP */
12066 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
12067 /* port-F for mic-in (front panel) with vref */
12068 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
12069 /* port-G for CLFE (rear panel) */
12070 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12071 /* port-H for side (rear panel) */
12072 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
12074 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
12075 /* route front mic to ADC1*/
12076 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
12077 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12078 /* Unmute DAC0~3 & spdif out*/
12079 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12080 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12081 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12082 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12083 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12084 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12085 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12086 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12087 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12088 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12090 /* Unmute Stereo Mixer 15 */
12091 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12092 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12093 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12094 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
12096 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12097 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12098 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12099 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12100 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12101 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12102 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12103 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12104 /* hp used DAC 3 (Front) */
12105 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12106 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12110 /* additional init verbs for ASUS laptops */
12111 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
12112 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
12113 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
12118 * generic initialization of ADC, input mixers and output mixers
12120 static struct hda_verb alc861_auto_init_verbs
[] = {
12122 * Unmute ADC0 and set the default input to mic-in
12124 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
12125 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12127 /* Unmute DAC0~3 & spdif out*/
12128 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12129 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12130 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12131 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12132 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12134 /* Unmute Mixer 14 (mic) 1c (Line in)*/
12135 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12136 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12137 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12138 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12140 /* Unmute Stereo Mixer 15 */
12141 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12142 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12143 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12144 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
12146 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12147 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12148 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12149 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12150 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12151 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12152 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12153 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12155 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12156 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12157 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12158 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12159 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12160 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12161 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12162 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
12164 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
12169 static struct hda_verb alc861_toshiba_init_verbs
[] = {
12170 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12175 /* toggle speaker-output according to the hp-jack state */
12176 static void alc861_toshiba_automute(struct hda_codec
*codec
)
12178 unsigned int present
;
12180 present
= snd_hda_codec_read(codec
, 0x0f, 0,
12181 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12182 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
12183 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
12184 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
12185 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
12188 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
12191 if ((res
>> 26) == ALC880_HP_EVENT
)
12192 alc861_toshiba_automute(codec
);
12195 /* pcm configuration: identiacal with ALC880 */
12196 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
12197 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
12198 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
12199 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
12202 #define ALC861_DIGOUT_NID 0x07
12204 static struct hda_channel_mode alc861_8ch_modes
[1] = {
12208 static hda_nid_t alc861_dac_nids
[4] = {
12209 /* front, surround, clfe, side */
12210 0x03, 0x06, 0x05, 0x04
12213 static hda_nid_t alc660_dac_nids
[3] = {
12214 /* front, clfe, surround */
12218 static hda_nid_t alc861_adc_nids
[1] = {
12223 static struct hda_input_mux alc861_capture_source
= {
12227 { "Front Mic", 0x3 },
12234 /* fill in the dac_nids table from the parsed pin configuration */
12235 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
,
12236 const struct auto_pin_cfg
*cfg
)
12241 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
12242 for (i
= 0; i
< cfg
->line_outs
; i
++) {
12243 nid
= cfg
->line_out_pins
[i
];
12245 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
12247 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
12250 spec
->multiout
.num_dacs
= cfg
->line_outs
;
12254 /* add playback controls from the parsed DAC table */
12255 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12256 const struct auto_pin_cfg
*cfg
)
12259 static const char *chname
[4] = {
12260 "Front", "Surround", NULL
/*CLFE*/, "Side"
12265 for (i
= 0; i
< cfg
->line_outs
; i
++) {
12266 nid
= spec
->multiout
.dac_nids
[i
];
12271 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
12272 "Center Playback Switch",
12273 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
12277 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
12278 "LFE Playback Switch",
12279 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
12284 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1;
12286 if (nid
== alc861_dac_nids
[idx
])
12288 sprintf(name
, "%s Playback Switch", chname
[idx
]);
12289 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
12290 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
12299 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
12307 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
12309 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12310 "Headphone Playback Switch",
12311 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
12314 spec
->multiout
.hp_nid
= nid
;
12319 /* create playback/capture controls for input pins */
12320 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
,
12321 const struct auto_pin_cfg
*cfg
)
12323 struct hda_input_mux
*imux
= &spec
->private_imux
;
12324 int i
, err
, idx
, idx1
;
12326 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12327 switch (cfg
->input_pins
[i
]) {
12330 idx
= 2; /* Line In */
12334 idx
= 2; /* Line In */
12338 idx
= 1; /* Mic In */
12342 idx
= 1; /* Mic In */
12352 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
12353 auto_pin_cfg_labels
[i
], idx
, 0x15);
12357 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
12358 imux
->items
[imux
->num_items
].index
= idx1
;
12364 static struct snd_kcontrol_new alc861_capture_mixer
[] = {
12365 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
12366 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
12369 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12370 /* The multiple "Capture Source" controls confuse alsamixer
12371 * So call somewhat different..
12373 /* .name = "Capture Source", */
12374 .name
= "Input Source",
12376 .info
= alc_mux_enum_info
,
12377 .get
= alc_mux_enum_get
,
12378 .put
= alc_mux_enum_put
,
12383 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
12385 int pin_type
, int dac_idx
)
12387 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
12389 snd_hda_codec_write(codec
, dac_idx
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12393 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
12395 struct alc_spec
*spec
= codec
->spec
;
12398 alc_subsystem_id(codec
, 0x0e, 0x0f, 0x0b);
12399 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
12400 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
12401 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
12403 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
12404 spec
->multiout
.dac_nids
[i
]);
12408 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
12410 struct alc_spec
*spec
= codec
->spec
;
12413 pin
= spec
->autocfg
.hp_pins
[0];
12414 if (pin
) /* connect to front */
12415 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
12416 spec
->multiout
.dac_nids
[0]);
12417 pin
= spec
->autocfg
.speaker_pins
[0];
12419 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
12422 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
12424 struct alc_spec
*spec
= codec
->spec
;
12427 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12428 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
12429 if (nid
>= 0x0c && nid
<= 0x11) {
12430 snd_hda_codec_write(codec
, nid
, 0,
12431 AC_VERB_SET_PIN_WIDGET_CONTROL
,
12432 i
<= AUTO_PIN_FRONT_MIC
?
12433 PIN_VREF80
: PIN_IN
);
12438 /* parse the BIOS configuration and set up the alc_spec */
12439 /* return 1 if successful, 0 if the proper config is not found,
12440 * or a negative error code
12442 static int alc861_parse_auto_config(struct hda_codec
*codec
)
12444 struct alc_spec
*spec
= codec
->spec
;
12446 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
12448 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12452 if (!spec
->autocfg
.line_outs
)
12453 return 0; /* can't find valid BIOS pin config */
12455 err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
);
12458 err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12461 err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pins
[0]);
12464 err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
12468 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12470 if (spec
->autocfg
.dig_out_pin
)
12471 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
12473 if (spec
->kctl_alloc
)
12474 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
12476 spec
->init_verbs
[spec
->num_init_verbs
++] = alc861_auto_init_verbs
;
12478 spec
->num_mux_defs
= 1;
12479 spec
->input_mux
= &spec
->private_imux
;
12481 spec
->adc_nids
= alc861_adc_nids
;
12482 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
12483 spec
->mixers
[spec
->num_mixers
] = alc861_capture_mixer
;
12484 spec
->num_mixers
++;
12489 /* additional initialization for auto-configuration model */
12490 static void alc861_auto_init(struct hda_codec
*codec
)
12492 struct alc_spec
*spec
= codec
->spec
;
12493 alc861_auto_init_multi_out(codec
);
12494 alc861_auto_init_hp_out(codec
);
12495 alc861_auto_init_analog_input(codec
);
12496 if (spec
->unsol_event
)
12497 alc_sku_automute(codec
);
12500 #ifdef CONFIG_SND_HDA_POWER_SAVE
12501 static struct hda_amp_list alc861_loopbacks
[] = {
12502 { 0x15, HDA_INPUT
, 0 },
12503 { 0x15, HDA_INPUT
, 1 },
12504 { 0x15, HDA_INPUT
, 2 },
12505 { 0x15, HDA_INPUT
, 3 },
12512 * configuration and preset
12514 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
12515 [ALC861_3ST
] = "3stack",
12516 [ALC660_3ST
] = "3stack-660",
12517 [ALC861_3ST_DIG
] = "3stack-dig",
12518 [ALC861_6ST_DIG
] = "6stack-dig",
12519 [ALC861_UNIWILL_M31
] = "uniwill-m31",
12520 [ALC861_TOSHIBA
] = "toshiba",
12521 [ALC861_ASUS
] = "asus",
12522 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
12523 [ALC861_AUTO
] = "auto",
12526 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
12527 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
12528 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
12529 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
12530 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
12531 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
12532 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
12533 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
12534 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
12535 * Any other models that need this preset?
12537 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
12538 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
12539 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
12540 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
12541 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
12542 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
12543 /* FIXME: the below seems conflict */
12544 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
12545 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
12546 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
12550 static struct alc_config_preset alc861_presets
[] = {
12552 .mixers
= { alc861_3ST_mixer
},
12553 .init_verbs
= { alc861_threestack_init_verbs
},
12554 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12555 .dac_nids
= alc861_dac_nids
,
12556 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
12557 .channel_mode
= alc861_threestack_modes
,
12559 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12560 .adc_nids
= alc861_adc_nids
,
12561 .input_mux
= &alc861_capture_source
,
12563 [ALC861_3ST_DIG
] = {
12564 .mixers
= { alc861_base_mixer
},
12565 .init_verbs
= { alc861_threestack_init_verbs
},
12566 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12567 .dac_nids
= alc861_dac_nids
,
12568 .dig_out_nid
= ALC861_DIGOUT_NID
,
12569 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
12570 .channel_mode
= alc861_threestack_modes
,
12572 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12573 .adc_nids
= alc861_adc_nids
,
12574 .input_mux
= &alc861_capture_source
,
12576 [ALC861_6ST_DIG
] = {
12577 .mixers
= { alc861_base_mixer
},
12578 .init_verbs
= { alc861_base_init_verbs
},
12579 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12580 .dac_nids
= alc861_dac_nids
,
12581 .dig_out_nid
= ALC861_DIGOUT_NID
,
12582 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
12583 .channel_mode
= alc861_8ch_modes
,
12584 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12585 .adc_nids
= alc861_adc_nids
,
12586 .input_mux
= &alc861_capture_source
,
12589 .mixers
= { alc861_3ST_mixer
},
12590 .init_verbs
= { alc861_threestack_init_verbs
},
12591 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
12592 .dac_nids
= alc660_dac_nids
,
12593 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
12594 .channel_mode
= alc861_threestack_modes
,
12596 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12597 .adc_nids
= alc861_adc_nids
,
12598 .input_mux
= &alc861_capture_source
,
12600 [ALC861_UNIWILL_M31
] = {
12601 .mixers
= { alc861_uniwill_m31_mixer
},
12602 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
12603 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12604 .dac_nids
= alc861_dac_nids
,
12605 .dig_out_nid
= ALC861_DIGOUT_NID
,
12606 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
12607 .channel_mode
= alc861_uniwill_m31_modes
,
12609 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12610 .adc_nids
= alc861_adc_nids
,
12611 .input_mux
= &alc861_capture_source
,
12613 [ALC861_TOSHIBA
] = {
12614 .mixers
= { alc861_toshiba_mixer
},
12615 .init_verbs
= { alc861_base_init_verbs
,
12616 alc861_toshiba_init_verbs
},
12617 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12618 .dac_nids
= alc861_dac_nids
,
12619 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
12620 .channel_mode
= alc883_3ST_2ch_modes
,
12621 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12622 .adc_nids
= alc861_adc_nids
,
12623 .input_mux
= &alc861_capture_source
,
12624 .unsol_event
= alc861_toshiba_unsol_event
,
12625 .init_hook
= alc861_toshiba_automute
,
12628 .mixers
= { alc861_asus_mixer
},
12629 .init_verbs
= { alc861_asus_init_verbs
},
12630 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12631 .dac_nids
= alc861_dac_nids
,
12632 .dig_out_nid
= ALC861_DIGOUT_NID
,
12633 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
12634 .channel_mode
= alc861_asus_modes
,
12637 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12638 .adc_nids
= alc861_adc_nids
,
12639 .input_mux
= &alc861_capture_source
,
12641 [ALC861_ASUS_LAPTOP
] = {
12642 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
12643 .init_verbs
= { alc861_asus_init_verbs
,
12644 alc861_asus_laptop_init_verbs
},
12645 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12646 .dac_nids
= alc861_dac_nids
,
12647 .dig_out_nid
= ALC861_DIGOUT_NID
,
12648 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
12649 .channel_mode
= alc883_3ST_2ch_modes
,
12651 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12652 .adc_nids
= alc861_adc_nids
,
12653 .input_mux
= &alc861_capture_source
,
12658 static int patch_alc861(struct hda_codec
*codec
)
12660 struct alc_spec
*spec
;
12664 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
12668 codec
->spec
= spec
;
12670 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
12674 if (board_config
< 0) {
12675 printk(KERN_INFO
"hda_codec: Unknown model for ALC861, "
12676 "trying auto-probe from BIOS...\n");
12677 board_config
= ALC861_AUTO
;
12680 if (board_config
== ALC861_AUTO
) {
12681 /* automatic parse from the BIOS config */
12682 err
= alc861_parse_auto_config(codec
);
12688 "hda_codec: Cannot set up configuration "
12689 "from BIOS. Using base mode...\n");
12690 board_config
= ALC861_3ST_DIG
;
12694 if (board_config
!= ALC861_AUTO
)
12695 setup_preset(spec
, &alc861_presets
[board_config
]);
12697 spec
->stream_name_analog
= "ALC861 Analog";
12698 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
12699 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
12701 spec
->stream_name_digital
= "ALC861 Digital";
12702 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
12703 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
12705 spec
->vmaster_nid
= 0x03;
12707 codec
->patch_ops
= alc_patch_ops
;
12708 if (board_config
== ALC861_AUTO
)
12709 spec
->init_hook
= alc861_auto_init
;
12710 #ifdef CONFIG_SND_HDA_POWER_SAVE
12711 if (!spec
->loopback
.amplist
)
12712 spec
->loopback
.amplist
= alc861_loopbacks
;
12719 * ALC861-VD support
12723 * In addition, an independent DAC
12725 #define ALC861VD_DIGOUT_NID 0x06
12727 static hda_nid_t alc861vd_dac_nids
[4] = {
12728 /* front, surr, clfe, side surr */
12729 0x02, 0x03, 0x04, 0x05
12732 /* dac_nids for ALC660vd are in a different order - according to
12733 * Realtek's driver.
12734 * This should probably tesult in a different mixer for 6stack models
12735 * of ALC660vd codecs, but for now there is only 3stack mixer
12736 * - and it is the same as in 861vd.
12737 * adc_nids in ALC660vd are (is) the same as in 861vd
12739 static hda_nid_t alc660vd_dac_nids
[3] = {
12740 /* front, rear, clfe, rear_surr */
12744 static hda_nid_t alc861vd_adc_nids
[1] = {
12749 static hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
12752 /* FIXME: should be a matrix-type input source selection */
12753 static struct hda_input_mux alc861vd_capture_source
= {
12757 { "Front Mic", 0x1 },
12763 static struct hda_input_mux alc861vd_dallas_capture_source
= {
12766 { "Ext Mic", 0x0 },
12767 { "Int Mic", 0x1 },
12771 static struct hda_input_mux alc861vd_hp_capture_source
= {
12774 { "Front Mic", 0x0 },
12775 { "ATAPI Mic", 0x1 },
12779 #define alc861vd_mux_enum_info alc_mux_enum_info
12780 #define alc861vd_mux_enum_get alc_mux_enum_get
12781 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12782 #define alc861vd_mux_enum_put alc882_mux_enum_put
12787 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
12794 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
12795 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12796 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12797 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12798 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12805 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
12806 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12807 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12808 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12809 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12813 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
12814 { 6, alc861vd_6stack_ch6_init
},
12815 { 8, alc861vd_6stack_ch8_init
},
12818 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
12820 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12821 .name
= "Channel Mode",
12822 .info
= alc_ch_mode_info
,
12823 .get
= alc_ch_mode_get
,
12824 .put
= alc_ch_mode_put
,
12829 static struct snd_kcontrol_new alc861vd_capture_mixer
[] = {
12830 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
12831 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
12834 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12835 /* The multiple "Capture Source" controls confuse alsamixer
12836 * So call somewhat different..
12838 /* .name = "Capture Source", */
12839 .name
= "Input Source",
12841 .info
= alc861vd_mux_enum_info
,
12842 .get
= alc861vd_mux_enum_get
,
12843 .put
= alc861vd_mux_enum_put
,
12848 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12849 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12851 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
12852 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12853 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12855 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12856 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
12858 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12860 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12862 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
12863 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
12865 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
12866 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
12868 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
12870 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12871 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12872 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12874 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12875 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12876 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12878 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
12879 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
12881 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12882 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12884 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
12885 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
12890 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
12891 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12892 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12894 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
12896 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12898 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12900 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12901 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12902 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12904 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
12905 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
12907 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12908 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12910 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
12911 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
12916 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
12917 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12918 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12919 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12921 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
12923 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12924 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12925 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12927 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12928 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12929 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12931 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12932 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12937 /* Pin assignment: Speaker=0x14, HP = 0x15,
12938 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12940 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
12941 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12942 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
12943 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12944 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
12945 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
12946 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12947 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12948 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
12949 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12950 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12951 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT
),
12952 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT
),
12956 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12957 * Front Mic=0x18, ATAPI Mic = 0x19,
12959 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
12960 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12961 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12962 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12963 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
12964 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12965 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12966 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12967 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12973 * generic initialization of ADC, input mixers and output mixers
12975 static struct hda_verb alc861vd_volume_init_verbs
[] = {
12977 * Unmute ADC0 and set the default input to mic-in
12979 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12980 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12982 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12983 * the analog-loopback mixer widget
12985 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12986 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12987 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12989 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12990 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12992 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12993 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12994 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12995 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12996 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
12999 * Set up output mixers (0x02 - 0x05)
13001 /* set vol=0 to output mixers */
13002 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13003 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13004 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13005 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13007 /* set up input amps for analog loopback */
13008 /* Amp Indices: DAC = 0, mixer = 1 */
13009 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13010 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13011 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13012 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13013 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13014 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13015 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13016 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13022 * 3-stack pin configuration:
13023 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
13025 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
13027 * Set pin mode and muting
13029 /* set front pin widgets 0x14 for output */
13030 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13031 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13032 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
13034 /* Mic (rear) pin: input vref at 80% */
13035 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13036 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13037 /* Front Mic pin: input vref at 80% */
13038 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13039 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13040 /* Line In pin: input */
13041 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13042 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13043 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13044 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13045 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13046 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
13047 /* CD pin widget for input */
13048 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13054 * 6-stack pin configuration:
13056 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
13058 * Set pin mode and muting
13060 /* set front pin widgets 0x14 for output */
13061 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13062 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13063 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
13065 /* Rear Pin: output 1 (0x0d) */
13066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13068 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
13069 /* CLFE Pin: output 2 (0x0e) */
13070 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13071 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13072 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
13073 /* Side Pin: output 3 (0x0f) */
13074 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13075 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13076 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
13078 /* Mic (rear) pin: input vref at 80% */
13079 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13080 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13081 /* Front Mic pin: input vref at 80% */
13082 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13083 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13084 /* Line In pin: input */
13085 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13086 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13087 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13088 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13089 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13090 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
13091 /* CD pin widget for input */
13092 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13097 static struct hda_verb alc861vd_eapd_verbs
[] = {
13098 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13102 static struct hda_verb alc660vd_eapd_verbs
[] = {
13103 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13104 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13108 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
13109 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13110 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
13112 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13113 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13117 /* toggle speaker-output according to the hp-jack state */
13118 static void alc861vd_lenovo_hp_automute(struct hda_codec
*codec
)
13120 unsigned int present
;
13121 unsigned char bits
;
13123 present
= snd_hda_codec_read(codec
, 0x1b, 0,
13124 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13125 bits
= present
? HDA_AMP_MUTE
: 0;
13126 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
13127 HDA_AMP_MUTE
, bits
);
13130 static void alc861vd_lenovo_mic_automute(struct hda_codec
*codec
)
13132 unsigned int present
;
13133 unsigned char bits
;
13135 present
= snd_hda_codec_read(codec
, 0x18, 0,
13136 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13137 bits
= present
? HDA_AMP_MUTE
: 0;
13138 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
13139 HDA_AMP_MUTE
, bits
);
13142 static void alc861vd_lenovo_automute(struct hda_codec
*codec
)
13144 alc861vd_lenovo_hp_automute(codec
);
13145 alc861vd_lenovo_mic_automute(codec
);
13148 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
13151 switch (res
>> 26) {
13152 case ALC880_HP_EVENT
:
13153 alc861vd_lenovo_hp_automute(codec
);
13155 case ALC880_MIC_EVENT
:
13156 alc861vd_lenovo_mic_automute(codec
);
13161 static struct hda_verb alc861vd_dallas_verbs
[] = {
13162 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13163 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13164 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13165 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13167 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13168 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13169 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13170 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13172 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13173 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13174 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13177 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13178 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13180 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13181 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13182 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13183 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13185 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
13186 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13187 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
13188 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13189 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13190 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13191 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13192 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13194 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13195 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13196 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
13199 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13200 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
13201 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13206 /* toggle speaker-output according to the hp-jack state */
13207 static void alc861vd_dallas_automute(struct hda_codec
*codec
)
13209 unsigned int present
;
13211 present
= snd_hda_codec_read(codec
, 0x15, 0,
13212 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13213 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
13214 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
13217 static void alc861vd_dallas_unsol_event(struct hda_codec
*codec
, unsigned int res
)
13219 if ((res
>> 26) == ALC880_HP_EVENT
)
13220 alc861vd_dallas_automute(codec
);
13223 #ifdef CONFIG_SND_HDA_POWER_SAVE
13224 #define alc861vd_loopbacks alc880_loopbacks
13227 /* pcm configuration: identiacal with ALC880 */
13228 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
13229 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
13230 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
13231 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
13234 * configuration and preset
13236 static const char *alc861vd_models
[ALC861VD_MODEL_LAST
] = {
13237 [ALC660VD_3ST
] = "3stack-660",
13238 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
13239 [ALC861VD_3ST
] = "3stack",
13240 [ALC861VD_3ST_DIG
] = "3stack-digout",
13241 [ALC861VD_6ST_DIG
] = "6stack-digout",
13242 [ALC861VD_LENOVO
] = "lenovo",
13243 [ALC861VD_DALLAS
] = "dallas",
13244 [ALC861VD_HP
] = "hp",
13245 [ALC861VD_AUTO
] = "auto",
13248 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
13249 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
13250 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
13251 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
13252 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST
),
13253 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC861VD_LENOVO
),
13254 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
13255 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
13256 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
13257 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
13258 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS
),
13259 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
13260 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
13261 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
13262 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO
),
13263 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO
),
13264 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO
),
13265 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
13269 static struct alc_config_preset alc861vd_presets
[] = {
13271 .mixers
= { alc861vd_3st_mixer
},
13272 .init_verbs
= { alc861vd_volume_init_verbs
,
13273 alc861vd_3stack_init_verbs
},
13274 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
13275 .dac_nids
= alc660vd_dac_nids
,
13276 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13277 .channel_mode
= alc861vd_3stack_2ch_modes
,
13278 .input_mux
= &alc861vd_capture_source
,
13280 [ALC660VD_3ST_DIG
] = {
13281 .mixers
= { alc861vd_3st_mixer
},
13282 .init_verbs
= { alc861vd_volume_init_verbs
,
13283 alc861vd_3stack_init_verbs
},
13284 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
13285 .dac_nids
= alc660vd_dac_nids
,
13286 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
13287 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13288 .channel_mode
= alc861vd_3stack_2ch_modes
,
13289 .input_mux
= &alc861vd_capture_source
,
13292 .mixers
= { alc861vd_3st_mixer
},
13293 .init_verbs
= { alc861vd_volume_init_verbs
,
13294 alc861vd_3stack_init_verbs
},
13295 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13296 .dac_nids
= alc861vd_dac_nids
,
13297 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13298 .channel_mode
= alc861vd_3stack_2ch_modes
,
13299 .input_mux
= &alc861vd_capture_source
,
13301 [ALC861VD_3ST_DIG
] = {
13302 .mixers
= { alc861vd_3st_mixer
},
13303 .init_verbs
= { alc861vd_volume_init_verbs
,
13304 alc861vd_3stack_init_verbs
},
13305 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13306 .dac_nids
= alc861vd_dac_nids
,
13307 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
13308 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13309 .channel_mode
= alc861vd_3stack_2ch_modes
,
13310 .input_mux
= &alc861vd_capture_source
,
13312 [ALC861VD_6ST_DIG
] = {
13313 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
13314 .init_verbs
= { alc861vd_volume_init_verbs
,
13315 alc861vd_6stack_init_verbs
},
13316 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13317 .dac_nids
= alc861vd_dac_nids
,
13318 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
13319 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
13320 .channel_mode
= alc861vd_6stack_modes
,
13321 .input_mux
= &alc861vd_capture_source
,
13323 [ALC861VD_LENOVO
] = {
13324 .mixers
= { alc861vd_lenovo_mixer
},
13325 .init_verbs
= { alc861vd_volume_init_verbs
,
13326 alc861vd_3stack_init_verbs
,
13327 alc861vd_eapd_verbs
,
13328 alc861vd_lenovo_unsol_verbs
},
13329 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
13330 .dac_nids
= alc660vd_dac_nids
,
13331 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13332 .channel_mode
= alc861vd_3stack_2ch_modes
,
13333 .input_mux
= &alc861vd_capture_source
,
13334 .unsol_event
= alc861vd_lenovo_unsol_event
,
13335 .init_hook
= alc861vd_lenovo_automute
,
13337 [ALC861VD_DALLAS
] = {
13338 .mixers
= { alc861vd_dallas_mixer
},
13339 .init_verbs
= { alc861vd_dallas_verbs
},
13340 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13341 .dac_nids
= alc861vd_dac_nids
,
13342 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13343 .channel_mode
= alc861vd_3stack_2ch_modes
,
13344 .input_mux
= &alc861vd_dallas_capture_source
,
13345 .unsol_event
= alc861vd_dallas_unsol_event
,
13346 .init_hook
= alc861vd_dallas_automute
,
13349 .mixers
= { alc861vd_hp_mixer
},
13350 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
13351 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13352 .dac_nids
= alc861vd_dac_nids
,
13353 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
13354 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13355 .channel_mode
= alc861vd_3stack_2ch_modes
,
13356 .input_mux
= &alc861vd_hp_capture_source
,
13357 .unsol_event
= alc861vd_dallas_unsol_event
,
13358 .init_hook
= alc861vd_dallas_automute
,
13363 * BIOS auto configuration
13365 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
13366 hda_nid_t nid
, int pin_type
, int dac_idx
)
13368 alc_set_pin_output(codec
, nid
, pin_type
);
13371 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
13373 struct alc_spec
*spec
= codec
->spec
;
13376 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
13377 for (i
= 0; i
<= HDA_SIDE
; i
++) {
13378 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
13379 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
13381 alc861vd_auto_set_output_and_unmute(codec
, nid
,
13387 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
13389 struct alc_spec
*spec
= codec
->spec
;
13392 pin
= spec
->autocfg
.hp_pins
[0];
13393 if (pin
) /* connect to front and use dac 0 */
13394 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
13395 pin
= spec
->autocfg
.speaker_pins
[0];
13397 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
13400 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
13401 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
13403 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
13405 struct alc_spec
*spec
= codec
->spec
;
13408 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
13409 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
13410 if (alc861vd_is_input_pin(nid
)) {
13411 snd_hda_codec_write(codec
, nid
, 0,
13412 AC_VERB_SET_PIN_WIDGET_CONTROL
,
13413 i
<= AUTO_PIN_FRONT_MIC
?
13414 PIN_VREF80
: PIN_IN
);
13415 if (nid
!= ALC861VD_PIN_CD_NID
)
13416 snd_hda_codec_write(codec
, nid
, 0,
13417 AC_VERB_SET_AMP_GAIN_MUTE
,
13423 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
13425 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
13426 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
13428 /* add playback controls from the parsed DAC table */
13429 /* Based on ALC880 version. But ALC861VD has separate,
13430 * different NIDs for mute/unmute switch and volume control */
13431 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13432 const struct auto_pin_cfg
*cfg
)
13435 static const char *chname
[4] = {"Front", "Surround", "CLFE", "Side"};
13436 hda_nid_t nid_v
, nid_s
;
13439 for (i
= 0; i
< cfg
->line_outs
; i
++) {
13440 if (!spec
->multiout
.dac_nids
[i
])
13442 nid_v
= alc861vd_idx_to_mixer_vol(
13444 spec
->multiout
.dac_nids
[i
]));
13445 nid_s
= alc861vd_idx_to_mixer_switch(
13447 spec
->multiout
.dac_nids
[i
]));
13451 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13452 "Center Playback Volume",
13453 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
13457 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13458 "LFE Playback Volume",
13459 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
13463 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
13464 "Center Playback Switch",
13465 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
13469 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
13470 "LFE Playback Switch",
13471 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
13476 sprintf(name
, "%s Playback Volume", chname
[i
]);
13477 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
13478 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
13482 sprintf(name
, "%s Playback Switch", chname
[i
]);
13483 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
13484 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
13493 /* add playback controls for speaker and HP outputs */
13494 /* Based on ALC880 version. But ALC861VD has separate,
13495 * different NIDs for mute/unmute switch and volume control */
13496 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
13497 hda_nid_t pin
, const char *pfx
)
13499 hda_nid_t nid_v
, nid_s
;
13506 if (alc880_is_fixed_pin(pin
)) {
13507 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
13508 /* specify the DAC as the extra output */
13509 if (!spec
->multiout
.hp_nid
)
13510 spec
->multiout
.hp_nid
= nid_v
;
13512 spec
->multiout
.extra_out_nid
[0] = nid_v
;
13513 /* control HP volume/switch on the output mixer amp */
13514 nid_v
= alc861vd_idx_to_mixer_vol(
13515 alc880_fixed_pin_idx(pin
));
13516 nid_s
= alc861vd_idx_to_mixer_switch(
13517 alc880_fixed_pin_idx(pin
));
13519 sprintf(name
, "%s Playback Volume", pfx
);
13520 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
13521 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
13524 sprintf(name
, "%s Playback Switch", pfx
);
13525 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
13526 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
13529 } else if (alc880_is_multi_pin(pin
)) {
13530 /* set manual connection */
13531 /* we have only a switch on HP-out PIN */
13532 sprintf(name
, "%s Playback Switch", pfx
);
13533 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
13534 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
13541 /* parse the BIOS configuration and set up the alc_spec
13542 * return 1 if successful, 0 if the proper config is not found,
13543 * or a negative error code
13544 * Based on ALC880 version - had to change it to override
13545 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
13546 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
13548 struct alc_spec
*spec
= codec
->spec
;
13550 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
13552 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13556 if (!spec
->autocfg
.line_outs
)
13557 return 0; /* can't find valid BIOS pin config */
13559 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
13562 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13565 err
= alc861vd_auto_create_extra_out(spec
,
13566 spec
->autocfg
.speaker_pins
[0],
13570 err
= alc861vd_auto_create_extra_out(spec
,
13571 spec
->autocfg
.hp_pins
[0],
13575 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
13579 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
13581 if (spec
->autocfg
.dig_out_pin
)
13582 spec
->multiout
.dig_out_nid
= ALC861VD_DIGOUT_NID
;
13584 if (spec
->kctl_alloc
)
13585 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
13587 spec
->init_verbs
[spec
->num_init_verbs
++]
13588 = alc861vd_volume_init_verbs
;
13590 spec
->num_mux_defs
= 1;
13591 spec
->input_mux
= &spec
->private_imux
;
13593 err
= alc_auto_add_mic_boost(codec
);
13600 /* additional initialization for auto-configuration model */
13601 static void alc861vd_auto_init(struct hda_codec
*codec
)
13603 struct alc_spec
*spec
= codec
->spec
;
13604 alc861vd_auto_init_multi_out(codec
);
13605 alc861vd_auto_init_hp_out(codec
);
13606 alc861vd_auto_init_analog_input(codec
);
13607 alc861vd_auto_init_input_src(codec
);
13608 if (spec
->unsol_event
)
13609 alc_sku_automute(codec
);
13612 static int patch_alc861vd(struct hda_codec
*codec
)
13614 struct alc_spec
*spec
;
13615 int err
, board_config
;
13617 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13621 codec
->spec
= spec
;
13623 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
13627 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
13628 printk(KERN_INFO
"hda_codec: Unknown model for ALC660VD/"
13629 "ALC861VD, trying auto-probe from BIOS...\n");
13630 board_config
= ALC861VD_AUTO
;
13633 if (board_config
== ALC861VD_AUTO
) {
13634 /* automatic parse from the BIOS config */
13635 err
= alc861vd_parse_auto_config(codec
);
13641 "hda_codec: Cannot set up configuration "
13642 "from BIOS. Using base mode...\n");
13643 board_config
= ALC861VD_3ST
;
13647 if (board_config
!= ALC861VD_AUTO
)
13648 setup_preset(spec
, &alc861vd_presets
[board_config
]);
13650 if (codec
->vendor_id
== 0x10ec0660) {
13651 spec
->stream_name_analog
= "ALC660-VD Analog";
13652 spec
->stream_name_digital
= "ALC660-VD Digital";
13653 /* always turn on EAPD */
13654 spec
->init_verbs
[spec
->num_init_verbs
++] = alc660vd_eapd_verbs
;
13656 spec
->stream_name_analog
= "ALC861VD Analog";
13657 spec
->stream_name_digital
= "ALC861VD Digital";
13660 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
13661 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
13663 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
13664 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
13666 spec
->adc_nids
= alc861vd_adc_nids
;
13667 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
13668 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
13670 spec
->mixers
[spec
->num_mixers
] = alc861vd_capture_mixer
;
13671 spec
->num_mixers
++;
13673 spec
->vmaster_nid
= 0x02;
13675 codec
->patch_ops
= alc_patch_ops
;
13677 if (board_config
== ALC861VD_AUTO
)
13678 spec
->init_hook
= alc861vd_auto_init
;
13679 #ifdef CONFIG_SND_HDA_POWER_SAVE
13680 if (!spec
->loopback
.amplist
)
13681 spec
->loopback
.amplist
= alc861vd_loopbacks
;
13690 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
13691 * configuration. Each pin widget can choose any input DACs and a mixer.
13692 * Each ADC is connected from a mixer of all inputs. This makes possible
13693 * 6-channel independent captures.
13695 * In addition, an independent DAC for the multi-playback (not used in this
13698 #define ALC662_DIGOUT_NID 0x06
13699 #define ALC662_DIGIN_NID 0x0a
13701 static hda_nid_t alc662_dac_nids
[4] = {
13702 /* front, rear, clfe, rear_surr */
13706 static hda_nid_t alc662_adc_nids
[1] = {
13711 static hda_nid_t alc662_capsrc_nids
[1] = { 0x22 };
13714 /* FIXME: should be a matrix-type input source selection */
13715 static struct hda_input_mux alc662_capture_source
= {
13719 { "Front Mic", 0x1 },
13725 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
13733 static struct hda_input_mux alc662_eeepc_capture_source
= {
13741 static struct hda_input_mux alc663_capture_source
= {
13745 { "Front Mic", 0x1 },
13750 static struct hda_input_mux alc663_m51va_capture_source
= {
13753 { "Ext-Mic", 0x0 },
13758 #define alc662_mux_enum_info alc_mux_enum_info
13759 #define alc662_mux_enum_get alc_mux_enum_get
13760 #define alc662_mux_enum_put alc882_mux_enum_put
13765 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
13772 static struct hda_verb alc662_3ST_ch2_init
[] = {
13773 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13774 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13775 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13776 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13783 static struct hda_verb alc662_3ST_ch6_init
[] = {
13784 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13785 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13786 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
13787 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13788 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13789 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
13793 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
13794 { 2, alc662_3ST_ch2_init
},
13795 { 6, alc662_3ST_ch6_init
},
13801 static struct hda_verb alc662_sixstack_ch6_init
[] = {
13802 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13803 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13804 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13811 static struct hda_verb alc662_sixstack_ch8_init
[] = {
13812 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13813 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13814 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13818 static struct hda_channel_mode alc662_5stack_modes
[2] = {
13819 { 2, alc662_sixstack_ch6_init
},
13820 { 6, alc662_sixstack_ch8_init
},
13823 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13824 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13827 static struct snd_kcontrol_new alc662_base_mixer
[] = {
13828 /* output mixer control */
13829 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13830 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
13831 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13832 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
13833 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
13834 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
13835 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
13836 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
13837 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13839 /*Input mixer control */
13840 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
13841 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
13842 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
13843 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
13844 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
13845 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
13846 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
13847 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
13851 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
13852 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13853 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
13854 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13855 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13856 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13857 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13858 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13861 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13862 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13863 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
13864 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
13868 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
13869 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13870 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
13871 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13872 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
13873 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
13874 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
13875 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
13876 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
13877 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13878 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13879 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13880 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13881 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13882 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13883 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13884 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13885 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13886 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
13887 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
13891 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
13892 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13893 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
13894 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13895 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
13896 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13897 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13898 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13899 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13900 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13904 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
13905 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13907 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13908 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13910 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT
),
13911 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13912 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13914 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
13915 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13916 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13920 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
13921 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13922 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13923 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13924 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT
),
13925 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
13926 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
13927 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT
),
13928 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT
),
13929 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13930 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
13931 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13932 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13933 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13934 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13938 static struct snd_kcontrol_new alc663_m51va_mixer
[] = {
13939 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13940 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13941 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
13942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13943 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13944 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT
),
13948 static struct snd_kcontrol_new alc663_g71v_mixer
[] = {
13949 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13950 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13951 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13952 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13953 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
13955 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13956 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13957 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13958 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13962 static struct snd_kcontrol_new alc663_g50v_mixer
[] = {
13963 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13964 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13965 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
13967 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13968 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13969 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13970 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13971 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13972 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13976 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
13978 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13979 .name
= "Channel Mode",
13980 .info
= alc_ch_mode_info
,
13981 .get
= alc_ch_mode_get
,
13982 .put
= alc_ch_mode_put
,
13987 static struct hda_verb alc662_init_verbs
[] = {
13988 /* ADC: mute amp left and right */
13989 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13990 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
13991 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13993 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13994 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13995 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13996 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13997 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
13999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14000 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14001 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14002 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14003 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14004 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14006 /* Front Pin: output 0 (0x0c) */
14007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14008 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14010 /* Rear Pin: output 1 (0x0d) */
14011 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14012 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14014 /* CLFE Pin: output 2 (0x0e) */
14015 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14016 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14018 /* Mic (rear) pin: input vref at 80% */
14019 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14020 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14021 /* Front Mic pin: input vref at 80% */
14022 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
14023 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14024 /* Line In pin: input */
14025 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14026 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
14027 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14028 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14029 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14030 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
14031 /* CD pin widget for input */
14032 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
14034 /* FIXME: use matrix-type input source selection */
14035 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
14042 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14043 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14044 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
14045 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
14047 /* always trun on EAPD */
14048 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14049 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
14054 static struct hda_verb alc662_sue_init_verbs
[] = {
14055 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
14056 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
14060 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
14061 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14062 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14066 /* Set Unsolicited Event*/
14067 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
14068 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
14069 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14074 * generic initialization of ADC, input mixers and output mixers
14076 static struct hda_verb alc662_auto_init_verbs
[] = {
14078 * Unmute ADC and set the default input to mic-in
14080 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
14081 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14083 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
14085 * Note: PASD motherboards uses the Line In 2 as the input for front
14086 * panel mic (mic 2)
14088 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14089 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
14090 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
14091 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
14092 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
14093 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
14096 * Set up output mixers (0x0c - 0x0f)
14098 /* set vol=0 to output mixers */
14099 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14100 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14101 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
14103 /* set up input amps for analog loopback */
14104 /* Amp Indices: DAC = 0, mixer = 1 */
14105 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14106 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14107 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14108 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14109 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14110 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14113 /* FIXME: use matrix-type input source selection */
14114 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
14116 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14117 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14121 /* additional verbs for ALC663 */
14122 static struct hda_verb alc663_auto_init_verbs
[] = {
14123 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
14124 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
14128 static struct hda_verb alc663_m51va_init_verbs
[] = {
14129 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14130 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14131 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
14133 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
14135 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14136 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14140 static struct hda_verb alc663_g71v_init_verbs
[] = {
14141 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14142 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
14143 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
14145 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14146 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14147 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
14149 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
14150 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_MIC_EVENT
},
14151 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
14155 static struct hda_verb alc663_g50v_init_verbs
[] = {
14156 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
14157 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
14158 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
14160 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
14161 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
14165 /* capture mixer elements */
14166 static struct snd_kcontrol_new alc662_capture_mixer
[] = {
14167 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
14168 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
14170 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
14171 /* The multiple "Capture Source" controls confuse alsamixer
14172 * So call somewhat different..
14174 /* .name = "Capture Source", */
14175 .name
= "Input Source",
14177 .info
= alc662_mux_enum_info
,
14178 .get
= alc662_mux_enum_get
,
14179 .put
= alc662_mux_enum_put
,
14184 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
14186 unsigned int present
;
14187 unsigned char bits
;
14189 present
= snd_hda_codec_read(codec
, 0x14, 0,
14190 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
14191 bits
= present
? HDA_AMP_MUTE
: 0;
14192 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
14193 HDA_AMP_MUTE
, bits
);
14196 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
14198 unsigned int present
;
14199 unsigned char bits
;
14201 present
= snd_hda_codec_read(codec
, 0x1b, 0,
14202 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
14203 bits
= present
? HDA_AMP_MUTE
: 0;
14204 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
14205 HDA_AMP_MUTE
, bits
);
14206 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14207 HDA_AMP_MUTE
, bits
);
14210 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
14213 if ((res
>> 26) == ALC880_HP_EVENT
)
14214 alc662_lenovo_101e_all_automute(codec
);
14215 if ((res
>> 26) == ALC880_FRONT_EVENT
)
14216 alc662_lenovo_101e_ispeaker_automute(codec
);
14219 static void alc662_eeepc_mic_automute(struct hda_codec
*codec
)
14221 unsigned int present
;
14223 present
= snd_hda_codec_read(codec
, 0x18, 0,
14224 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
14225 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14226 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
14227 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14228 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
14229 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14230 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
14231 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14232 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
14235 /* unsolicited event for HP jack sensing */
14236 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
14239 if ((res
>> 26) == ALC880_HP_EVENT
)
14240 alc262_hippo1_automute( codec
);
14242 if ((res
>> 26) == ALC880_MIC_EVENT
)
14243 alc662_eeepc_mic_automute(codec
);
14246 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
14248 alc262_hippo1_automute( codec
);
14249 alc662_eeepc_mic_automute(codec
);
14252 static void alc662_eeepc_ep20_automute(struct hda_codec
*codec
)
14255 unsigned int present
;
14257 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
14258 present
= snd_hda_codec_read(codec
, 0x14, 0,
14259 AC_VERB_GET_PIN_SENSE
, 0);
14260 present
= (present
& 0x80000000) != 0;
14262 /* mute internal speaker */
14263 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
14264 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
14266 /* unmute internal speaker if necessary */
14267 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
14268 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
14269 HDA_AMP_MUTE
, mute
);
14273 /* unsolicited event for HP jack sensing */
14274 static void alc662_eeepc_ep20_unsol_event(struct hda_codec
*codec
,
14277 if ((res
>> 26) == ALC880_HP_EVENT
)
14278 alc662_eeepc_ep20_automute(codec
);
14281 static void alc662_eeepc_ep20_inithook(struct hda_codec
*codec
)
14283 alc662_eeepc_ep20_automute(codec
);
14286 static void alc663_m51va_speaker_automute(struct hda_codec
*codec
)
14288 unsigned int present
;
14289 unsigned char bits
;
14291 present
= snd_hda_codec_read(codec
, 0x21, 0,
14292 AC_VERB_GET_PIN_SENSE
, 0)
14293 & AC_PINSENSE_PRESENCE
;
14294 bits
= present
? HDA_AMP_MUTE
: 0;
14295 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14296 HDA_AMP_MUTE
, bits
);
14299 static void alc663_m51va_mic_automute(struct hda_codec
*codec
)
14301 unsigned int present
;
14303 present
= snd_hda_codec_read(codec
, 0x18, 0,
14304 AC_VERB_GET_PIN_SENSE
, 0)
14305 & AC_PINSENSE_PRESENCE
;
14306 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14307 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
14308 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14309 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
14310 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14311 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
14312 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14313 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
14316 static void alc663_m51va_unsol_event(struct hda_codec
*codec
,
14319 switch (res
>> 26) {
14320 case ALC880_HP_EVENT
:
14321 alc663_m51va_speaker_automute(codec
);
14323 case ALC880_MIC_EVENT
:
14324 alc663_m51va_mic_automute(codec
);
14329 static void alc663_m51va_inithook(struct hda_codec
*codec
)
14331 alc663_m51va_speaker_automute(codec
);
14332 alc663_m51va_mic_automute(codec
);
14335 static void alc663_g71v_hp_automute(struct hda_codec
*codec
)
14337 unsigned int present
;
14338 unsigned char bits
;
14340 present
= snd_hda_codec_read(codec
, 0x21, 0,
14341 AC_VERB_GET_PIN_SENSE
, 0)
14342 & AC_PINSENSE_PRESENCE
;
14343 bits
= present
? HDA_AMP_MUTE
: 0;
14344 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
14345 HDA_AMP_MUTE
, bits
);
14346 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14347 HDA_AMP_MUTE
, bits
);
14350 static void alc663_g71v_front_automute(struct hda_codec
*codec
)
14352 unsigned int present
;
14353 unsigned char bits
;
14355 present
= snd_hda_codec_read(codec
, 0x15, 0,
14356 AC_VERB_GET_PIN_SENSE
, 0)
14357 & AC_PINSENSE_PRESENCE
;
14358 bits
= present
? HDA_AMP_MUTE
: 0;
14359 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14360 HDA_AMP_MUTE
, bits
);
14363 static void alc663_g71v_unsol_event(struct hda_codec
*codec
,
14366 switch (res
>> 26) {
14367 case ALC880_HP_EVENT
:
14368 alc663_g71v_hp_automute(codec
);
14370 case ALC880_FRONT_EVENT
:
14371 alc663_g71v_front_automute(codec
);
14373 case ALC880_MIC_EVENT
:
14374 alc662_eeepc_mic_automute(codec
);
14379 static void alc663_g71v_inithook(struct hda_codec
*codec
)
14381 alc663_g71v_front_automute(codec
);
14382 alc663_g71v_hp_automute(codec
);
14383 alc662_eeepc_mic_automute(codec
);
14386 static void alc663_g50v_unsol_event(struct hda_codec
*codec
,
14389 switch (res
>> 26) {
14390 case ALC880_HP_EVENT
:
14391 alc663_m51va_speaker_automute(codec
);
14393 case ALC880_MIC_EVENT
:
14394 alc662_eeepc_mic_automute(codec
);
14399 static void alc663_g50v_inithook(struct hda_codec
*codec
)
14401 alc663_m51va_speaker_automute(codec
);
14402 alc662_eeepc_mic_automute(codec
);
14405 #ifdef CONFIG_SND_HDA_POWER_SAVE
14406 #define alc662_loopbacks alc880_loopbacks
14410 /* pcm configuration: identiacal with ALC880 */
14411 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
14412 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
14413 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
14414 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
14417 * configuration and preset
14419 static const char *alc662_models
[ALC662_MODEL_LAST
] = {
14420 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
14421 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
14422 [ALC662_3ST_6ch
] = "3stack-6ch",
14423 [ALC662_5ST_DIG
] = "6stack-dig",
14424 [ALC662_LENOVO_101E
] = "lenovo-101e",
14425 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
14426 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
14427 [ALC663_ASUS_M51VA
] = "m51va",
14428 [ALC663_ASUS_G71V
] = "g71v",
14429 [ALC663_ASUS_H13
] = "h13",
14430 [ALC663_ASUS_G50V
] = "g50v",
14431 [ALC662_AUTO
] = "auto",
14434 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
14435 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V
),
14436 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
14437 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V
),
14438 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
14439 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
14440 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
14441 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
14442 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13
),
14443 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13
),
14444 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13
),
14448 static struct alc_config_preset alc662_presets
[] = {
14449 [ALC662_3ST_2ch_DIG
] = {
14450 .mixers
= { alc662_3ST_2ch_mixer
, alc662_capture_mixer
},
14451 .init_verbs
= { alc662_init_verbs
},
14452 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14453 .dac_nids
= alc662_dac_nids
,
14454 .dig_out_nid
= ALC662_DIGOUT_NID
,
14455 .dig_in_nid
= ALC662_DIGIN_NID
,
14456 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14457 .channel_mode
= alc662_3ST_2ch_modes
,
14458 .input_mux
= &alc662_capture_source
,
14460 [ALC662_3ST_6ch_DIG
] = {
14461 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
14462 alc662_capture_mixer
},
14463 .init_verbs
= { alc662_init_verbs
},
14464 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14465 .dac_nids
= alc662_dac_nids
,
14466 .dig_out_nid
= ALC662_DIGOUT_NID
,
14467 .dig_in_nid
= ALC662_DIGIN_NID
,
14468 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
14469 .channel_mode
= alc662_3ST_6ch_modes
,
14471 .input_mux
= &alc662_capture_source
,
14473 [ALC662_3ST_6ch
] = {
14474 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
14475 alc662_capture_mixer
},
14476 .init_verbs
= { alc662_init_verbs
},
14477 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14478 .dac_nids
= alc662_dac_nids
,
14479 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
14480 .channel_mode
= alc662_3ST_6ch_modes
,
14482 .input_mux
= &alc662_capture_source
,
14484 [ALC662_5ST_DIG
] = {
14485 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
,
14486 alc662_capture_mixer
},
14487 .init_verbs
= { alc662_init_verbs
},
14488 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14489 .dac_nids
= alc662_dac_nids
,
14490 .dig_out_nid
= ALC662_DIGOUT_NID
,
14491 .dig_in_nid
= ALC662_DIGIN_NID
,
14492 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
14493 .channel_mode
= alc662_5stack_modes
,
14494 .input_mux
= &alc662_capture_source
,
14496 [ALC662_LENOVO_101E
] = {
14497 .mixers
= { alc662_lenovo_101e_mixer
, alc662_capture_mixer
},
14498 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
14499 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14500 .dac_nids
= alc662_dac_nids
,
14501 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14502 .channel_mode
= alc662_3ST_2ch_modes
,
14503 .input_mux
= &alc662_lenovo_101e_capture_source
,
14504 .unsol_event
= alc662_lenovo_101e_unsol_event
,
14505 .init_hook
= alc662_lenovo_101e_all_automute
,
14507 [ALC662_ASUS_EEEPC_P701
] = {
14508 .mixers
= { alc662_eeepc_p701_mixer
, alc662_capture_mixer
},
14509 .init_verbs
= { alc662_init_verbs
,
14510 alc662_eeepc_sue_init_verbs
},
14511 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14512 .dac_nids
= alc662_dac_nids
,
14513 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14514 .channel_mode
= alc662_3ST_2ch_modes
,
14515 .input_mux
= &alc662_eeepc_capture_source
,
14516 .unsol_event
= alc662_eeepc_unsol_event
,
14517 .init_hook
= alc662_eeepc_inithook
,
14519 [ALC662_ASUS_EEEPC_EP20
] = {
14520 .mixers
= { alc662_eeepc_ep20_mixer
, alc662_capture_mixer
,
14521 alc662_chmode_mixer
},
14522 .init_verbs
= { alc662_init_verbs
,
14523 alc662_eeepc_ep20_sue_init_verbs
},
14524 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14525 .dac_nids
= alc662_dac_nids
,
14526 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
14527 .channel_mode
= alc662_3ST_6ch_modes
,
14528 .input_mux
= &alc662_lenovo_101e_capture_source
,
14529 .unsol_event
= alc662_eeepc_ep20_unsol_event
,
14530 .init_hook
= alc662_eeepc_ep20_inithook
,
14532 [ALC663_ASUS_M51VA
] = {
14533 .mixers
= { alc663_m51va_mixer
, alc662_capture_mixer
},
14534 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
14535 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14536 .dac_nids
= alc662_dac_nids
,
14537 .dig_out_nid
= ALC662_DIGOUT_NID
,
14538 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14539 .channel_mode
= alc662_3ST_2ch_modes
,
14540 .input_mux
= &alc663_m51va_capture_source
,
14541 .unsol_event
= alc663_m51va_unsol_event
,
14542 .init_hook
= alc663_m51va_inithook
,
14544 [ALC663_ASUS_G71V
] = {
14545 .mixers
= { alc663_g71v_mixer
, alc662_capture_mixer
},
14546 .init_verbs
= { alc662_init_verbs
, alc663_g71v_init_verbs
},
14547 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14548 .dac_nids
= alc662_dac_nids
,
14549 .dig_out_nid
= ALC662_DIGOUT_NID
,
14550 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14551 .channel_mode
= alc662_3ST_2ch_modes
,
14552 .input_mux
= &alc662_eeepc_capture_source
,
14553 .unsol_event
= alc663_g71v_unsol_event
,
14554 .init_hook
= alc663_g71v_inithook
,
14556 [ALC663_ASUS_H13
] = {
14557 .mixers
= { alc663_m51va_mixer
, alc662_capture_mixer
},
14558 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
14559 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14560 .dac_nids
= alc662_dac_nids
,
14561 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14562 .channel_mode
= alc662_3ST_2ch_modes
,
14563 .input_mux
= &alc663_m51va_capture_source
,
14564 .unsol_event
= alc663_m51va_unsol_event
,
14565 .init_hook
= alc663_m51va_inithook
,
14567 [ALC663_ASUS_G50V
] = {
14568 .mixers
= { alc663_g50v_mixer
, alc662_capture_mixer
},
14569 .init_verbs
= { alc662_init_verbs
, alc663_g50v_init_verbs
},
14570 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14571 .dac_nids
= alc662_dac_nids
,
14572 .dig_out_nid
= ALC662_DIGOUT_NID
,
14573 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
14574 .channel_mode
= alc662_3ST_6ch_modes
,
14575 .input_mux
= &alc663_capture_source
,
14576 .unsol_event
= alc663_g50v_unsol_event
,
14577 .init_hook
= alc663_g50v_inithook
,
14583 * BIOS auto configuration
14586 /* add playback controls from the parsed DAC table */
14587 static int alc662_auto_create_multi_out_ctls(struct alc_spec
*spec
,
14588 const struct auto_pin_cfg
*cfg
)
14591 static const char *chname
[4] = {
14592 "Front", "Surround", NULL
/*CLFE*/, "Side"
14597 for (i
= 0; i
< cfg
->line_outs
; i
++) {
14598 if (!spec
->multiout
.dac_nids
[i
])
14600 nid
= alc880_idx_to_dac(i
);
14603 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
14604 "Center Playback Volume",
14605 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
14609 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
14610 "LFE Playback Volume",
14611 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
14615 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14616 "Center Playback Switch",
14617 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
14621 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14622 "LFE Playback Switch",
14623 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
14628 sprintf(name
, "%s Playback Volume", chname
[i
]);
14629 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
14630 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
14634 sprintf(name
, "%s Playback Switch", chname
[i
]);
14635 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
14636 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
14645 /* add playback controls for speaker and HP outputs */
14646 static int alc662_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
14657 /* ALC663 has a mono output pin on 0x17 */
14658 sprintf(name
, "%s Playback Switch", pfx
);
14659 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
14660 HDA_COMPOSE_AMP_VAL(pin
, 2, 0, HDA_OUTPUT
));
14664 if (alc880_is_fixed_pin(pin
)) {
14665 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
14666 /* printk("DAC nid=%x\n",nid); */
14667 /* specify the DAC as the extra output */
14668 if (!spec
->multiout
.hp_nid
)
14669 spec
->multiout
.hp_nid
= nid
;
14671 spec
->multiout
.extra_out_nid
[0] = nid
;
14672 /* control HP volume/switch on the output mixer amp */
14673 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
14674 sprintf(name
, "%s Playback Volume", pfx
);
14675 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
14676 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
14679 sprintf(name
, "%s Playback Switch", pfx
);
14680 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
14681 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
14684 } else if (alc880_is_multi_pin(pin
)) {
14685 /* set manual connection */
14686 /* we have only a switch on HP-out PIN */
14687 sprintf(name
, "%s Playback Switch", pfx
);
14688 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
14689 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
14696 /* create playback/capture controls for input pins */
14697 static int alc662_auto_create_analog_input_ctls(struct alc_spec
*spec
,
14698 const struct auto_pin_cfg
*cfg
)
14700 struct hda_input_mux
*imux
= &spec
->private_imux
;
14703 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
14704 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
14705 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
14706 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
14707 auto_pin_cfg_labels
[i
],
14711 imux
->items
[imux
->num_items
].label
=
14712 auto_pin_cfg_labels
[i
];
14713 imux
->items
[imux
->num_items
].index
=
14714 alc880_input_pin_idx(cfg
->input_pins
[i
]);
14721 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
14722 hda_nid_t nid
, int pin_type
,
14725 alc_set_pin_output(codec
, nid
, pin_type
);
14726 /* need the manual connection? */
14727 if (alc880_is_multi_pin(nid
)) {
14728 struct alc_spec
*spec
= codec
->spec
;
14729 int idx
= alc880_multi_pin_idx(nid
);
14730 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
14731 AC_VERB_SET_CONNECT_SEL
,
14732 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
14736 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
14738 struct alc_spec
*spec
= codec
->spec
;
14741 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
14742 for (i
= 0; i
<= HDA_SIDE
; i
++) {
14743 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
14744 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
14746 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
14751 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
14753 struct alc_spec
*spec
= codec
->spec
;
14756 pin
= spec
->autocfg
.hp_pins
[0];
14757 if (pin
) /* connect to front */
14759 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
14760 pin
= spec
->autocfg
.speaker_pins
[0];
14762 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
14765 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
14766 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
14768 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
14770 struct alc_spec
*spec
= codec
->spec
;
14773 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
14774 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
14775 if (alc662_is_input_pin(nid
)) {
14776 snd_hda_codec_write(codec
, nid
, 0,
14777 AC_VERB_SET_PIN_WIDGET_CONTROL
,
14778 (i
<= AUTO_PIN_FRONT_MIC
?
14779 PIN_VREF80
: PIN_IN
));
14780 if (nid
!= ALC662_PIN_CD_NID
)
14781 snd_hda_codec_write(codec
, nid
, 0,
14782 AC_VERB_SET_AMP_GAIN_MUTE
,
14788 #define alc662_auto_init_input_src alc882_auto_init_input_src
14790 static int alc662_parse_auto_config(struct hda_codec
*codec
)
14792 struct alc_spec
*spec
= codec
->spec
;
14794 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
14796 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14800 if (!spec
->autocfg
.line_outs
)
14801 return 0; /* can't find valid BIOS pin config */
14803 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
14806 err
= alc662_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14809 err
= alc662_auto_create_extra_out(spec
,
14810 spec
->autocfg
.speaker_pins
[0],
14814 err
= alc662_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
14818 err
= alc662_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
14822 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14824 if (spec
->autocfg
.dig_out_pin
)
14825 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
14827 if (spec
->kctl_alloc
)
14828 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
14830 spec
->num_mux_defs
= 1;
14831 spec
->input_mux
= &spec
->private_imux
;
14833 spec
->init_verbs
[spec
->num_init_verbs
++] = alc662_auto_init_verbs
;
14834 if (codec
->vendor_id
== 0x10ec0663)
14835 spec
->init_verbs
[spec
->num_init_verbs
++] =
14836 alc663_auto_init_verbs
;
14838 err
= alc_auto_add_mic_boost(codec
);
14842 spec
->mixers
[spec
->num_mixers
] = alc662_capture_mixer
;
14843 spec
->num_mixers
++;
14847 /* additional initialization for auto-configuration model */
14848 static void alc662_auto_init(struct hda_codec
*codec
)
14850 struct alc_spec
*spec
= codec
->spec
;
14851 alc662_auto_init_multi_out(codec
);
14852 alc662_auto_init_hp_out(codec
);
14853 alc662_auto_init_analog_input(codec
);
14854 alc662_auto_init_input_src(codec
);
14855 if (spec
->unsol_event
)
14856 alc_sku_automute(codec
);
14859 static int patch_alc662(struct hda_codec
*codec
)
14861 struct alc_spec
*spec
;
14862 int err
, board_config
;
14864 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
14868 codec
->spec
= spec
;
14870 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
14872 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
14875 if (board_config
< 0) {
14876 printk(KERN_INFO
"hda_codec: Unknown model for ALC662, "
14877 "trying auto-probe from BIOS...\n");
14878 board_config
= ALC662_AUTO
;
14881 if (board_config
== ALC662_AUTO
) {
14882 /* automatic parse from the BIOS config */
14883 err
= alc662_parse_auto_config(codec
);
14889 "hda_codec: Cannot set up configuration "
14890 "from BIOS. Using base mode...\n");
14891 board_config
= ALC662_3ST_2ch_DIG
;
14895 if (board_config
!= ALC662_AUTO
)
14896 setup_preset(spec
, &alc662_presets
[board_config
]);
14898 if (codec
->vendor_id
== 0x10ec0663) {
14899 spec
->stream_name_analog
= "ALC663 Analog";
14900 spec
->stream_name_digital
= "ALC663 Digital";
14902 spec
->stream_name_analog
= "ALC662 Analog";
14903 spec
->stream_name_digital
= "ALC662 Digital";
14906 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
14907 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
14909 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
14910 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
14912 spec
->adc_nids
= alc662_adc_nids
;
14913 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
14914 spec
->capsrc_nids
= alc662_capsrc_nids
;
14916 spec
->vmaster_nid
= 0x02;
14918 codec
->patch_ops
= alc_patch_ops
;
14919 if (board_config
== ALC662_AUTO
)
14920 spec
->init_hook
= alc662_auto_init
;
14921 #ifdef CONFIG_SND_HDA_POWER_SAVE
14922 if (!spec
->loopback
.amplist
)
14923 spec
->loopback
.amplist
= alc662_loopbacks
;
14932 struct hda_codec_preset snd_hda_preset_realtek
[] = {
14933 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
14934 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
14935 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
14936 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
14937 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
14938 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
14939 .patch
= patch_alc861
},
14940 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
14941 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
14942 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
14943 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
14944 .patch
= patch_alc883
},
14945 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
14946 .patch
= patch_alc662
},
14947 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
14948 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
14949 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
14950 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
14951 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
14952 .patch
= patch_alc882
}, /* should be patch_alc883() in future */
14953 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
14954 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
14955 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc883
},
14956 {} /* terminator */