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
,
104 ALC262_MODEL_LAST
/* last tag */
115 #ifdef CONFIG_SND_DEBUG
119 ALC268_MODEL_LAST
/* last tag */
126 ALC269_MODEL_LAST
/* last tag */
143 /* ALC861-VD models */
164 ALC662_ASUS_EEEPC_P701
,
165 ALC662_ASUS_EEEPC_EP20
,
197 ALC883_TARGA_2ch_DIG
,
203 ALC883_LENOVO_101E_2ch
,
204 ALC883_LENOVO_NB0763
,
205 ALC888_LENOVO_MS7195_DIG
,
211 ALC883_FUJITSU_PI2515
,
212 ALC883_3ST_6ch_INTEL
,
218 #define GPIO_MASK 0x03
221 /* codec parameterization */
222 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
223 unsigned int num_mixers
;
225 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
229 unsigned int num_init_verbs
;
231 char *stream_name_analog
; /* analog PCM stream */
232 struct hda_pcm_stream
*stream_analog_playback
;
233 struct hda_pcm_stream
*stream_analog_capture
;
234 struct hda_pcm_stream
*stream_analog_alt_playback
;
235 struct hda_pcm_stream
*stream_analog_alt_capture
;
237 char *stream_name_digital
; /* digital PCM stream */
238 struct hda_pcm_stream
*stream_digital_playback
;
239 struct hda_pcm_stream
*stream_digital_capture
;
242 struct hda_multi_out multiout
; /* playback set-up
243 * max_channels, dacs must be set
244 * dig_out_nid and hp_nid are optional
246 hda_nid_t alt_dac_nid
;
249 unsigned int num_adc_nids
;
251 hda_nid_t
*capsrc_nids
;
252 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
255 unsigned int num_mux_defs
;
256 const struct hda_input_mux
*input_mux
;
257 unsigned int cur_mux
[3];
260 const struct hda_channel_mode
*channel_mode
;
261 int num_channel_mode
;
264 /* PCM information */
265 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
267 /* dynamic controls, init_verbs and input_mux */
268 struct auto_pin_cfg autocfg
;
269 unsigned int num_kctl_alloc
, num_kctl_used
;
270 struct snd_kcontrol_new
*kctl_alloc
;
271 struct hda_input_mux private_imux
;
272 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
275 void (*init_hook
)(struct hda_codec
*codec
);
276 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
278 /* for pin sensing */
279 unsigned int sense_updated
: 1;
280 unsigned int jack_present
: 1;
281 unsigned int master_sw
: 1;
283 /* for virtual master */
284 hda_nid_t vmaster_nid
;
285 #ifdef CONFIG_SND_HDA_POWER_SAVE
286 struct hda_loopback_check loopback
;
291 unsigned int pll_coef_idx
, pll_coef_bit
;
295 * configuration template - to be copied to the spec instance
297 struct alc_config_preset
{
298 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
301 const struct hda_verb
*init_verbs
[5];
302 unsigned int num_dacs
;
304 hda_nid_t dig_out_nid
; /* optional */
305 hda_nid_t hp_nid
; /* optional */
306 unsigned int num_adc_nids
;
308 hda_nid_t
*capsrc_nids
;
309 hda_nid_t dig_in_nid
;
310 unsigned int num_channel_mode
;
311 const struct hda_channel_mode
*channel_mode
;
313 unsigned int num_mux_defs
;
314 const struct hda_input_mux
*input_mux
;
315 void (*unsol_event
)(struct hda_codec
*, unsigned int);
316 void (*init_hook
)(struct hda_codec
*);
317 #ifdef CONFIG_SND_HDA_POWER_SAVE
318 struct hda_amp_list
*loopbacks
;
326 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
327 struct snd_ctl_elem_info
*uinfo
)
329 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
330 struct alc_spec
*spec
= codec
->spec
;
331 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
332 if (mux_idx
>= spec
->num_mux_defs
)
334 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
337 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
338 struct snd_ctl_elem_value
*ucontrol
)
340 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
341 struct alc_spec
*spec
= codec
->spec
;
342 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
344 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
348 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
349 struct snd_ctl_elem_value
*ucontrol
)
351 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
352 struct alc_spec
*spec
= codec
->spec
;
353 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
354 unsigned int mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
355 hda_nid_t nid
= spec
->capsrc_nids
?
356 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
357 return snd_hda_input_mux_put(codec
, &spec
->input_mux
[mux_idx
], ucontrol
,
358 nid
, &spec
->cur_mux
[adc_idx
]);
363 * channel mode setting
365 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
366 struct snd_ctl_elem_info
*uinfo
)
368 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
369 struct alc_spec
*spec
= codec
->spec
;
370 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
371 spec
->num_channel_mode
);
374 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
375 struct snd_ctl_elem_value
*ucontrol
)
377 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
378 struct alc_spec
*spec
= codec
->spec
;
379 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
380 spec
->num_channel_mode
,
381 spec
->multiout
.max_channels
);
384 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
385 struct snd_ctl_elem_value
*ucontrol
)
387 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
388 struct alc_spec
*spec
= codec
->spec
;
389 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
390 spec
->num_channel_mode
,
391 &spec
->multiout
.max_channels
);
392 if (err
>= 0 && spec
->need_dac_fix
)
393 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
398 * Control the mode of pin widget settings via the mixer. "pc" is used
399 * instead of "%" to avoid consequences of accidently treating the % as
400 * being part of a format specifier. Maximum allowed length of a value is
401 * 63 characters plus NULL terminator.
403 * Note: some retasking pin complexes seem to ignore requests for input
404 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
405 * are requested. Therefore order this list so that this behaviour will not
406 * cause problems when mixer clients move through the enum sequentially.
407 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
410 static char *alc_pin_mode_names
[] = {
411 "Mic 50pc bias", "Mic 80pc bias",
412 "Line in", "Line out", "Headphone out",
414 static unsigned char alc_pin_mode_values
[] = {
415 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
417 /* The control can present all 5 options, or it can limit the options based
418 * in the pin being assumed to be exclusively an input or an output pin. In
419 * addition, "input" pins may or may not process the mic bias option
420 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
421 * accept requests for bias as of chip versions up to March 2006) and/or
422 * wiring in the computer.
424 #define ALC_PIN_DIR_IN 0x00
425 #define ALC_PIN_DIR_OUT 0x01
426 #define ALC_PIN_DIR_INOUT 0x02
427 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
428 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
430 /* Info about the pin modes supported by the different pin direction modes.
431 * For each direction the minimum and maximum values are given.
433 static signed char alc_pin_mode_dir_info
[5][2] = {
434 { 0, 2 }, /* ALC_PIN_DIR_IN */
435 { 3, 4 }, /* ALC_PIN_DIR_OUT */
436 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
437 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
438 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
440 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
441 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
442 #define alc_pin_mode_n_items(_dir) \
443 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
445 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
446 struct snd_ctl_elem_info
*uinfo
)
448 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
449 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
451 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
453 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
455 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
456 item_num
= alc_pin_mode_min(dir
);
457 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
461 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
462 struct snd_ctl_elem_value
*ucontrol
)
465 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
466 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
467 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
468 long *valp
= ucontrol
->value
.integer
.value
;
469 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
470 AC_VERB_GET_PIN_WIDGET_CONTROL
,
473 /* Find enumerated value for current pinctl setting */
474 i
= alc_pin_mode_min(dir
);
475 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
477 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
481 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
482 struct snd_ctl_elem_value
*ucontrol
)
485 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
486 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
487 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
488 long val
= *ucontrol
->value
.integer
.value
;
489 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
490 AC_VERB_GET_PIN_WIDGET_CONTROL
,
493 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
494 val
= alc_pin_mode_min(dir
);
496 change
= pinctl
!= alc_pin_mode_values
[val
];
498 /* Set pin mode to that requested */
499 snd_hda_codec_write_cache(codec
, nid
, 0,
500 AC_VERB_SET_PIN_WIDGET_CONTROL
,
501 alc_pin_mode_values
[val
]);
503 /* Also enable the retasking pin's input/output as required
504 * for the requested pin mode. Enum values of 2 or less are
507 * Dynamically switching the input/output buffers probably
508 * reduces noise slightly (particularly on input) so we'll
509 * do it. However, having both input and output buffers
510 * enabled simultaneously doesn't seem to be problematic if
511 * this turns out to be necessary in the future.
514 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
515 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
516 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
519 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
520 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
521 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
528 #define ALC_PIN_MODE(xname, nid, dir) \
529 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
530 .info = alc_pin_mode_info, \
531 .get = alc_pin_mode_get, \
532 .put = alc_pin_mode_put, \
533 .private_value = nid | (dir<<16) }
535 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
536 * together using a mask with more than one bit set. This control is
537 * currently used only by the ALC260 test model. At this stage they are not
538 * needed for any "production" models.
540 #ifdef CONFIG_SND_DEBUG
541 #define alc_gpio_data_info snd_ctl_boolean_mono_info
543 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
544 struct snd_ctl_elem_value
*ucontrol
)
546 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
547 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
548 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
549 long *valp
= ucontrol
->value
.integer
.value
;
550 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
551 AC_VERB_GET_GPIO_DATA
, 0x00);
553 *valp
= (val
& mask
) != 0;
556 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
557 struct snd_ctl_elem_value
*ucontrol
)
560 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
561 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
562 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
563 long val
= *ucontrol
->value
.integer
.value
;
564 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
565 AC_VERB_GET_GPIO_DATA
,
568 /* Set/unset the masked GPIO bit(s) as needed */
569 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
574 snd_hda_codec_write_cache(codec
, nid
, 0,
575 AC_VERB_SET_GPIO_DATA
, gpio_data
);
579 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
580 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
581 .info = alc_gpio_data_info, \
582 .get = alc_gpio_data_get, \
583 .put = alc_gpio_data_put, \
584 .private_value = nid | (mask<<16) }
585 #endif /* CONFIG_SND_DEBUG */
587 /* A switch control to allow the enabling of the digital IO pins on the
588 * ALC260. This is incredibly simplistic; the intention of this control is
589 * to provide something in the test model allowing digital outputs to be
590 * identified if present. If models are found which can utilise these
591 * outputs a more complete mixer control can be devised for those models if
594 #ifdef CONFIG_SND_DEBUG
595 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
597 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
598 struct snd_ctl_elem_value
*ucontrol
)
600 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
601 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
602 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
603 long *valp
= ucontrol
->value
.integer
.value
;
604 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
605 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
607 *valp
= (val
& mask
) != 0;
610 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
611 struct snd_ctl_elem_value
*ucontrol
)
614 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
615 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
616 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
617 long val
= *ucontrol
->value
.integer
.value
;
618 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
619 AC_VERB_GET_DIGI_CONVERT_1
,
622 /* Set/unset the masked control bit(s) as needed */
623 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
628 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
633 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
634 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
635 .info = alc_spdif_ctrl_info, \
636 .get = alc_spdif_ctrl_get, \
637 .put = alc_spdif_ctrl_put, \
638 .private_value = nid | (mask<<16) }
639 #endif /* CONFIG_SND_DEBUG */
641 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
642 * Again, this is only used in the ALC26x test models to help identify when
643 * the EAPD line must be asserted for features to work.
645 #ifdef CONFIG_SND_DEBUG
646 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
648 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
649 struct snd_ctl_elem_value
*ucontrol
)
651 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
652 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
653 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
654 long *valp
= ucontrol
->value
.integer
.value
;
655 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
656 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
658 *valp
= (val
& mask
) != 0;
662 static int alc_eapd_ctrl_put(struct snd_kcontrol
*kcontrol
,
663 struct snd_ctl_elem_value
*ucontrol
)
666 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
667 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
668 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
669 long val
= *ucontrol
->value
.integer
.value
;
670 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
671 AC_VERB_GET_EAPD_BTLENABLE
,
674 /* Set/unset the masked control bit(s) as needed */
675 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
680 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
686 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
687 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
688 .info = alc_eapd_ctrl_info, \
689 .get = alc_eapd_ctrl_get, \
690 .put = alc_eapd_ctrl_put, \
691 .private_value = nid | (mask<<16) }
692 #endif /* CONFIG_SND_DEBUG */
695 * set up from the preset table
697 static void setup_preset(struct alc_spec
*spec
,
698 const struct alc_config_preset
*preset
)
702 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
703 spec
->mixers
[spec
->num_mixers
++] = preset
->mixers
[i
];
704 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
706 spec
->init_verbs
[spec
->num_init_verbs
++] =
707 preset
->init_verbs
[i
];
709 spec
->channel_mode
= preset
->channel_mode
;
710 spec
->num_channel_mode
= preset
->num_channel_mode
;
711 spec
->need_dac_fix
= preset
->need_dac_fix
;
713 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
715 spec
->multiout
.num_dacs
= preset
->num_dacs
;
716 spec
->multiout
.dac_nids
= preset
->dac_nids
;
717 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
718 spec
->multiout
.hp_nid
= preset
->hp_nid
;
720 spec
->num_mux_defs
= preset
->num_mux_defs
;
721 if (!spec
->num_mux_defs
)
722 spec
->num_mux_defs
= 1;
723 spec
->input_mux
= preset
->input_mux
;
725 spec
->num_adc_nids
= preset
->num_adc_nids
;
726 spec
->adc_nids
= preset
->adc_nids
;
727 spec
->capsrc_nids
= preset
->capsrc_nids
;
728 spec
->dig_in_nid
= preset
->dig_in_nid
;
730 spec
->unsol_event
= preset
->unsol_event
;
731 spec
->init_hook
= preset
->init_hook
;
732 #ifdef CONFIG_SND_HDA_POWER_SAVE
733 spec
->loopback
.amplist
= preset
->loopbacks
;
737 /* Enable GPIO mask and set output */
738 static struct hda_verb alc_gpio1_init_verbs
[] = {
739 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
740 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
741 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
745 static struct hda_verb alc_gpio2_init_verbs
[] = {
746 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
747 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
748 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
752 static struct hda_verb alc_gpio3_init_verbs
[] = {
753 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
754 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
755 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
760 * Fix hardware PLL issue
761 * On some codecs, the analog PLL gating control must be off while
762 * the default value is 1.
764 static void alc_fix_pll(struct hda_codec
*codec
)
766 struct alc_spec
*spec
= codec
->spec
;
771 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
773 val
= snd_hda_codec_read(codec
, spec
->pll_nid
, 0,
774 AC_VERB_GET_PROC_COEF
, 0);
775 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_COEF_INDEX
,
777 snd_hda_codec_write(codec
, spec
->pll_nid
, 0, AC_VERB_SET_PROC_COEF
,
778 val
& ~(1 << spec
->pll_coef_bit
));
781 static void alc_fix_pll_init(struct hda_codec
*codec
, hda_nid_t nid
,
782 unsigned int coef_idx
, unsigned int coef_bit
)
784 struct alc_spec
*spec
= codec
->spec
;
786 spec
->pll_coef_idx
= coef_idx
;
787 spec
->pll_coef_bit
= coef_bit
;
791 static void alc_sku_automute(struct hda_codec
*codec
)
793 struct alc_spec
*spec
= codec
->spec
;
794 unsigned int present
;
795 unsigned int hp_nid
= spec
->autocfg
.hp_pins
[0];
796 unsigned int sp_nid
= spec
->autocfg
.speaker_pins
[0];
798 /* need to execute and sync at first */
799 snd_hda_codec_read(codec
, hp_nid
, 0, AC_VERB_SET_PIN_SENSE
, 0);
800 present
= snd_hda_codec_read(codec
, hp_nid
, 0,
801 AC_VERB_GET_PIN_SENSE
, 0);
802 spec
->jack_present
= (present
& 0x80000000) != 0;
803 snd_hda_codec_write(codec
, sp_nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
804 spec
->jack_present
? 0 : PIN_OUT
);
807 /* unsolicited event for HP jack sensing */
808 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
810 if (codec
->vendor_id
== 0x10ec0880)
814 if (res
!= ALC880_HP_EVENT
)
817 alc_sku_automute(codec
);
820 /* additional initialization for ALC888 variants */
821 static void alc888_coef_init(struct hda_codec
*codec
)
825 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 0);
826 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
827 snd_hda_codec_write(codec
, 0x20, 0, AC_VERB_SET_COEF_INDEX
, 7);
828 if ((tmp
& 0xf0) == 2)
830 snd_hda_codec_read(codec
, 0x20, 0,
831 AC_VERB_SET_PROC_COEF
, 0x830);
834 snd_hda_codec_read(codec
, 0x20, 0,
835 AC_VERB_SET_PROC_COEF
, 0x3030);
838 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
839 * 31 ~ 16 : Manufacture ID
841 * 7 ~ 0 : Assembly ID
842 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
844 static void alc_subsystem_id(struct hda_codec
*codec
,
845 unsigned int porta
, unsigned int porte
,
848 unsigned int ass
, tmp
, i
;
850 struct alc_spec
*spec
= codec
->spec
;
852 ass
= codec
->subsystem_id
& 0xffff;
853 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
857 * 31~30 : port conetcivity
860 * 19~16 : Check sum (15:1)
865 if (codec
->vendor_id
== 0x10ec0260)
867 ass
= snd_hda_codec_read(codec
, nid
, 0,
868 AC_VERB_GET_CONFIG_DEFAULT
, 0);
869 if (!(ass
& 1) && !(ass
& 0x100000))
871 if ((ass
>> 30) != 1) /* no physical connection */
876 for (i
= 1; i
< 16; i
++) {
880 if (((ass
>> 16) & 0xf) != tmp
)
886 * 2 : 0 --> Desktop, 1 --> Laptop
887 * 3~5 : External Amplifier control
890 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
893 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
896 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
899 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
901 case 5: /* set EAPD output high */
902 switch (codec
->vendor_id
) {
904 snd_hda_codec_write(codec
, 0x0f, 0,
905 AC_VERB_SET_EAPD_BTLENABLE
, 2);
906 snd_hda_codec_write(codec
, 0x10, 0,
907 AC_VERB_SET_EAPD_BTLENABLE
, 2);
918 snd_hda_codec_write(codec
, 0x14, 0,
919 AC_VERB_SET_EAPD_BTLENABLE
, 2);
920 snd_hda_codec_write(codec
, 0x15, 0,
921 AC_VERB_SET_EAPD_BTLENABLE
, 2);
924 switch (codec
->vendor_id
) {
926 snd_hda_codec_write(codec
, 0x1a, 0,
927 AC_VERB_SET_COEF_INDEX
, 7);
928 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
929 AC_VERB_GET_PROC_COEF
, 0);
930 snd_hda_codec_write(codec
, 0x1a, 0,
931 AC_VERB_SET_COEF_INDEX
, 7);
932 snd_hda_codec_write(codec
, 0x1a, 0,
933 AC_VERB_SET_PROC_COEF
,
942 snd_hda_codec_write(codec
, 0x20, 0,
943 AC_VERB_SET_COEF_INDEX
, 7);
944 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
945 AC_VERB_GET_PROC_COEF
, 0);
946 snd_hda_codec_write(codec
, 0x20, 0,
947 AC_VERB_SET_COEF_INDEX
, 7);
948 snd_hda_codec_write(codec
, 0x20, 0,
949 AC_VERB_SET_PROC_COEF
,
953 alc888_coef_init(codec
);
957 snd_hda_codec_write(codec
, 0x20, 0,
958 AC_VERB_SET_COEF_INDEX
, 7);
959 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
960 AC_VERB_GET_PROC_COEF
, 0);
961 snd_hda_codec_write(codec
, 0x20, 0,
962 AC_VERB_SET_COEF_INDEX
, 7);
963 snd_hda_codec_write(codec
, 0x20, 0,
964 AC_VERB_SET_PROC_COEF
,
972 /* is laptop or Desktop and enable the function "Mute internal speaker
973 * when the external headphone out jack is plugged"
978 * 10~8 : Jack location
979 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
981 * 15 : 1 --> enable the function "Mute internal speaker
982 * when the external headphone out jack is plugged"
984 if (!spec
->autocfg
.speaker_pins
[0]) {
985 if (spec
->autocfg
.line_out_pins
[0])
986 spec
->autocfg
.speaker_pins
[0] =
987 spec
->autocfg
.line_out_pins
[0];
992 if (!spec
->autocfg
.hp_pins
[0]) {
993 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
995 spec
->autocfg
.hp_pins
[0] = porta
;
997 spec
->autocfg
.hp_pins
[0] = porte
;
999 spec
->autocfg
.hp_pins
[0] = portd
;
1004 snd_hda_codec_write(codec
, spec
->autocfg
.hp_pins
[0], 0,
1005 AC_VERB_SET_UNSOLICITED_ENABLE
,
1006 AC_USRSP_EN
| ALC880_HP_EVENT
);
1007 spec
->unsol_event
= alc_sku_unsol_event
;
1011 * Fix-up pin default configurations
1019 static void alc_fix_pincfg(struct hda_codec
*codec
,
1020 const struct snd_pci_quirk
*quirk
,
1021 const struct alc_pincfg
**pinfix
)
1023 const struct alc_pincfg
*cfg
;
1025 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
1029 cfg
= pinfix
[quirk
->value
];
1030 for (; cfg
->nid
; cfg
++) {
1033 for (i
= 0; i
< 4; i
++) {
1034 snd_hda_codec_write(codec
, cfg
->nid
, 0,
1035 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
+ i
,
1043 * ALC880 3-stack model
1045 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1046 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1047 * F-Mic = 0x1b, HP = 0x19
1050 static hda_nid_t alc880_dac_nids
[4] = {
1051 /* front, rear, clfe, rear_surr */
1052 0x02, 0x05, 0x04, 0x03
1055 static hda_nid_t alc880_adc_nids
[3] = {
1060 /* The datasheet says the node 0x07 is connected from inputs,
1061 * but it shows zero connection in the real implementation on some devices.
1062 * Note: this is a 915GAV bug, fixed on 915GLV
1064 static hda_nid_t alc880_adc_nids_alt
[2] = {
1069 #define ALC880_DIGOUT_NID 0x06
1070 #define ALC880_DIGIN_NID 0x0a
1072 static struct hda_input_mux alc880_capture_source
= {
1076 { "Front Mic", 0x3 },
1082 /* channel source setting (2/6 channel selection for 3-stack) */
1084 static struct hda_verb alc880_threestack_ch2_init
[] = {
1085 /* set line-in to input, mute it */
1086 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1087 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1088 /* set mic-in to input vref 80%, mute it */
1089 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1090 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1095 static struct hda_verb alc880_threestack_ch6_init
[] = {
1096 /* set line-in to output, unmute it */
1097 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1098 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1099 /* set mic-in to output, unmute it */
1100 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1101 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1105 static struct hda_channel_mode alc880_threestack_modes
[2] = {
1106 { 2, alc880_threestack_ch2_init
},
1107 { 6, alc880_threestack_ch6_init
},
1110 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
1111 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1112 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1113 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1114 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
1115 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1116 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1117 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1118 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1119 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1120 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1121 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1122 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1125 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
1126 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
1127 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1128 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
1131 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1132 .name
= "Channel Mode",
1133 .info
= alc_ch_mode_info
,
1134 .get
= alc_ch_mode_get
,
1135 .put
= alc_ch_mode_put
,
1140 /* capture mixer elements */
1141 static struct snd_kcontrol_new alc880_capture_mixer
[] = {
1142 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
1143 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
1144 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
1145 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
1146 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
1147 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
1149 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1150 /* The multiple "Capture Source" controls confuse alsamixer
1151 * So call somewhat different..
1153 /* .name = "Capture Source", */
1154 .name
= "Input Source",
1156 .info
= alc_mux_enum_info
,
1157 .get
= alc_mux_enum_get
,
1158 .put
= alc_mux_enum_put
,
1163 /* capture mixer elements (in case NID 0x07 not available) */
1164 static struct snd_kcontrol_new alc880_capture_alt_mixer
[] = {
1165 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1166 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1167 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
1168 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
1170 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1171 /* The multiple "Capture Source" controls confuse alsamixer
1172 * So call somewhat different..
1174 /* .name = "Capture Source", */
1175 .name
= "Input Source",
1177 .info
= alc_mux_enum_info
,
1178 .get
= alc_mux_enum_get
,
1179 .put
= alc_mux_enum_put
,
1187 * ALC880 5-stack model
1189 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1191 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1192 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1195 /* additional mixers to alc880_three_stack_mixer */
1196 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
1197 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1198 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
1202 /* channel source setting (6/8 channel selection for 5-stack) */
1204 static struct hda_verb alc880_fivestack_ch6_init
[] = {
1205 /* set line-in to input, mute it */
1206 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1207 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1212 static struct hda_verb alc880_fivestack_ch8_init
[] = {
1213 /* set line-in to output, unmute it */
1214 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1215 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1219 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
1220 { 6, alc880_fivestack_ch6_init
},
1221 { 8, alc880_fivestack_ch8_init
},
1226 * ALC880 6-stack model
1228 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1229 * Side = 0x05 (0x0f)
1230 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1231 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1234 static hda_nid_t alc880_6st_dac_nids
[4] = {
1235 /* front, rear, clfe, rear_surr */
1236 0x02, 0x03, 0x04, 0x05
1239 static struct hda_input_mux alc880_6stack_capture_source
= {
1243 { "Front Mic", 0x1 },
1249 /* fixed 8-channels */
1250 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
1254 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
1255 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1256 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1257 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1258 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1259 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1260 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1261 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1262 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1263 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1264 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1265 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1266 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1267 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1268 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1269 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1270 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1271 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1272 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1273 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1274 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1276 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1277 .name
= "Channel Mode",
1278 .info
= alc_ch_mode_info
,
1279 .get
= alc_ch_mode_get
,
1280 .put
= alc_ch_mode_put
,
1289 * W810 has rear IO for:
1292 * Center/LFE (DAC 04)
1295 * The system also has a pair of internal speakers, and a headphone jack.
1296 * These are both connected to Line2 on the codec, hence to DAC 02.
1298 * There is a variable resistor to control the speaker or headphone
1299 * volume. This is a hardware-only device without a software API.
1301 * Plugging headphones in will disable the internal speakers. This is
1302 * implemented in hardware, not via the driver using jack sense. In
1303 * a similar fashion, plugging into the rear socket marked "front" will
1304 * disable both the speakers and headphones.
1306 * For input, there's a microphone jack, and an "audio in" jack.
1307 * These may not do anything useful with this driver yet, because I
1308 * haven't setup any initialization verbs for these yet...
1311 static hda_nid_t alc880_w810_dac_nids
[3] = {
1312 /* front, rear/surround, clfe */
1316 /* fixed 6 channels */
1317 static struct hda_channel_mode alc880_w810_modes
[1] = {
1321 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1322 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
1323 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1324 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1325 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1326 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1327 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1328 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1329 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1330 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1331 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1339 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1340 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1344 static hda_nid_t alc880_z71v_dac_nids
[1] = {
1347 #define ALC880_Z71V_HP_DAC 0x03
1349 /* fixed 2 channels */
1350 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
1354 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
1355 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1356 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1357 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1358 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
1359 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1360 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1361 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1362 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1368 * ALC880 F1734 model
1370 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1371 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1374 static hda_nid_t alc880_f1734_dac_nids
[1] = {
1377 #define ALC880_F1734_HP_DAC 0x02
1379 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
1380 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1381 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1382 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1383 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1384 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1385 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1386 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1387 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1391 static struct hda_input_mux alc880_f1734_capture_source
= {
1403 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1404 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1405 * Mic = 0x18, Line = 0x1a
1408 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1409 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1411 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
1412 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1413 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1414 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1415 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1416 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1417 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1418 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1419 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1420 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1421 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1422 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1423 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1424 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1425 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1427 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1428 .name
= "Channel Mode",
1429 .info
= alc_ch_mode_info
,
1430 .get
= alc_ch_mode_get
,
1431 .put
= alc_ch_mode_put
,
1437 * ALC880 ASUS W1V model
1439 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1440 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1441 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1444 /* additional mixers to alc880_asus_mixer */
1445 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
1446 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
1447 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
1451 /* additional mixers to alc880_asus_mixer */
1452 static struct snd_kcontrol_new alc880_pcbeep_mixer
[] = {
1453 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1454 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1459 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
1460 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1461 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1462 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
1463 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
1464 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
1465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
1466 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
1467 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1468 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1470 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1471 /* The multiple "Capture Source" controls confuse alsamixer
1472 * So call somewhat different..
1474 /* .name = "Capture Source", */
1475 .name
= "Input Source",
1477 .info
= alc_mux_enum_info
,
1478 .get
= alc_mux_enum_get
,
1479 .put
= alc_mux_enum_put
,
1485 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
1486 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1487 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1488 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1489 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1490 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1491 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1492 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1493 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1494 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1495 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1496 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1497 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1498 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1499 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1500 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1501 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1502 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1503 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1505 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1506 .name
= "Channel Mode",
1507 .info
= alc_ch_mode_info
,
1508 .get
= alc_ch_mode_get
,
1509 .put
= alc_ch_mode_put
,
1514 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
1515 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1516 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1517 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1518 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1519 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1520 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1521 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1522 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1523 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1524 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1528 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
1529 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1530 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1531 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1532 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1533 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1534 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1539 * virtual master controls
1543 * slave controls for virtual master
1545 static const char *alc_slave_vols
[] = {
1546 "Front Playback Volume",
1547 "Surround Playback Volume",
1548 "Center Playback Volume",
1549 "LFE Playback Volume",
1550 "Side Playback Volume",
1551 "Headphone Playback Volume",
1552 "Speaker Playback Volume",
1553 "Mono Playback Volume",
1554 "Line-Out Playback Volume",
1558 static const char *alc_slave_sws
[] = {
1559 "Front Playback Switch",
1560 "Surround Playback Switch",
1561 "Center Playback Switch",
1562 "LFE Playback Switch",
1563 "Side Playback Switch",
1564 "Headphone Playback Switch",
1565 "Speaker Playback Switch",
1566 "Mono Playback Switch",
1567 "IEC958 Playback Switch",
1572 * build control elements
1574 static int alc_build_controls(struct hda_codec
*codec
)
1576 struct alc_spec
*spec
= codec
->spec
;
1580 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1581 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1586 if (spec
->multiout
.dig_out_nid
) {
1587 err
= snd_hda_create_spdif_out_ctls(codec
,
1588 spec
->multiout
.dig_out_nid
);
1591 err
= snd_hda_create_spdif_share_sw(codec
,
1595 spec
->multiout
.share_spdif
= 1;
1597 if (spec
->dig_in_nid
) {
1598 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1603 /* if we have no master control, let's create it */
1604 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
1605 unsigned int vmaster_tlv
[4];
1606 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
1607 HDA_OUTPUT
, vmaster_tlv
);
1608 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
1609 vmaster_tlv
, alc_slave_vols
);
1613 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
1614 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
1615 NULL
, alc_slave_sws
);
1625 * initialize the codec volumes, etc
1629 * generic initialization of ADC, input mixers and output mixers
1631 static struct hda_verb alc880_volume_init_verbs
[] = {
1633 * Unmute ADC0-2 and set the default input to mic-in
1635 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
1636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1637 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
1638 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1639 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
1640 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1642 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1644 * Note: PASD motherboards uses the Line In 2 as the input for front
1647 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1648 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1649 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1650 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
1651 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
1652 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
1653 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
1654 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
1657 * Set up output mixers (0x0c - 0x0f)
1659 /* set vol=0 to output mixers */
1660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1662 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1663 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1664 /* set up input amps for analog loopback */
1665 /* Amp Indices: DAC = 0, mixer = 1 */
1666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1668 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1669 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1670 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1671 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1672 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1673 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1679 * 3-stack pin configuration:
1680 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1682 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
1684 * preset connection lists of input pins
1685 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1687 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
1688 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1689 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
1692 * Set pin mode and muting
1694 /* set front pin widgets 0x14 for output */
1695 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1696 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1697 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1698 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1699 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1700 /* Mic2 (as headphone out) for HP output */
1701 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1702 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1703 /* Line In pin widget for input */
1704 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1705 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1706 /* Line2 (as front mic) pin widget for input and vref at 80% */
1707 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1708 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1709 /* CD pin widget for input */
1710 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1716 * 5-stack pin configuration:
1717 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1718 * line-in/side = 0x1a, f-mic = 0x1b
1720 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
1722 * preset connection lists of input pins
1723 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1725 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1726 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
1729 * Set pin mode and muting
1731 /* set pin widgets 0x14-0x17 for output */
1732 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1733 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1734 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1735 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1736 /* unmute pins for output (no gain on this amp) */
1737 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1739 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1740 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1742 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1743 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1744 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1745 /* Mic2 (as headphone out) for HP output */
1746 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1747 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1748 /* Line In pin widget for input */
1749 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1750 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1751 /* Line2 (as front mic) pin widget for input and vref at 80% */
1752 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1753 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1754 /* CD pin widget for input */
1755 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1761 * W810 pin configuration:
1762 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1764 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
1765 /* hphone/speaker input selector: front DAC */
1766 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
1768 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1769 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1770 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1771 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1772 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1773 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1775 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1776 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1782 * Z71V pin configuration:
1783 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1785 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
1786 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1787 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1788 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1789 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1791 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1792 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1793 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1794 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1800 * 6-stack pin configuration:
1801 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1802 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1804 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
1805 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1808 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1809 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1811 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1812 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1813 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1814 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1816 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1817 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1820 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1821 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1822 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1823 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1824 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1830 * Uniwill pin configuration:
1831 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1834 static struct hda_verb alc880_uniwill_init_verbs
[] = {
1835 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1837 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1838 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1839 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1840 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1841 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1842 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1843 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1844 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1846 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1847 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1848 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1849 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1850 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1852 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1853 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1854 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1855 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1856 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1857 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1858 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1859 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1860 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1862 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1863 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
1870 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1872 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
1873 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1875 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1876 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1877 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1878 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1879 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1880 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1883 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1884 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1885 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1886 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1888 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1889 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1890 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1891 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1892 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1893 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1895 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1896 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
1901 static struct hda_verb alc880_beep_init_verbs
[] = {
1902 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
1906 /* toggle speaker-output according to the hp-jack state */
1907 static void alc880_uniwill_hp_automute(struct hda_codec
*codec
)
1909 unsigned int present
;
1912 present
= snd_hda_codec_read(codec
, 0x14, 0,
1913 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1914 bits
= present
? HDA_AMP_MUTE
: 0;
1915 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
1916 HDA_AMP_MUTE
, bits
);
1917 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
1918 HDA_AMP_MUTE
, bits
);
1921 /* auto-toggle front mic */
1922 static void alc880_uniwill_mic_automute(struct hda_codec
*codec
)
1924 unsigned int present
;
1927 present
= snd_hda_codec_read(codec
, 0x18, 0,
1928 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1929 bits
= present
? HDA_AMP_MUTE
: 0;
1930 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
1933 static void alc880_uniwill_automute(struct hda_codec
*codec
)
1935 alc880_uniwill_hp_automute(codec
);
1936 alc880_uniwill_mic_automute(codec
);
1939 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
1942 /* Looks like the unsol event is incompatible with the standard
1943 * definition. 4bit tag is placed at 28 bit!
1945 switch (res
>> 28) {
1946 case ALC880_HP_EVENT
:
1947 alc880_uniwill_hp_automute(codec
);
1949 case ALC880_MIC_EVENT
:
1950 alc880_uniwill_mic_automute(codec
);
1955 static void alc880_uniwill_p53_hp_automute(struct hda_codec
*codec
)
1957 unsigned int present
;
1960 present
= snd_hda_codec_read(codec
, 0x14, 0,
1961 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1962 bits
= present
? HDA_AMP_MUTE
: 0;
1963 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0, HDA_AMP_MUTE
, bits
);
1966 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
1968 unsigned int present
;
1970 present
= snd_hda_codec_read(codec
, 0x21, 0,
1971 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
1972 present
&= HDA_AMP_VOLMASK
;
1973 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
1974 HDA_AMP_VOLMASK
, present
);
1975 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
1976 HDA_AMP_VOLMASK
, present
);
1979 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
1982 /* Looks like the unsol event is incompatible with the standard
1983 * definition. 4bit tag is placed at 28 bit!
1985 if ((res
>> 28) == ALC880_HP_EVENT
)
1986 alc880_uniwill_p53_hp_automute(codec
);
1987 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
1988 alc880_uniwill_p53_dcvol_automute(codec
);
1992 * F1734 pin configuration:
1993 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1995 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
1996 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x01},
1997 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1998 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1999 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2000 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2002 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2003 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2004 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2007 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2008 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2009 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
2010 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2011 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2012 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2013 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2014 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2015 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2017 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
2018 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
2024 * ASUS pin configuration:
2025 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2027 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
2028 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
2029 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
2030 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
2031 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
2033 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2034 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2035 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2036 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2037 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2038 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2039 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2040 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2042 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2043 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2044 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2045 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2046 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2047 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2048 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2049 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2050 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2055 /* Enable GPIO mask and set output */
2056 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2057 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2059 /* Clevo m520g init */
2060 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
2061 /* headphone output */
2062 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2064 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2065 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2067 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2068 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2070 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2071 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2072 /* Mic1 (rear panel) */
2073 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2074 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2075 /* Mic2 (front panel) */
2076 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2077 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2079 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2080 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2081 /* change to EAPD mode */
2082 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2083 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2088 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
2089 /* change to EAPD mode */
2090 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2091 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2093 /* Headphone output */
2094 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2096 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2097 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
2099 /* Line In pin widget for input */
2100 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2101 /* CD pin widget for input */
2102 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2103 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2104 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2106 /* change to EAPD mode */
2107 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2108 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
2114 * LG m1 express dual
2117 * Rear Line-In/Out (blue): 0x14
2118 * Build-in Mic-In: 0x15
2120 * HP-Out (green): 0x1b
2121 * Mic-In/Out (red): 0x19
2125 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2126 static hda_nid_t alc880_lg_dac_nids
[3] = {
2130 /* seems analog CD is not working */
2131 static struct hda_input_mux alc880_lg_capture_source
= {
2136 { "Internal Mic", 0x6 },
2140 /* 2,4,6 channel modes */
2141 static struct hda_verb alc880_lg_ch2_init
[] = {
2142 /* set line-in and mic-in to input */
2143 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2144 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2148 static struct hda_verb alc880_lg_ch4_init
[] = {
2149 /* set line-in to out and mic-in to input */
2150 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2151 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2155 static struct hda_verb alc880_lg_ch6_init
[] = {
2156 /* set line-in and mic-in to output */
2157 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2158 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2162 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
2163 { 2, alc880_lg_ch2_init
},
2164 { 4, alc880_lg_ch4_init
},
2165 { 6, alc880_lg_ch6_init
},
2168 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
2169 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2170 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
2171 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2172 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
2173 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
2174 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
2175 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
2176 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
2177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2179 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
2180 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
2181 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
2182 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
2184 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2185 .name
= "Channel Mode",
2186 .info
= alc_ch_mode_info
,
2187 .get
= alc_ch_mode_get
,
2188 .put
= alc_ch_mode_put
,
2193 static struct hda_verb alc880_lg_init_verbs
[] = {
2194 /* set capture source to mic-in */
2195 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2196 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2197 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2198 /* mute all amp mixer inputs */
2199 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
2200 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2201 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2202 /* line-in to input */
2203 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2204 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2206 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2207 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2209 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2210 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2211 /* mic-in to input */
2212 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2213 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2214 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2216 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
2217 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2218 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2220 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2224 /* toggle speaker-output according to the hp-jack state */
2225 static void alc880_lg_automute(struct hda_codec
*codec
)
2227 unsigned int present
;
2230 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2231 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2232 bits
= present
? HDA_AMP_MUTE
: 0;
2233 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
2234 HDA_AMP_MUTE
, bits
);
2237 static void alc880_lg_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2239 /* Looks like the unsol event is incompatible with the standard
2240 * definition. 4bit tag is placed at 28 bit!
2242 if ((res
>> 28) == 0x01)
2243 alc880_lg_automute(codec
);
2252 * Built-in Mic-In: 0x19
2258 static struct hda_input_mux alc880_lg_lw_capture_source
= {
2262 { "Internal Mic", 0x1 },
2267 #define alc880_lg_lw_modes alc880_threestack_modes
2269 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
2270 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2271 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2272 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2273 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2274 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2275 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2276 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2277 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2278 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2279 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2281 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2282 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
2283 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
2285 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2286 .name
= "Channel Mode",
2287 .info
= alc_ch_mode_info
,
2288 .get
= alc_ch_mode_get
,
2289 .put
= alc_ch_mode_put
,
2294 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
2295 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2296 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2297 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2299 /* set capture source to mic-in */
2300 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2301 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2302 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2303 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2305 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2306 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2308 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2309 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2310 /* mic-in to input */
2311 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2312 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2314 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2315 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2317 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2321 /* toggle speaker-output according to the hp-jack state */
2322 static void alc880_lg_lw_automute(struct hda_codec
*codec
)
2324 unsigned int present
;
2327 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2328 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2329 bits
= present
? HDA_AMP_MUTE
: 0;
2330 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
2331 HDA_AMP_MUTE
, bits
);
2334 static void alc880_lg_lw_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2336 /* Looks like the unsol event is incompatible with the standard
2337 * definition. 4bit tag is placed at 28 bit!
2339 if ((res
>> 28) == 0x01)
2340 alc880_lg_lw_automute(codec
);
2343 static struct snd_kcontrol_new alc880_medion_rim_mixer
[] = {
2344 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2345 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
2346 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2347 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2348 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2349 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2353 static struct hda_input_mux alc880_medion_rim_capture_source
= {
2357 { "Internal Mic", 0x1 },
2361 static struct hda_verb alc880_medion_rim_init_verbs
[] = {
2362 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2364 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2365 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2367 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2368 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2369 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2370 /* Mic2 (as headphone out) for HP output */
2371 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2372 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2373 /* Internal Speaker */
2374 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2375 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2377 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2378 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2380 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
2384 /* toggle speaker-output according to the hp-jack state */
2385 static void alc880_medion_rim_automute(struct hda_codec
*codec
)
2387 unsigned int present
;
2390 present
= snd_hda_codec_read(codec
, 0x14, 0,
2391 AC_VERB_GET_PIN_SENSE
, 0)
2392 & AC_PINSENSE_PRESENCE
;
2393 bits
= present
? HDA_AMP_MUTE
: 0;
2394 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
2395 HDA_AMP_MUTE
, bits
);
2397 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 0);
2399 snd_hda_codec_write(codec
, 0x01, 0, AC_VERB_SET_GPIO_DATA
, 2);
2402 static void alc880_medion_rim_unsol_event(struct hda_codec
*codec
,
2405 /* Looks like the unsol event is incompatible with the standard
2406 * definition. 4bit tag is placed at 28 bit!
2408 if ((res
>> 28) == ALC880_HP_EVENT
)
2409 alc880_medion_rim_automute(codec
);
2412 #ifdef CONFIG_SND_HDA_POWER_SAVE
2413 static struct hda_amp_list alc880_loopbacks
[] = {
2414 { 0x0b, HDA_INPUT
, 0 },
2415 { 0x0b, HDA_INPUT
, 1 },
2416 { 0x0b, HDA_INPUT
, 2 },
2417 { 0x0b, HDA_INPUT
, 3 },
2418 { 0x0b, HDA_INPUT
, 4 },
2422 static struct hda_amp_list alc880_lg_loopbacks
[] = {
2423 { 0x0b, HDA_INPUT
, 1 },
2424 { 0x0b, HDA_INPUT
, 6 },
2425 { 0x0b, HDA_INPUT
, 7 },
2434 static int alc_init(struct hda_codec
*codec
)
2436 struct alc_spec
*spec
= codec
->spec
;
2441 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
2442 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
2444 if (spec
->init_hook
)
2445 spec
->init_hook(codec
);
2450 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2452 struct alc_spec
*spec
= codec
->spec
;
2454 if (spec
->unsol_event
)
2455 spec
->unsol_event(codec
, res
);
2458 #ifdef CONFIG_SND_HDA_POWER_SAVE
2459 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
2461 struct alc_spec
*spec
= codec
->spec
;
2462 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
2467 * Analog playback callbacks
2469 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2470 struct hda_codec
*codec
,
2471 struct snd_pcm_substream
*substream
)
2473 struct alc_spec
*spec
= codec
->spec
;
2474 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
2478 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2479 struct hda_codec
*codec
,
2480 unsigned int stream_tag
,
2481 unsigned int format
,
2482 struct snd_pcm_substream
*substream
)
2484 struct alc_spec
*spec
= codec
->spec
;
2485 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
2486 stream_tag
, format
, substream
);
2489 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2490 struct hda_codec
*codec
,
2491 struct snd_pcm_substream
*substream
)
2493 struct alc_spec
*spec
= codec
->spec
;
2494 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2500 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2501 struct hda_codec
*codec
,
2502 struct snd_pcm_substream
*substream
)
2504 struct alc_spec
*spec
= codec
->spec
;
2505 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2508 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2509 struct hda_codec
*codec
,
2510 unsigned int stream_tag
,
2511 unsigned int format
,
2512 struct snd_pcm_substream
*substream
)
2514 struct alc_spec
*spec
= codec
->spec
;
2515 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2516 stream_tag
, format
, substream
);
2519 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2520 struct hda_codec
*codec
,
2521 struct snd_pcm_substream
*substream
)
2523 struct alc_spec
*spec
= codec
->spec
;
2524 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2530 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2531 struct hda_codec
*codec
,
2532 unsigned int stream_tag
,
2533 unsigned int format
,
2534 struct snd_pcm_substream
*substream
)
2536 struct alc_spec
*spec
= codec
->spec
;
2538 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
2539 stream_tag
, 0, format
);
2543 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2544 struct hda_codec
*codec
,
2545 struct snd_pcm_substream
*substream
)
2547 struct alc_spec
*spec
= codec
->spec
;
2549 snd_hda_codec_cleanup_stream(codec
,
2550 spec
->adc_nids
[substream
->number
+ 1]);
2557 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
2561 /* NID is set in alc_build_pcms */
2563 .open
= alc880_playback_pcm_open
,
2564 .prepare
= alc880_playback_pcm_prepare
,
2565 .cleanup
= alc880_playback_pcm_cleanup
2569 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
2573 /* NID is set in alc_build_pcms */
2576 static struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
2580 /* NID is set in alc_build_pcms */
2583 static struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
2584 .substreams
= 2, /* can be overridden */
2587 /* NID is set in alc_build_pcms */
2589 .prepare
= alc880_alt_capture_pcm_prepare
,
2590 .cleanup
= alc880_alt_capture_pcm_cleanup
2594 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
2598 /* NID is set in alc_build_pcms */
2600 .open
= alc880_dig_playback_pcm_open
,
2601 .close
= alc880_dig_playback_pcm_close
,
2602 .prepare
= alc880_dig_playback_pcm_prepare
2606 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
2610 /* NID is set in alc_build_pcms */
2613 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2614 static struct hda_pcm_stream alc_pcm_null_stream
= {
2620 static int alc_build_pcms(struct hda_codec
*codec
)
2622 struct alc_spec
*spec
= codec
->spec
;
2623 struct hda_pcm
*info
= spec
->pcm_rec
;
2626 codec
->num_pcms
= 1;
2627 codec
->pcm_info
= info
;
2629 info
->name
= spec
->stream_name_analog
;
2630 if (spec
->stream_analog_playback
) {
2631 snd_assert(spec
->multiout
.dac_nids
, return -EINVAL
);
2632 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
2633 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
2635 if (spec
->stream_analog_capture
) {
2636 snd_assert(spec
->adc_nids
, return -EINVAL
);
2637 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
2638 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
2641 if (spec
->channel_mode
) {
2642 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
2643 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
2644 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
2645 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
2650 /* SPDIF for stream index #1 */
2651 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2652 codec
->num_pcms
= 2;
2653 info
= spec
->pcm_rec
+ 1;
2654 info
->name
= spec
->stream_name_digital
;
2655 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
2656 if (spec
->multiout
.dig_out_nid
&&
2657 spec
->stream_digital_playback
) {
2658 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
2659 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2661 if (spec
->dig_in_nid
&&
2662 spec
->stream_digital_capture
) {
2663 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
2664 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2668 /* If the use of more than one ADC is requested for the current
2669 * model, configure a second analog capture-only PCM.
2671 /* Additional Analaog capture for index #2 */
2672 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
2673 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
2674 codec
->num_pcms
= 3;
2675 info
= spec
->pcm_rec
+ 2;
2676 info
->name
= spec
->stream_name_analog
;
2677 if (spec
->alt_dac_nid
) {
2678 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
2679 *spec
->stream_analog_alt_playback
;
2680 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
2683 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
2684 alc_pcm_null_stream
;
2685 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
2687 if (spec
->num_adc_nids
> 1) {
2688 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
2689 *spec
->stream_analog_alt_capture
;
2690 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
2692 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
2693 spec
->num_adc_nids
- 1;
2695 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
2696 alc_pcm_null_stream
;
2697 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
2704 static void alc_free(struct hda_codec
*codec
)
2706 struct alc_spec
*spec
= codec
->spec
;
2712 if (spec
->kctl_alloc
) {
2713 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
2714 kfree(spec
->kctl_alloc
[i
].name
);
2715 kfree(spec
->kctl_alloc
);
2718 codec
->spec
= NULL
; /* to be sure */
2723 static struct hda_codec_ops alc_patch_ops
= {
2724 .build_controls
= alc_build_controls
,
2725 .build_pcms
= alc_build_pcms
,
2728 .unsol_event
= alc_unsol_event
,
2729 #ifdef CONFIG_SND_HDA_POWER_SAVE
2730 .check_power_status
= alc_check_power_status
,
2736 * Test configuration for debugging
2738 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2741 #ifdef CONFIG_SND_DEBUG
2742 static hda_nid_t alc880_test_dac_nids
[4] = {
2743 0x02, 0x03, 0x04, 0x05
2746 static struct hda_input_mux alc880_test_capture_source
= {
2755 { "Surround", 0x6 },
2759 static struct hda_channel_mode alc880_test_modes
[4] = {
2766 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
2767 struct snd_ctl_elem_info
*uinfo
)
2769 static char *texts
[] = {
2770 "N/A", "Line Out", "HP Out",
2771 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2773 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2775 uinfo
->value
.enumerated
.items
= 8;
2776 if (uinfo
->value
.enumerated
.item
>= 8)
2777 uinfo
->value
.enumerated
.item
= 7;
2778 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2782 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
2783 struct snd_ctl_elem_value
*ucontrol
)
2785 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2786 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2787 unsigned int pin_ctl
, item
= 0;
2789 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2790 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2791 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
2792 if (pin_ctl
& AC_PINCTL_HP_EN
)
2796 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
2797 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
2798 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
2799 case AC_PINCTL_VREF_50
: item
= 4; break;
2800 case AC_PINCTL_VREF_GRD
: item
= 5; break;
2801 case AC_PINCTL_VREF_80
: item
= 6; break;
2802 case AC_PINCTL_VREF_100
: item
= 7; break;
2805 ucontrol
->value
.enumerated
.item
[0] = item
;
2809 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
2810 struct snd_ctl_elem_value
*ucontrol
)
2812 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2813 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2814 static unsigned int ctls
[] = {
2815 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
2816 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
2817 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
2818 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
2819 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
2820 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
2822 unsigned int old_ctl
, new_ctl
;
2824 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2825 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2826 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
2827 if (old_ctl
!= new_ctl
) {
2829 snd_hda_codec_write_cache(codec
, nid
, 0,
2830 AC_VERB_SET_PIN_WIDGET_CONTROL
,
2832 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
2834 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
2841 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
2842 struct snd_ctl_elem_info
*uinfo
)
2844 static char *texts
[] = {
2845 "Front", "Surround", "CLFE", "Side"
2847 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2849 uinfo
->value
.enumerated
.items
= 4;
2850 if (uinfo
->value
.enumerated
.item
>= 4)
2851 uinfo
->value
.enumerated
.item
= 3;
2852 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2856 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
2857 struct snd_ctl_elem_value
*ucontrol
)
2859 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2860 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2863 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
2864 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
2868 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
2869 struct snd_ctl_elem_value
*ucontrol
)
2871 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2872 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2875 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
2876 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
2877 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
2878 snd_hda_codec_write_cache(codec
, nid
, 0,
2879 AC_VERB_SET_CONNECT_SEL
, sel
);
2885 #define PIN_CTL_TEST(xname,nid) { \
2886 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2888 .info = alc_test_pin_ctl_info, \
2889 .get = alc_test_pin_ctl_get, \
2890 .put = alc_test_pin_ctl_put, \
2891 .private_value = nid \
2894 #define PIN_SRC_TEST(xname,nid) { \
2895 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2897 .info = alc_test_pin_src_info, \
2898 .get = alc_test_pin_src_get, \
2899 .put = alc_test_pin_src_put, \
2900 .private_value = nid \
2903 static struct snd_kcontrol_new alc880_test_mixer
[] = {
2904 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2905 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2906 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
2907 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2908 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2909 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2910 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
2911 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2912 PIN_CTL_TEST("Front Pin Mode", 0x14),
2913 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2914 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2915 PIN_CTL_TEST("Side Pin Mode", 0x17),
2916 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2917 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2918 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2919 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2920 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2921 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2922 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2923 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2924 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2925 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2926 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2927 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2928 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
2929 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
2930 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2931 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2932 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
2933 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
2935 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2936 .name
= "Channel Mode",
2937 .info
= alc_ch_mode_info
,
2938 .get
= alc_ch_mode_get
,
2939 .put
= alc_ch_mode_put
,
2944 static struct hda_verb alc880_test_init_verbs
[] = {
2945 /* Unmute inputs of 0x0c - 0x0f */
2946 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2947 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2948 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2949 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2950 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2951 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2952 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2953 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2954 /* Vol output for 0x0c-0x0f */
2955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2956 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2957 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2958 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2959 /* Set output pins 0x14-0x17 */
2960 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2961 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2962 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2963 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2964 /* Unmute output pins 0x14-0x17 */
2965 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2966 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2967 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2968 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2969 /* Set input pins 0x18-0x1c */
2970 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2971 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2972 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2973 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2974 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2975 /* Mute input pins 0x18-0x1b */
2976 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2977 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2978 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2979 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2981 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2982 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2983 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2984 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2985 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2986 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2987 /* Analog input/passthru */
2988 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2989 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2990 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
2991 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
2992 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3000 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
3001 [ALC880_3ST
] = "3stack",
3002 [ALC880_TCL_S700
] = "tcl",
3003 [ALC880_3ST_DIG
] = "3stack-digout",
3004 [ALC880_CLEVO
] = "clevo",
3005 [ALC880_5ST
] = "5stack",
3006 [ALC880_5ST_DIG
] = "5stack-digout",
3007 [ALC880_W810
] = "w810",
3008 [ALC880_Z71V
] = "z71v",
3009 [ALC880_6ST
] = "6stack",
3010 [ALC880_6ST_DIG
] = "6stack-digout",
3011 [ALC880_ASUS
] = "asus",
3012 [ALC880_ASUS_W1V
] = "asus-w1v",
3013 [ALC880_ASUS_DIG
] = "asus-dig",
3014 [ALC880_ASUS_DIG2
] = "asus-dig2",
3015 [ALC880_UNIWILL_DIG
] = "uniwill",
3016 [ALC880_UNIWILL_P53
] = "uniwill-p53",
3017 [ALC880_FUJITSU
] = "fujitsu",
3018 [ALC880_F1734
] = "F1734",
3020 [ALC880_LG_LW
] = "lg-lw",
3021 [ALC880_MEDION_RIM
] = "medion",
3022 #ifdef CONFIG_SND_DEBUG
3023 [ALC880_TEST
] = "test",
3025 [ALC880_AUTO
] = "auto",
3028 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
3029 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
3030 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
3031 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
3032 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
3033 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
3034 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
3035 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
3036 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
3037 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
3038 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
3039 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
3040 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
3041 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
3042 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
3043 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
3044 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
3045 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
3046 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
3047 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3048 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
3049 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
3050 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG
),
3051 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
3052 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
3053 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
3054 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS
), /* default ASUS */
3055 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
3056 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
3057 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
3058 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
3059 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
3060 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
3061 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
3062 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
3063 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
3064 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
3065 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
3066 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
3067 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
3068 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
3069 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
3070 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
3071 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
3072 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
3073 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM
),
3074 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
3075 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
3076 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
3077 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU
),
3078 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL
),
3079 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
3080 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
3081 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
3082 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
3083 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
3084 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
3085 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
3086 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
3087 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
3088 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
3089 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
3090 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
3091 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
3092 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
3093 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
3094 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
3095 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
3096 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
3097 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST
), /* default Intel */
3098 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
3099 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
3104 * ALC880 codec presets
3106 static struct alc_config_preset alc880_presets
[] = {
3108 .mixers
= { alc880_three_stack_mixer
},
3109 .init_verbs
= { alc880_volume_init_verbs
,
3110 alc880_pin_3stack_init_verbs
},
3111 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3112 .dac_nids
= alc880_dac_nids
,
3113 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3114 .channel_mode
= alc880_threestack_modes
,
3116 .input_mux
= &alc880_capture_source
,
3118 [ALC880_3ST_DIG
] = {
3119 .mixers
= { alc880_three_stack_mixer
},
3120 .init_verbs
= { alc880_volume_init_verbs
,
3121 alc880_pin_3stack_init_verbs
},
3122 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3123 .dac_nids
= alc880_dac_nids
,
3124 .dig_out_nid
= ALC880_DIGOUT_NID
,
3125 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3126 .channel_mode
= alc880_threestack_modes
,
3128 .input_mux
= &alc880_capture_source
,
3130 [ALC880_TCL_S700
] = {
3131 .mixers
= { alc880_tcl_s700_mixer
},
3132 .init_verbs
= { alc880_volume_init_verbs
,
3133 alc880_pin_tcl_S700_init_verbs
,
3134 alc880_gpio2_init_verbs
},
3135 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3136 .dac_nids
= alc880_dac_nids
,
3138 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3139 .channel_mode
= alc880_2_jack_modes
,
3140 .input_mux
= &alc880_capture_source
,
3143 .mixers
= { alc880_three_stack_mixer
,
3144 alc880_five_stack_mixer
},
3145 .init_verbs
= { alc880_volume_init_verbs
,
3146 alc880_pin_5stack_init_verbs
},
3147 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3148 .dac_nids
= alc880_dac_nids
,
3149 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3150 .channel_mode
= alc880_fivestack_modes
,
3151 .input_mux
= &alc880_capture_source
,
3153 [ALC880_5ST_DIG
] = {
3154 .mixers
= { alc880_three_stack_mixer
,
3155 alc880_five_stack_mixer
},
3156 .init_verbs
= { alc880_volume_init_verbs
,
3157 alc880_pin_5stack_init_verbs
},
3158 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3159 .dac_nids
= alc880_dac_nids
,
3160 .dig_out_nid
= ALC880_DIGOUT_NID
,
3161 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3162 .channel_mode
= alc880_fivestack_modes
,
3163 .input_mux
= &alc880_capture_source
,
3166 .mixers
= { alc880_six_stack_mixer
},
3167 .init_verbs
= { alc880_volume_init_verbs
,
3168 alc880_pin_6stack_init_verbs
},
3169 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3170 .dac_nids
= alc880_6st_dac_nids
,
3171 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3172 .channel_mode
= alc880_sixstack_modes
,
3173 .input_mux
= &alc880_6stack_capture_source
,
3175 [ALC880_6ST_DIG
] = {
3176 .mixers
= { alc880_six_stack_mixer
},
3177 .init_verbs
= { alc880_volume_init_verbs
,
3178 alc880_pin_6stack_init_verbs
},
3179 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3180 .dac_nids
= alc880_6st_dac_nids
,
3181 .dig_out_nid
= ALC880_DIGOUT_NID
,
3182 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3183 .channel_mode
= alc880_sixstack_modes
,
3184 .input_mux
= &alc880_6stack_capture_source
,
3187 .mixers
= { alc880_w810_base_mixer
},
3188 .init_verbs
= { alc880_volume_init_verbs
,
3189 alc880_pin_w810_init_verbs
,
3190 alc880_gpio2_init_verbs
},
3191 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
3192 .dac_nids
= alc880_w810_dac_nids
,
3193 .dig_out_nid
= ALC880_DIGOUT_NID
,
3194 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3195 .channel_mode
= alc880_w810_modes
,
3196 .input_mux
= &alc880_capture_source
,
3199 .mixers
= { alc880_z71v_mixer
},
3200 .init_verbs
= { alc880_volume_init_verbs
,
3201 alc880_pin_z71v_init_verbs
},
3202 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
3203 .dac_nids
= alc880_z71v_dac_nids
,
3204 .dig_out_nid
= ALC880_DIGOUT_NID
,
3206 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3207 .channel_mode
= alc880_2_jack_modes
,
3208 .input_mux
= &alc880_capture_source
,
3211 .mixers
= { alc880_f1734_mixer
},
3212 .init_verbs
= { alc880_volume_init_verbs
,
3213 alc880_pin_f1734_init_verbs
},
3214 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
3215 .dac_nids
= alc880_f1734_dac_nids
,
3217 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3218 .channel_mode
= alc880_2_jack_modes
,
3219 .input_mux
= &alc880_f1734_capture_source
,
3220 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3221 .init_hook
= alc880_uniwill_p53_hp_automute
,
3224 .mixers
= { alc880_asus_mixer
},
3225 .init_verbs
= { alc880_volume_init_verbs
,
3226 alc880_pin_asus_init_verbs
,
3227 alc880_gpio1_init_verbs
},
3228 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3229 .dac_nids
= alc880_asus_dac_nids
,
3230 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3231 .channel_mode
= alc880_asus_modes
,
3233 .input_mux
= &alc880_capture_source
,
3235 [ALC880_ASUS_DIG
] = {
3236 .mixers
= { alc880_asus_mixer
},
3237 .init_verbs
= { alc880_volume_init_verbs
,
3238 alc880_pin_asus_init_verbs
,
3239 alc880_gpio1_init_verbs
},
3240 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3241 .dac_nids
= alc880_asus_dac_nids
,
3242 .dig_out_nid
= ALC880_DIGOUT_NID
,
3243 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3244 .channel_mode
= alc880_asus_modes
,
3246 .input_mux
= &alc880_capture_source
,
3248 [ALC880_ASUS_DIG2
] = {
3249 .mixers
= { alc880_asus_mixer
},
3250 .init_verbs
= { alc880_volume_init_verbs
,
3251 alc880_pin_asus_init_verbs
,
3252 alc880_gpio2_init_verbs
}, /* use GPIO2 */
3253 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3254 .dac_nids
= alc880_asus_dac_nids
,
3255 .dig_out_nid
= ALC880_DIGOUT_NID
,
3256 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3257 .channel_mode
= alc880_asus_modes
,
3259 .input_mux
= &alc880_capture_source
,
3261 [ALC880_ASUS_W1V
] = {
3262 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
3263 .init_verbs
= { alc880_volume_init_verbs
,
3264 alc880_pin_asus_init_verbs
,
3265 alc880_gpio1_init_verbs
},
3266 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3267 .dac_nids
= alc880_asus_dac_nids
,
3268 .dig_out_nid
= ALC880_DIGOUT_NID
,
3269 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3270 .channel_mode
= alc880_asus_modes
,
3272 .input_mux
= &alc880_capture_source
,
3274 [ALC880_UNIWILL_DIG
] = {
3275 .mixers
= { alc880_asus_mixer
, alc880_pcbeep_mixer
},
3276 .init_verbs
= { alc880_volume_init_verbs
,
3277 alc880_pin_asus_init_verbs
},
3278 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3279 .dac_nids
= alc880_asus_dac_nids
,
3280 .dig_out_nid
= ALC880_DIGOUT_NID
,
3281 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3282 .channel_mode
= alc880_asus_modes
,
3284 .input_mux
= &alc880_capture_source
,
3286 [ALC880_UNIWILL
] = {
3287 .mixers
= { alc880_uniwill_mixer
},
3288 .init_verbs
= { alc880_volume_init_verbs
,
3289 alc880_uniwill_init_verbs
},
3290 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3291 .dac_nids
= alc880_asus_dac_nids
,
3292 .dig_out_nid
= ALC880_DIGOUT_NID
,
3293 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3294 .channel_mode
= alc880_threestack_modes
,
3296 .input_mux
= &alc880_capture_source
,
3297 .unsol_event
= alc880_uniwill_unsol_event
,
3298 .init_hook
= alc880_uniwill_automute
,
3300 [ALC880_UNIWILL_P53
] = {
3301 .mixers
= { alc880_uniwill_p53_mixer
},
3302 .init_verbs
= { alc880_volume_init_verbs
,
3303 alc880_uniwill_p53_init_verbs
},
3304 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3305 .dac_nids
= alc880_asus_dac_nids
,
3306 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3307 .channel_mode
= alc880_threestack_modes
,
3308 .input_mux
= &alc880_capture_source
,
3309 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3310 .init_hook
= alc880_uniwill_p53_hp_automute
,
3312 [ALC880_FUJITSU
] = {
3313 .mixers
= { alc880_fujitsu_mixer
,
3314 alc880_pcbeep_mixer
, },
3315 .init_verbs
= { alc880_volume_init_verbs
,
3316 alc880_uniwill_p53_init_verbs
,
3317 alc880_beep_init_verbs
},
3318 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3319 .dac_nids
= alc880_dac_nids
,
3320 .dig_out_nid
= ALC880_DIGOUT_NID
,
3321 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3322 .channel_mode
= alc880_2_jack_modes
,
3323 .input_mux
= &alc880_capture_source
,
3324 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3325 .init_hook
= alc880_uniwill_p53_hp_automute
,
3328 .mixers
= { alc880_three_stack_mixer
},
3329 .init_verbs
= { alc880_volume_init_verbs
,
3330 alc880_pin_clevo_init_verbs
},
3331 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3332 .dac_nids
= alc880_dac_nids
,
3334 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3335 .channel_mode
= alc880_threestack_modes
,
3337 .input_mux
= &alc880_capture_source
,
3340 .mixers
= { alc880_lg_mixer
},
3341 .init_verbs
= { alc880_volume_init_verbs
,
3342 alc880_lg_init_verbs
},
3343 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
3344 .dac_nids
= alc880_lg_dac_nids
,
3345 .dig_out_nid
= ALC880_DIGOUT_NID
,
3346 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
3347 .channel_mode
= alc880_lg_ch_modes
,
3349 .input_mux
= &alc880_lg_capture_source
,
3350 .unsol_event
= alc880_lg_unsol_event
,
3351 .init_hook
= alc880_lg_automute
,
3352 #ifdef CONFIG_SND_HDA_POWER_SAVE
3353 .loopbacks
= alc880_lg_loopbacks
,
3357 .mixers
= { alc880_lg_lw_mixer
},
3358 .init_verbs
= { alc880_volume_init_verbs
,
3359 alc880_lg_lw_init_verbs
},
3360 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3361 .dac_nids
= alc880_dac_nids
,
3362 .dig_out_nid
= ALC880_DIGOUT_NID
,
3363 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
3364 .channel_mode
= alc880_lg_lw_modes
,
3365 .input_mux
= &alc880_lg_lw_capture_source
,
3366 .unsol_event
= alc880_lg_lw_unsol_event
,
3367 .init_hook
= alc880_lg_lw_automute
,
3369 [ALC880_MEDION_RIM
] = {
3370 .mixers
= { alc880_medion_rim_mixer
},
3371 .init_verbs
= { alc880_volume_init_verbs
,
3372 alc880_medion_rim_init_verbs
,
3373 alc_gpio2_init_verbs
},
3374 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3375 .dac_nids
= alc880_dac_nids
,
3376 .dig_out_nid
= ALC880_DIGOUT_NID
,
3377 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3378 .channel_mode
= alc880_2_jack_modes
,
3379 .input_mux
= &alc880_medion_rim_capture_source
,
3380 .unsol_event
= alc880_medion_rim_unsol_event
,
3381 .init_hook
= alc880_medion_rim_automute
,
3383 #ifdef CONFIG_SND_DEBUG
3385 .mixers
= { alc880_test_mixer
},
3386 .init_verbs
= { alc880_test_init_verbs
},
3387 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
3388 .dac_nids
= alc880_test_dac_nids
,
3389 .dig_out_nid
= ALC880_DIGOUT_NID
,
3390 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
3391 .channel_mode
= alc880_test_modes
,
3392 .input_mux
= &alc880_test_capture_source
,
3398 * Automatic parse of I/O pins from the BIOS configuration
3401 #define NUM_CONTROL_ALLOC 32
3402 #define NUM_VERB_ALLOC 32
3406 ALC_CTL_WIDGET_MUTE
,
3409 static struct snd_kcontrol_new alc880_control_templates
[] = {
3410 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
3411 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
3412 HDA_BIND_MUTE(NULL
, 0, 0, 0),
3415 /* add dynamic controls */
3416 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
3419 struct snd_kcontrol_new
*knew
;
3421 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
3422 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
3424 /* array + terminator */
3425 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
);
3428 if (spec
->kctl_alloc
) {
3429 memcpy(knew
, spec
->kctl_alloc
,
3430 sizeof(*knew
) * spec
->num_kctl_alloc
);
3431 kfree(spec
->kctl_alloc
);
3433 spec
->kctl_alloc
= knew
;
3434 spec
->num_kctl_alloc
= num
;
3437 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
3438 *knew
= alc880_control_templates
[type
];
3439 knew
->name
= kstrdup(name
, GFP_KERNEL
);
3442 knew
->private_value
= val
;
3443 spec
->num_kctl_used
++;
3447 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3448 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3449 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3450 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3451 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3452 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3453 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3454 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3455 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3456 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3457 #define ALC880_PIN_CD_NID 0x1c
3459 /* fill in the dac_nids table from the parsed pin configuration */
3460 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
3461 const struct auto_pin_cfg
*cfg
)
3467 memset(assigned
, 0, sizeof(assigned
));
3468 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
3470 /* check the pins hardwired to audio widget */
3471 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3472 nid
= cfg
->line_out_pins
[i
];
3473 if (alc880_is_fixed_pin(nid
)) {
3474 int idx
= alc880_fixed_pin_idx(nid
);
3475 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
3479 /* left pins can be connect to any 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
))
3484 /* search for an empty channel */
3485 for (j
= 0; j
< cfg
->line_outs
; j
++) {
3487 spec
->multiout
.dac_nids
[i
] =
3488 alc880_idx_to_dac(j
);
3494 spec
->multiout
.num_dacs
= cfg
->line_outs
;
3498 /* add playback controls from the parsed DAC table */
3499 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
3500 const struct auto_pin_cfg
*cfg
)
3503 static const char *chname
[4] = {
3504 "Front", "Surround", NULL
/*CLFE*/, "Side"
3509 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3510 if (!spec
->multiout
.dac_nids
[i
])
3512 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
3515 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3516 "Center Playback Volume",
3517 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
3521 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3522 "LFE Playback Volume",
3523 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
3527 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3528 "Center Playback Switch",
3529 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
3533 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3534 "LFE Playback Switch",
3535 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
3540 sprintf(name
, "%s Playback Volume", chname
[i
]);
3541 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3542 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
3546 sprintf(name
, "%s Playback Switch", chname
[i
]);
3547 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3548 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
3557 /* add playback controls for speaker and HP outputs */
3558 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
3568 if (alc880_is_fixed_pin(pin
)) {
3569 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
3570 /* specify the DAC as the extra output */
3571 if (!spec
->multiout
.hp_nid
)
3572 spec
->multiout
.hp_nid
= nid
;
3574 spec
->multiout
.extra_out_nid
[0] = nid
;
3575 /* control HP volume/switch on the output mixer amp */
3576 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
3577 sprintf(name
, "%s Playback Volume", pfx
);
3578 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3579 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
3582 sprintf(name
, "%s Playback Switch", pfx
);
3583 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3584 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
3587 } else if (alc880_is_multi_pin(pin
)) {
3588 /* set manual connection */
3589 /* we have only a switch on HP-out PIN */
3590 sprintf(name
, "%s Playback Switch", pfx
);
3591 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3592 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
3599 /* create input playback/capture controls for the given pin */
3600 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
3601 const char *ctlname
,
3602 int idx
, hda_nid_t mix_nid
)
3607 sprintf(name
, "%s Playback Volume", ctlname
);
3608 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3609 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3612 sprintf(name
, "%s Playback Switch", ctlname
);
3613 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3614 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3620 /* create playback/capture controls for input pins */
3621 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
3622 const struct auto_pin_cfg
*cfg
)
3624 struct hda_input_mux
*imux
= &spec
->private_imux
;
3627 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3628 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
3629 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
3630 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
3631 auto_pin_cfg_labels
[i
],
3635 imux
->items
[imux
->num_items
].label
=
3636 auto_pin_cfg_labels
[i
];
3637 imux
->items
[imux
->num_items
].index
=
3638 alc880_input_pin_idx(cfg
->input_pins
[i
]);
3645 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
3646 unsigned int pin_type
)
3648 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
3651 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
3655 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
3656 hda_nid_t nid
, int pin_type
,
3659 alc_set_pin_output(codec
, nid
, pin_type
);
3660 /* need the manual connection? */
3661 if (alc880_is_multi_pin(nid
)) {
3662 struct alc_spec
*spec
= codec
->spec
;
3663 int idx
= alc880_multi_pin_idx(nid
);
3664 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
3665 AC_VERB_SET_CONNECT_SEL
,
3666 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
3670 static int get_pin_type(int line_out_type
)
3672 if (line_out_type
== AUTO_PIN_HP_OUT
)
3678 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
3680 struct alc_spec
*spec
= codec
->spec
;
3683 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
3684 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
3685 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
3686 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
3687 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
3691 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
3693 struct alc_spec
*spec
= codec
->spec
;
3696 pin
= spec
->autocfg
.speaker_pins
[0];
3697 if (pin
) /* connect to front */
3698 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
3699 pin
= spec
->autocfg
.hp_pins
[0];
3700 if (pin
) /* connect to front */
3701 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
3704 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
3706 struct alc_spec
*spec
= codec
->spec
;
3709 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3710 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
3711 if (alc880_is_input_pin(nid
)) {
3712 snd_hda_codec_write(codec
, nid
, 0,
3713 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3714 i
<= AUTO_PIN_FRONT_MIC
?
3715 PIN_VREF80
: PIN_IN
);
3716 if (nid
!= ALC880_PIN_CD_NID
)
3717 snd_hda_codec_write(codec
, nid
, 0,
3718 AC_VERB_SET_AMP_GAIN_MUTE
,
3724 /* parse the BIOS configuration and set up the alc_spec */
3725 /* return 1 if successful, 0 if the proper config is not found,
3726 * or a negative error code
3728 static int alc880_parse_auto_config(struct hda_codec
*codec
)
3730 struct alc_spec
*spec
= codec
->spec
;
3732 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
3734 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
3738 if (!spec
->autocfg
.line_outs
)
3739 return 0; /* can't find valid BIOS pin config */
3741 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
3744 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
3747 err
= alc880_auto_create_extra_out(spec
,
3748 spec
->autocfg
.speaker_pins
[0],
3752 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
3756 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
3760 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
3762 if (spec
->autocfg
.dig_out_pin
)
3763 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
3764 if (spec
->autocfg
.dig_in_pin
)
3765 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
3767 if (spec
->kctl_alloc
)
3768 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3770 spec
->init_verbs
[spec
->num_init_verbs
++] = alc880_volume_init_verbs
;
3772 spec
->num_mux_defs
= 1;
3773 spec
->input_mux
= &spec
->private_imux
;
3778 /* additional initialization for auto-configuration model */
3779 static void alc880_auto_init(struct hda_codec
*codec
)
3781 struct alc_spec
*spec
= codec
->spec
;
3782 alc880_auto_init_multi_out(codec
);
3783 alc880_auto_init_extra_out(codec
);
3784 alc880_auto_init_analog_input(codec
);
3785 if (spec
->unsol_event
)
3786 alc_sku_automute(codec
);
3790 * OK, here we have finally the patch for ALC880
3793 static int patch_alc880(struct hda_codec
*codec
)
3795 struct alc_spec
*spec
;
3799 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3805 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
3808 if (board_config
< 0) {
3809 printk(KERN_INFO
"hda_codec: Unknown model for ALC880, "
3810 "trying auto-probe from BIOS...\n");
3811 board_config
= ALC880_AUTO
;
3814 if (board_config
== ALC880_AUTO
) {
3815 /* automatic parse from the BIOS config */
3816 err
= alc880_parse_auto_config(codec
);
3822 "hda_codec: Cannot set up configuration "
3823 "from BIOS. Using 3-stack mode...\n");
3824 board_config
= ALC880_3ST
;
3828 if (board_config
!= ALC880_AUTO
)
3829 setup_preset(spec
, &alc880_presets
[board_config
]);
3831 spec
->stream_name_analog
= "ALC880 Analog";
3832 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
3833 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
3834 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
3836 spec
->stream_name_digital
= "ALC880 Digital";
3837 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
3838 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
3840 if (!spec
->adc_nids
&& spec
->input_mux
) {
3841 /* check whether NID 0x07 is valid */
3842 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
3844 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
3845 if (wcap
!= AC_WID_AUD_IN
) {
3846 spec
->adc_nids
= alc880_adc_nids_alt
;
3847 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
3848 spec
->mixers
[spec
->num_mixers
] =
3849 alc880_capture_alt_mixer
;
3852 spec
->adc_nids
= alc880_adc_nids
;
3853 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
3854 spec
->mixers
[spec
->num_mixers
] = alc880_capture_mixer
;
3859 spec
->vmaster_nid
= 0x0c;
3861 codec
->patch_ops
= alc_patch_ops
;
3862 if (board_config
== ALC880_AUTO
)
3863 spec
->init_hook
= alc880_auto_init
;
3864 #ifdef CONFIG_SND_HDA_POWER_SAVE
3865 if (!spec
->loopback
.amplist
)
3866 spec
->loopback
.amplist
= alc880_loopbacks
;
3877 static hda_nid_t alc260_dac_nids
[1] = {
3882 static hda_nid_t alc260_adc_nids
[1] = {
3887 static hda_nid_t alc260_adc_nids_alt
[1] = {
3892 static hda_nid_t alc260_hp_adc_nids
[2] = {
3897 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3898 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3900 static hda_nid_t alc260_dual_adc_nids
[2] = {
3905 #define ALC260_DIGOUT_NID 0x03
3906 #define ALC260_DIGIN_NID 0x06
3908 static struct hda_input_mux alc260_capture_source
= {
3912 { "Front Mic", 0x1 },
3918 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3919 * headphone jack and the internal CD lines since these are the only pins at
3920 * which audio can appear. For flexibility, also allow the option of
3921 * recording the mixer output on the second ADC (ADC0 doesn't have a
3922 * connection to the mixer output).
3924 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
3928 { "Mic/Line", 0x0 },
3930 { "Headphone", 0x2 },
3936 { "Mic/Line", 0x0 },
3938 { "Headphone", 0x2 },
3945 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3946 * the Fujitsu S702x, but jacks are marked differently.
3948 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
3955 { "Headphone", 0x5 },
3964 { "Headphone", 0x6 },
3970 * This is just place-holder, so there's something for alc_build_pcms to look
3971 * at when it calculates the maximum number of channels. ALC260 has no mixer
3972 * element which allows changing the channel mode, so the verb list is
3975 static struct hda_channel_mode alc260_modes
[1] = {
3980 /* Mixer combinations
3982 * basic: base_output + input + pc_beep + capture
3983 * HP: base_output + input + capture_alt
3984 * HP_3013: hp_3013 + input + capture
3985 * fujitsu: fujitsu + capture
3986 * acer: acer + capture
3989 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
3990 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3991 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
3992 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3993 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
3994 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3995 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
3999 static struct snd_kcontrol_new alc260_input_mixer
[] = {
4000 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4001 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4002 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4003 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4004 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4005 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4006 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
4007 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
4011 static struct snd_kcontrol_new alc260_pc_beep_mixer
[] = {
4012 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT
),
4013 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT
),
4017 /* update HP, line and mono out pins according to the master switch */
4018 static void alc260_hp_master_update(struct hda_codec
*codec
,
4019 hda_nid_t hp
, hda_nid_t line
,
4022 struct alc_spec
*spec
= codec
->spec
;
4023 unsigned int val
= spec
->master_sw
? PIN_HP
: 0;
4024 /* change HP and line-out pins */
4025 snd_hda_codec_write(codec
, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4027 snd_hda_codec_write(codec
, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4029 /* mono (speaker) depending on the HP jack sense */
4030 val
= (val
&& !spec
->jack_present
) ? PIN_OUT
: 0;
4031 snd_hda_codec_write(codec
, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4035 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
4036 struct snd_ctl_elem_value
*ucontrol
)
4038 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4039 struct alc_spec
*spec
= codec
->spec
;
4040 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
4044 static int alc260_hp_master_sw_put(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 int val
= !!*ucontrol
->value
.integer
.value
;
4050 hda_nid_t hp
, line
, mono
;
4052 if (val
== spec
->master_sw
)
4054 spec
->master_sw
= val
;
4055 hp
= (kcontrol
->private_value
>> 16) & 0xff;
4056 line
= (kcontrol
->private_value
>> 8) & 0xff;
4057 mono
= kcontrol
->private_value
& 0xff;
4058 alc260_hp_master_update(codec
, hp
, line
, mono
);
4062 static struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
4064 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4065 .name
= "Master Playback Switch",
4066 .info
= snd_ctl_boolean_mono_info
,
4067 .get
= alc260_hp_master_sw_get
,
4068 .put
= alc260_hp_master_sw_put
,
4069 .private_value
= (0x0f << 16) | (0x10 << 8) | 0x11
4071 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4072 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
4073 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4074 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
4075 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4077 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4081 static struct hda_verb alc260_hp_unsol_verbs
[] = {
4082 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4086 static void alc260_hp_automute(struct hda_codec
*codec
)
4088 struct alc_spec
*spec
= codec
->spec
;
4089 unsigned int present
;
4091 present
= snd_hda_codec_read(codec
, 0x10, 0,
4092 AC_VERB_GET_PIN_SENSE
, 0);
4093 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4094 alc260_hp_master_update(codec
, 0x0f, 0x10, 0x11);
4097 static void alc260_hp_unsol_event(struct hda_codec
*codec
, unsigned int res
)
4099 if ((res
>> 26) == ALC880_HP_EVENT
)
4100 alc260_hp_automute(codec
);
4103 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
4105 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4106 .name
= "Master Playback Switch",
4107 .info
= snd_ctl_boolean_mono_info
,
4108 .get
= alc260_hp_master_sw_get
,
4109 .put
= alc260_hp_master_sw_put
,
4110 .private_value
= (0x10 << 16) | (0x15 << 8) | 0x11
4112 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4113 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
4114 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
4115 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
4116 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4117 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
4118 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4119 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
4123 static struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
4124 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4128 static void alc260_hp_3013_automute(struct hda_codec
*codec
)
4130 struct alc_spec
*spec
= codec
->spec
;
4131 unsigned int present
;
4133 present
= snd_hda_codec_read(codec
, 0x15, 0,
4134 AC_VERB_GET_PIN_SENSE
, 0);
4135 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
4136 alc260_hp_master_update(codec
, 0x10, 0x15, 0x11);
4139 static void alc260_hp_3013_unsol_event(struct hda_codec
*codec
,
4142 if ((res
>> 26) == ALC880_HP_EVENT
)
4143 alc260_hp_3013_automute(codec
);
4146 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4147 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4149 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
4150 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4151 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
4152 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4153 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4154 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4155 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
4156 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
4157 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4158 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4159 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4160 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4161 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
4165 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4166 * versions of the ALC260 don't act on requests to enable mic bias from NID
4167 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4168 * datasheet doesn't mention this restriction. At this stage it's not clear
4169 * whether this behaviour is intentional or is a hardware bug in chip
4170 * revisions available in early 2006. Therefore for now allow the
4171 * "Headphone Jack Mode" control to span all choices, but if it turns out
4172 * that the lack of mic bias for this NID is intentional we could change the
4173 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4175 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4176 * don't appear to make the mic bias available from the "line" jack, even
4177 * though the NID used for this jack (0x14) can supply it. The theory is
4178 * that perhaps Acer have included blocking capacitors between the ALC260
4179 * and the output jack. If this turns out to be the case for all such
4180 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4181 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4183 * The C20x Tablet series have a mono internal speaker which is controlled
4184 * via the chip's Mono sum widget and pin complex, so include the necessary
4185 * controls for such models. On models without a "mono speaker" the control
4186 * won't do anything.
4188 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
4189 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4190 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
4191 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
4192 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4194 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4196 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4197 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4199 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4200 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4201 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4202 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4203 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4204 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4205 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4209 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4210 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4212 static struct snd_kcontrol_new alc260_will_mixer
[] = {
4213 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4214 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
4215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4216 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4217 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4218 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4219 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4220 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4221 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4222 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4223 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4224 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4228 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4229 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4231 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
4232 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4233 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
4234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4235 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4236 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4237 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
4238 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
4239 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4240 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4241 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4245 /* capture mixer elements */
4246 static struct snd_kcontrol_new alc260_capture_mixer
[] = {
4247 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT
),
4248 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT
),
4249 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT
),
4250 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT
),
4252 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4253 /* The multiple "Capture Source" controls confuse alsamixer
4254 * So call somewhat different..
4256 /* .name = "Capture Source", */
4257 .name
= "Input Source",
4259 .info
= alc_mux_enum_info
,
4260 .get
= alc_mux_enum_get
,
4261 .put
= alc_mux_enum_put
,
4266 static struct snd_kcontrol_new alc260_capture_alt_mixer
[] = {
4267 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT
),
4268 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT
),
4270 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4271 /* The multiple "Capture Source" controls confuse alsamixer
4272 * So call somewhat different..
4274 /* .name = "Capture Source", */
4275 .name
= "Input Source",
4277 .info
= alc_mux_enum_info
,
4278 .get
= alc_mux_enum_get
,
4279 .put
= alc_mux_enum_put
,
4285 * initialization verbs
4287 static struct hda_verb alc260_init_verbs
[] = {
4288 /* Line In pin widget for input */
4289 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4290 /* CD pin widget for input */
4291 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4292 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4293 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4294 /* Mic2 (front panel) pin widget for input and vref at 80% */
4295 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4296 /* LINE-2 is used for line-out in rear */
4297 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4298 /* select line-out */
4299 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
4301 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4303 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4305 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4306 /* mute capture amp left and right */
4307 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4308 /* set connection select to line in (default select for this ADC) */
4309 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4310 /* mute capture amp left and right */
4311 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4312 /* set connection select to line in (default select for this ADC) */
4313 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
4314 /* set vol=0 Line-Out mixer amp left and right */
4315 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4316 /* unmute pin widget amp left and right (no gain on this amp) */
4317 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4318 /* set vol=0 HP mixer amp left and right */
4319 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4320 /* unmute pin widget amp left and right (no gain on this amp) */
4321 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4322 /* set vol=0 Mono mixer amp left and right */
4323 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4324 /* unmute pin widget amp left and right (no gain on this amp) */
4325 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4326 /* unmute LINE-2 out pin */
4327 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4328 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4331 /* mute analog inputs */
4332 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4333 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4334 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4336 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4337 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4338 /* mute Front out path */
4339 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4340 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4341 /* mute Headphone out path */
4342 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4343 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4344 /* mute Mono out path */
4345 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4346 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4350 #if 0 /* should be identical with alc260_init_verbs? */
4351 static struct hda_verb alc260_hp_init_verbs
[] = {
4352 /* Headphone and output */
4353 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
4355 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4356 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4357 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4358 /* Mic2 (front panel) pin widget for input and vref at 80% */
4359 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4360 /* Line In pin widget for input */
4361 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4362 /* Line-2 pin widget for output */
4363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4364 /* CD pin widget for input */
4365 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4366 /* unmute amp left and right */
4367 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
4368 /* set connection select to line in (default select for this ADC) */
4369 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4370 /* unmute Line-Out mixer amp left and right (volume = 0) */
4371 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4372 /* mute pin widget amp left and right (no gain on this amp) */
4373 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4374 /* unmute HP mixer amp left and right (volume = 0) */
4375 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4376 /* mute pin widget amp left and right (no gain on this amp) */
4377 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4378 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4381 /* mute analog inputs */
4382 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4383 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4386 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4387 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4388 /* Unmute Front out path */
4389 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4390 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4391 /* Unmute Headphone out path */
4392 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4393 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4394 /* Unmute Mono out path */
4395 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4396 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4401 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
4402 /* Line out and output */
4403 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4405 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4406 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4407 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4408 /* Mic2 (front panel) pin widget for input and vref at 80% */
4409 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4410 /* Line In pin widget for input */
4411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4412 /* Headphone pin widget for output */
4413 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
4414 /* CD pin widget for input */
4415 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4416 /* unmute amp left and right */
4417 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
4418 /* set connection select to line in (default select for this ADC) */
4419 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4420 /* unmute Line-Out mixer amp left and right (volume = 0) */
4421 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4422 /* mute pin widget amp left and right (no gain on this amp) */
4423 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4424 /* unmute HP mixer amp left and right (volume = 0) */
4425 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4426 /* mute pin widget amp left and right (no gain on this amp) */
4427 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4428 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4431 /* mute analog inputs */
4432 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4433 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4434 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4435 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4436 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4437 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4438 /* Unmute Front out path */
4439 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4440 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4441 /* Unmute Headphone out path */
4442 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4443 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4444 /* Unmute Mono out path */
4445 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4446 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4450 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4451 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4452 * audio = 0x16, internal speaker = 0x10.
4454 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
4455 /* Disable all GPIOs */
4456 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
4457 /* Internal speaker is connected to headphone pin */
4458 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4459 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4460 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4461 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4462 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4463 /* Ensure all other unused pins are disabled and muted. */
4464 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4465 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4466 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4467 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4468 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4469 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4470 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4471 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4473 /* Disable digital (SPDIF) pins */
4474 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4475 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4477 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4478 * when acting as an output.
4480 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4482 /* Start with output sum widgets muted and their output gains at min */
4483 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4484 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4485 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4486 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4487 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4488 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4489 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4490 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4491 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4493 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4494 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4495 /* Unmute Line1 pin widget output buffer since it starts as an output.
4496 * If the pin mode is changed by the user the pin mode control will
4497 * take care of enabling the pin's input/output buffers as needed.
4498 * Therefore there's no need to enable the input buffer at this
4501 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4502 /* Unmute input buffer of pin widget used for Line-in (no equiv
4505 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4507 /* Mute capture amp left and right */
4508 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4509 /* Set ADC connection select to match default mixer setting - line
4512 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4514 /* Do the same for the second ADC: mute capture input amp and
4515 * set ADC connection to line in (on mic1 pin)
4517 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4518 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4520 /* Mute all inputs to mixer widget (even unconnected ones) */
4521 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4522 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4523 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4524 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4525 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4526 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4527 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4533 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4534 * similar laptops (adapted from Fujitsu init verbs).
4536 static struct hda_verb alc260_acer_init_verbs
[] = {
4537 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4538 * the headphone jack. Turn this on and rely on the standard mute
4539 * methods whenever the user wants to turn these outputs off.
4541 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4542 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4543 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
4544 /* Internal speaker/Headphone jack is connected to Line-out pin */
4545 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4546 /* Internal microphone/Mic jack is connected to Mic1 pin */
4547 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
4548 /* Line In jack is connected to Line1 pin */
4549 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4550 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4551 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4552 /* Ensure all other unused pins are disabled and muted. */
4553 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4554 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4555 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4556 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4557 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4559 /* Disable digital (SPDIF) pins */
4560 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4561 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4563 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4564 * bus when acting as outputs.
4566 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4567 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4569 /* Start with output sum widgets muted and their output gains at min */
4570 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4571 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4572 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4573 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4575 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4576 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4577 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4578 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4580 /* Unmute Line-out pin widget amp left and right
4581 * (no equiv mixer ctrl)
4583 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4584 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4585 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4586 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4587 * inputs. If the pin mode is changed by the user the pin mode control
4588 * will take care of enabling the pin's input/output buffers as needed.
4589 * Therefore there's no need to enable the input buffer at this
4592 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4593 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4595 /* Mute capture amp left and right */
4596 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4597 /* Set ADC connection select to match default mixer setting - mic
4600 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4602 /* Do similar with the second ADC: mute capture input amp and
4603 * set ADC connection to mic to match ALSA's default state.
4605 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4606 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4608 /* Mute all inputs to mixer widget (even unconnected ones) */
4609 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4610 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4612 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4621 static struct hda_verb alc260_will_verbs
[] = {
4622 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4623 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
4624 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
4625 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4626 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4627 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
4631 static struct hda_verb alc260_replacer_672v_verbs
[] = {
4632 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4633 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4634 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
4636 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4637 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4638 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4640 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4644 /* toggle speaker-output according to the hp-jack state */
4645 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
4647 unsigned int present
;
4649 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4650 present
= snd_hda_codec_read(codec
, 0x0f, 0,
4651 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
4653 snd_hda_codec_write_cache(codec
, 0x01, 0,
4654 AC_VERB_SET_GPIO_DATA
, 1);
4655 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4656 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4659 snd_hda_codec_write_cache(codec
, 0x01, 0,
4660 AC_VERB_SET_GPIO_DATA
, 0);
4661 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4662 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4667 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
4670 if ((res
>> 26) == ALC880_HP_EVENT
)
4671 alc260_replacer_672v_automute(codec
);
4674 /* Test configuration for debugging, modelled after the ALC880 test
4677 #ifdef CONFIG_SND_DEBUG
4678 static hda_nid_t alc260_test_dac_nids
[1] = {
4681 static hda_nid_t alc260_test_adc_nids
[2] = {
4684 /* For testing the ALC260, each input MUX needs its own definition since
4685 * the signal assignments are different. This assumes that the first ADC
4688 static struct hda_input_mux alc260_test_capture_sources
[2] = {
4692 { "MIC1 pin", 0x0 },
4693 { "MIC2 pin", 0x1 },
4694 { "LINE1 pin", 0x2 },
4695 { "LINE2 pin", 0x3 },
4697 { "LINE-OUT pin", 0x5 },
4698 { "HP-OUT pin", 0x6 },
4704 { "MIC1 pin", 0x0 },
4705 { "MIC2 pin", 0x1 },
4706 { "LINE1 pin", 0x2 },
4707 { "LINE2 pin", 0x3 },
4710 { "LINE-OUT pin", 0x6 },
4711 { "HP-OUT pin", 0x7 },
4715 static struct snd_kcontrol_new alc260_test_mixer
[] = {
4716 /* Output driver widgets */
4717 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4718 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4719 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4720 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
4721 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4722 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
4724 /* Modes for retasking pin widgets
4725 * Note: the ALC260 doesn't seem to act on requests to enable mic
4726 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4727 * mention this restriction. At this stage it's not clear whether
4728 * this behaviour is intentional or is a hardware bug in chip
4729 * revisions available at least up until early 2006. Therefore for
4730 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4731 * choices, but if it turns out that the lack of mic bias for these
4732 * NIDs is intentional we could change their modes from
4733 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4735 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
4736 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
4737 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
4738 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
4739 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
4740 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
4742 /* Loopback mixer controls */
4743 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
4744 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
4745 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
4746 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
4747 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
4748 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
4749 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
4750 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
4751 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4752 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4753 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4754 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4755 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
4756 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
4757 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
4758 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
4760 /* Controls for GPIO pins, assuming they are configured as outputs */
4761 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4762 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4763 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4764 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4766 /* Switches to allow the digital IO pins to be enabled. The datasheet
4767 * is ambigious as to which NID is which; testing on laptops which
4768 * make this output available should provide clarification.
4770 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4771 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4773 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4774 * this output to turn on an external amplifier.
4776 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4777 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4781 static struct hda_verb alc260_test_init_verbs
[] = {
4782 /* Enable all GPIOs as outputs with an initial value of 0 */
4783 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
4784 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4785 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
4787 /* Enable retasking pins as output, initially without power amp */
4788 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4789 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4790 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4791 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4792 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4793 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4795 /* Disable digital (SPDIF) pins initially, but users can enable
4796 * them via a mixer switch. In the case of SPDIF-out, this initverb
4797 * payload also sets the generation to 0, output to be in "consumer"
4798 * PCM format, copyright asserted, no pre-emphasis and no validity
4801 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4802 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4804 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4805 * OUT1 sum bus when acting as an output.
4807 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4808 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
4809 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4810 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
4812 /* Start with output sum widgets muted and their output gains at min */
4813 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4814 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4815 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4816 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4817 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4818 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4819 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4820 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4821 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4823 /* Unmute retasking pin widget output buffers since the default
4824 * state appears to be output. As the pin mode is changed by the
4825 * user the pin mode control will take care of enabling the pin's
4826 * input/output buffers as needed.
4828 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4829 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4830 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4831 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4832 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4833 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4834 /* Also unmute the mono-out pin widget */
4835 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4837 /* Mute capture amp left and right */
4838 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4839 /* Set ADC connection select to match default mixer setting (mic1
4842 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4844 /* Do the same for the second ADC: mute capture input amp and
4845 * set ADC connection to mic1 pin
4847 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4848 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4850 /* Mute all inputs to mixer widget (even unconnected ones) */
4851 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4852 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4854 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4855 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4856 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4864 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4865 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4867 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4868 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4871 * for BIOS auto-configuration
4874 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
4878 unsigned long vol_val
, sw_val
;
4882 if (nid
>= 0x0f && nid
< 0x11) {
4883 nid_vol
= nid
- 0x7;
4884 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
4885 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4886 } else if (nid
== 0x11) {
4887 nid_vol
= nid
- 0x7;
4888 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
4889 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
4890 } else if (nid
>= 0x12 && nid
<= 0x15) {
4892 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
4893 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4897 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
4898 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
);
4901 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
4902 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
);
4908 /* add playback controls from the parsed DAC table */
4909 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
4910 const struct auto_pin_cfg
*cfg
)
4915 spec
->multiout
.num_dacs
= 1;
4916 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
4917 spec
->multiout
.dac_nids
[0] = 0x02;
4919 nid
= cfg
->line_out_pins
[0];
4921 err
= alc260_add_playback_controls(spec
, nid
, "Front");
4926 nid
= cfg
->speaker_pins
[0];
4928 err
= alc260_add_playback_controls(spec
, nid
, "Speaker");
4933 nid
= cfg
->hp_pins
[0];
4935 err
= alc260_add_playback_controls(spec
, nid
, "Headphone");
4942 /* create playback/capture controls for input pins */
4943 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
4944 const struct auto_pin_cfg
*cfg
)
4946 struct hda_input_mux
*imux
= &spec
->private_imux
;
4949 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4950 if (cfg
->input_pins
[i
] >= 0x12) {
4951 idx
= cfg
->input_pins
[i
] - 0x12;
4952 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4953 auto_pin_cfg_labels
[i
], idx
,
4957 imux
->items
[imux
->num_items
].label
=
4958 auto_pin_cfg_labels
[i
];
4959 imux
->items
[imux
->num_items
].index
= idx
;
4962 if (cfg
->input_pins
[i
] >= 0x0f && cfg
->input_pins
[i
] <= 0x10){
4963 idx
= cfg
->input_pins
[i
] - 0x09;
4964 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4965 auto_pin_cfg_labels
[i
], idx
,
4969 imux
->items
[imux
->num_items
].label
=
4970 auto_pin_cfg_labels
[i
];
4971 imux
->items
[imux
->num_items
].index
= idx
;
4978 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
4979 hda_nid_t nid
, int pin_type
,
4982 alc_set_pin_output(codec
, nid
, pin_type
);
4983 /* need the manual connection? */
4985 int idx
= nid
- 0x12;
4986 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
4987 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
4991 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
4993 struct alc_spec
*spec
= codec
->spec
;
4996 alc_subsystem_id(codec
, 0x10, 0x15, 0x0f);
4997 nid
= spec
->autocfg
.line_out_pins
[0];
4999 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5000 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
5003 nid
= spec
->autocfg
.speaker_pins
[0];
5005 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
5007 nid
= spec
->autocfg
.hp_pins
[0];
5009 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
5012 #define ALC260_PIN_CD_NID 0x16
5013 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
5015 struct alc_spec
*spec
= codec
->spec
;
5018 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5019 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5021 snd_hda_codec_write(codec
, nid
, 0,
5022 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5023 i
<= AUTO_PIN_FRONT_MIC
?
5024 PIN_VREF80
: PIN_IN
);
5025 if (nid
!= ALC260_PIN_CD_NID
)
5026 snd_hda_codec_write(codec
, nid
, 0,
5027 AC_VERB_SET_AMP_GAIN_MUTE
,
5034 * generic initialization of ADC, input mixers and output mixers
5036 static struct hda_verb alc260_volume_init_verbs
[] = {
5038 * Unmute ADC0-1 and set the default input to mic-in
5040 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
5041 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5042 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
5043 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5045 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5047 * Note: PASD motherboards uses the Line In 2 as the input for
5048 * front panel mic (mic 2)
5050 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5051 /* mute analog inputs */
5052 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5053 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5054 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5055 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5056 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5059 * Set up output mixers (0x08 - 0x0a)
5061 /* set vol=0 to output mixers */
5062 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5063 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5064 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5065 /* set up input amps for analog loopback */
5066 /* Amp Indices: DAC = 0, mixer = 1 */
5067 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5068 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5069 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5070 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5071 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5072 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5077 static int alc260_parse_auto_config(struct hda_codec
*codec
)
5079 struct alc_spec
*spec
= codec
->spec
;
5082 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
5084 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5088 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
5091 if (!spec
->kctl_alloc
)
5092 return 0; /* can't find valid BIOS pin config */
5093 err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
5097 spec
->multiout
.max_channels
= 2;
5099 if (spec
->autocfg
.dig_out_pin
)
5100 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
5101 if (spec
->kctl_alloc
)
5102 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
5104 spec
->init_verbs
[spec
->num_init_verbs
++] = alc260_volume_init_verbs
;
5106 spec
->num_mux_defs
= 1;
5107 spec
->input_mux
= &spec
->private_imux
;
5109 /* check whether NID 0x04 is valid */
5110 wcap
= get_wcaps(codec
, 0x04);
5111 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
5112 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
5113 spec
->adc_nids
= alc260_adc_nids_alt
;
5114 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
5115 spec
->mixers
[spec
->num_mixers
] = alc260_capture_alt_mixer
;
5117 spec
->adc_nids
= alc260_adc_nids
;
5118 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
5119 spec
->mixers
[spec
->num_mixers
] = alc260_capture_mixer
;
5126 /* additional initialization for auto-configuration model */
5127 static void alc260_auto_init(struct hda_codec
*codec
)
5129 struct alc_spec
*spec
= codec
->spec
;
5130 alc260_auto_init_multi_out(codec
);
5131 alc260_auto_init_analog_input(codec
);
5132 if (spec
->unsol_event
)
5133 alc_sku_automute(codec
);
5136 #ifdef CONFIG_SND_HDA_POWER_SAVE
5137 static struct hda_amp_list alc260_loopbacks
[] = {
5138 { 0x07, HDA_INPUT
, 0 },
5139 { 0x07, HDA_INPUT
, 1 },
5140 { 0x07, HDA_INPUT
, 2 },
5141 { 0x07, HDA_INPUT
, 3 },
5142 { 0x07, HDA_INPUT
, 4 },
5148 * ALC260 configurations
5150 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
5151 [ALC260_BASIC
] = "basic",
5153 [ALC260_HP_3013
] = "hp-3013",
5154 [ALC260_FUJITSU_S702X
] = "fujitsu",
5155 [ALC260_ACER
] = "acer",
5156 [ALC260_WILL
] = "will",
5157 [ALC260_REPLACER_672V
] = "replacer",
5158 #ifdef CONFIG_SND_DEBUG
5159 [ALC260_TEST
] = "test",
5161 [ALC260_AUTO
] = "auto",
5164 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
5165 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
5166 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
5167 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
5168 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013
),
5169 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
5170 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP
),
5171 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013
),
5172 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
5173 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
5174 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
5175 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
5176 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
5177 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
5178 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
5179 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
5180 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
5181 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
5182 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
5186 static struct alc_config_preset alc260_presets
[] = {
5188 .mixers
= { alc260_base_output_mixer
,
5190 alc260_pc_beep_mixer
,
5191 alc260_capture_mixer
},
5192 .init_verbs
= { alc260_init_verbs
},
5193 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5194 .dac_nids
= alc260_dac_nids
,
5195 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5196 .adc_nids
= alc260_adc_nids
,
5197 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5198 .channel_mode
= alc260_modes
,
5199 .input_mux
= &alc260_capture_source
,
5202 .mixers
= { alc260_hp_output_mixer
,
5204 alc260_capture_alt_mixer
},
5205 .init_verbs
= { alc260_init_verbs
,
5206 alc260_hp_unsol_verbs
},
5207 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5208 .dac_nids
= alc260_dac_nids
,
5209 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
5210 .adc_nids
= alc260_hp_adc_nids
,
5211 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5212 .channel_mode
= alc260_modes
,
5213 .input_mux
= &alc260_capture_source
,
5214 .unsol_event
= alc260_hp_unsol_event
,
5215 .init_hook
= alc260_hp_automute
,
5217 [ALC260_HP_3013
] = {
5218 .mixers
= { alc260_hp_3013_mixer
,
5220 alc260_capture_alt_mixer
},
5221 .init_verbs
= { alc260_hp_3013_init_verbs
,
5222 alc260_hp_3013_unsol_verbs
},
5223 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5224 .dac_nids
= alc260_dac_nids
,
5225 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
5226 .adc_nids
= alc260_hp_adc_nids
,
5227 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5228 .channel_mode
= alc260_modes
,
5229 .input_mux
= &alc260_capture_source
,
5230 .unsol_event
= alc260_hp_3013_unsol_event
,
5231 .init_hook
= alc260_hp_3013_automute
,
5233 [ALC260_FUJITSU_S702X
] = {
5234 .mixers
= { alc260_fujitsu_mixer
,
5235 alc260_capture_mixer
},
5236 .init_verbs
= { alc260_fujitsu_init_verbs
},
5237 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5238 .dac_nids
= alc260_dac_nids
,
5239 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5240 .adc_nids
= alc260_dual_adc_nids
,
5241 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5242 .channel_mode
= alc260_modes
,
5243 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
5244 .input_mux
= alc260_fujitsu_capture_sources
,
5247 .mixers
= { alc260_acer_mixer
,
5248 alc260_capture_mixer
},
5249 .init_verbs
= { alc260_acer_init_verbs
},
5250 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5251 .dac_nids
= alc260_dac_nids
,
5252 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5253 .adc_nids
= alc260_dual_adc_nids
,
5254 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5255 .channel_mode
= alc260_modes
,
5256 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
5257 .input_mux
= alc260_acer_capture_sources
,
5260 .mixers
= { alc260_will_mixer
,
5261 alc260_capture_mixer
},
5262 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
5263 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5264 .dac_nids
= alc260_dac_nids
,
5265 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5266 .adc_nids
= alc260_adc_nids
,
5267 .dig_out_nid
= ALC260_DIGOUT_NID
,
5268 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5269 .channel_mode
= alc260_modes
,
5270 .input_mux
= &alc260_capture_source
,
5272 [ALC260_REPLACER_672V
] = {
5273 .mixers
= { alc260_replacer_672v_mixer
,
5274 alc260_capture_mixer
},
5275 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
5276 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5277 .dac_nids
= alc260_dac_nids
,
5278 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5279 .adc_nids
= alc260_adc_nids
,
5280 .dig_out_nid
= ALC260_DIGOUT_NID
,
5281 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5282 .channel_mode
= alc260_modes
,
5283 .input_mux
= &alc260_capture_source
,
5284 .unsol_event
= alc260_replacer_672v_unsol_event
,
5285 .init_hook
= alc260_replacer_672v_automute
,
5287 #ifdef CONFIG_SND_DEBUG
5289 .mixers
= { alc260_test_mixer
,
5290 alc260_capture_mixer
},
5291 .init_verbs
= { alc260_test_init_verbs
},
5292 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
5293 .dac_nids
= alc260_test_dac_nids
,
5294 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
5295 .adc_nids
= alc260_test_adc_nids
,
5296 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5297 .channel_mode
= alc260_modes
,
5298 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
5299 .input_mux
= alc260_test_capture_sources
,
5304 static int patch_alc260(struct hda_codec
*codec
)
5306 struct alc_spec
*spec
;
5307 int err
, board_config
;
5309 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5315 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
5318 if (board_config
< 0) {
5319 snd_printd(KERN_INFO
"hda_codec: Unknown model for ALC260, "
5320 "trying auto-probe from BIOS...\n");
5321 board_config
= ALC260_AUTO
;
5324 if (board_config
== ALC260_AUTO
) {
5325 /* automatic parse from the BIOS config */
5326 err
= alc260_parse_auto_config(codec
);
5332 "hda_codec: Cannot set up configuration "
5333 "from BIOS. Using base mode...\n");
5334 board_config
= ALC260_BASIC
;
5338 if (board_config
!= ALC260_AUTO
)
5339 setup_preset(spec
, &alc260_presets
[board_config
]);
5341 spec
->stream_name_analog
= "ALC260 Analog";
5342 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
5343 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
5345 spec
->stream_name_digital
= "ALC260 Digital";
5346 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
5347 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
5349 spec
->vmaster_nid
= 0x08;
5351 codec
->patch_ops
= alc_patch_ops
;
5352 if (board_config
== ALC260_AUTO
)
5353 spec
->init_hook
= alc260_auto_init
;
5354 #ifdef CONFIG_SND_HDA_POWER_SAVE
5355 if (!spec
->loopback
.amplist
)
5356 spec
->loopback
.amplist
= alc260_loopbacks
;
5366 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5367 * configuration. Each pin widget can choose any input DACs and a mixer.
5368 * Each ADC is connected from a mixer of all inputs. This makes possible
5369 * 6-channel independent captures.
5371 * In addition, an independent DAC for the multi-playback (not used in this
5374 #define ALC882_DIGOUT_NID 0x06
5375 #define ALC882_DIGIN_NID 0x0a
5377 static struct hda_channel_mode alc882_ch_modes
[1] = {
5381 static hda_nid_t alc882_dac_nids
[4] = {
5382 /* front, rear, clfe, rear_surr */
5383 0x02, 0x03, 0x04, 0x05
5386 /* identical with ALC880 */
5387 #define alc882_adc_nids alc880_adc_nids
5388 #define alc882_adc_nids_alt alc880_adc_nids_alt
5390 static hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
5391 static hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
5394 /* FIXME: should be a matrix-type input source selection */
5396 static struct hda_input_mux alc882_capture_source
= {
5400 { "Front Mic", 0x1 },
5405 #define alc882_mux_enum_info alc_mux_enum_info
5406 #define alc882_mux_enum_get alc_mux_enum_get
5408 static int alc882_mux_enum_put(struct snd_kcontrol
*kcontrol
,
5409 struct snd_ctl_elem_value
*ucontrol
)
5411 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5412 struct alc_spec
*spec
= codec
->spec
;
5413 const struct hda_input_mux
*imux
= spec
->input_mux
;
5414 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
5415 hda_nid_t nid
= spec
->capsrc_nids
?
5416 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
5417 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
5418 unsigned int i
, idx
;
5420 idx
= ucontrol
->value
.enumerated
.item
[0];
5421 if (idx
>= imux
->num_items
)
5422 idx
= imux
->num_items
- 1;
5423 if (*cur_val
== idx
)
5425 for (i
= 0; i
< imux
->num_items
; i
++) {
5426 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
5427 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
5428 imux
->items
[i
].index
,
5438 static struct hda_verb alc882_3ST_ch2_init
[] = {
5439 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5440 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5441 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5442 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5449 static struct hda_verb alc882_3ST_ch6_init
[] = {
5450 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5451 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5452 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
5453 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5454 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5455 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5459 static struct hda_channel_mode alc882_3ST_6ch_modes
[2] = {
5460 { 2, alc882_3ST_ch2_init
},
5461 { 6, alc882_3ST_ch6_init
},
5467 static struct hda_verb alc882_sixstack_ch6_init
[] = {
5468 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
5469 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5470 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5471 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5478 static struct hda_verb alc882_sixstack_ch8_init
[] = {
5479 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5480 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5481 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5482 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5486 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
5487 { 6, alc882_sixstack_ch6_init
},
5488 { 8, alc882_sixstack_ch8_init
},
5492 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5498 static struct hda_verb alc885_mbp_ch2_init
[] = {
5499 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5500 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5501 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5508 static struct hda_verb alc885_mbp_ch6_init
[] = {
5509 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5510 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5511 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5512 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5513 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5517 static struct hda_channel_mode alc885_mbp_6ch_modes
[2] = {
5518 { 2, alc885_mbp_ch2_init
},
5519 { 6, alc885_mbp_ch6_init
},
5523 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5524 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5526 static struct snd_kcontrol_new alc882_base_mixer
[] = {
5527 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5528 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5529 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5530 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5531 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5532 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5533 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5534 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5535 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
5536 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
5537 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5538 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5539 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5540 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5541 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5542 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5543 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5544 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5545 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5546 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5547 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5548 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5549 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5553 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
5554 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
5555 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
5556 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT
),
5557 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
5558 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5559 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5560 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
5561 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
5562 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT
),
5563 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
5566 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
5567 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5568 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5569 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5570 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5571 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5572 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5573 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5574 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5575 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5576 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5577 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5581 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
5582 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5583 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5584 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5585 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5586 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5587 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5588 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5589 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5590 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5591 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5592 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5593 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5594 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5598 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5599 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5601 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
5602 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5603 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5604 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5605 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
5606 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5607 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5608 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5609 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5610 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
5611 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
5612 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5613 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5614 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5618 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
5619 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5620 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5621 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5622 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5623 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5624 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5625 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5627 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5628 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5629 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5630 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5634 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
5636 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5637 .name
= "Channel Mode",
5638 .info
= alc_ch_mode_info
,
5639 .get
= alc_ch_mode_get
,
5640 .put
= alc_ch_mode_put
,
5645 static struct hda_verb alc882_init_verbs
[] = {
5646 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5647 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5648 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5649 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5651 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5652 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5653 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5655 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5656 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5657 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5659 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5660 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5661 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5663 /* Front Pin: output 0 (0x0c) */
5664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5665 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5666 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5667 /* Rear Pin: output 1 (0x0d) */
5668 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5669 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5670 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5671 /* CLFE Pin: output 2 (0x0e) */
5672 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5673 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5674 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
5675 /* Side Pin: output 3 (0x0f) */
5676 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5677 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5678 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
5679 /* Mic (rear) pin: input vref at 80% */
5680 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5681 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5682 /* Front Mic pin: input vref at 80% */
5683 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5684 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5685 /* Line In pin: input */
5686 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5687 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5688 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5689 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5690 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5691 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5692 /* CD pin widget for input */
5693 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5695 /* FIXME: use matrix-type input source selection */
5696 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5697 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5700 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5701 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5703 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5704 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5705 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5706 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5708 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5710 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5711 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5712 /* ADC1: mute amp left and right */
5713 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5714 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5715 /* ADC2: mute amp left and right */
5716 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5717 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5718 /* ADC3: mute amp left and right */
5719 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5720 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5725 static struct hda_verb alc882_eapd_verbs
[] = {
5726 /* change to EAPD mode */
5727 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
5728 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
5733 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
5734 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5735 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5736 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
5737 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5738 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5739 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5740 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5744 static struct hda_verb alc882_macpro_init_verbs
[] = {
5745 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5748 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5749 /* Front Pin: output 0 (0x0c) */
5750 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5751 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5752 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5753 /* Front Mic pin: input vref at 80% */
5754 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5755 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5756 /* Speaker: output */
5757 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5758 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5759 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
5760 /* Headphone output (output 0 - 0x0c) */
5761 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5762 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5763 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5765 /* FIXME: use matrix-type input source selection */
5766 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5767 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5768 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5769 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5770 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5771 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5773 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5774 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5775 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5776 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5781 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5782 /* ADC1: mute amp left and right */
5783 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5784 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5785 /* ADC2: mute amp left and right */
5786 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5787 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5788 /* ADC3: mute amp left and right */
5789 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5790 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5795 /* Macbook Pro rev3 */
5796 static struct hda_verb alc885_mbp3_init_verbs
[] = {
5797 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5798 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5799 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5800 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5802 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5803 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5804 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5805 /* Front Pin: output 0 (0x0c) */
5806 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5807 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5808 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5809 /* HP Pin: output 0 (0x0d) */
5810 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
5811 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5812 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5813 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5814 /* Mic (rear) pin: input vref at 80% */
5815 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5816 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5817 /* Front Mic pin: input vref at 80% */
5818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5820 /* Line In pin: use output 1 when in LineOut mode */
5821 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5822 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5823 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
5825 /* FIXME: use matrix-type input source selection */
5826 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5827 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5828 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5829 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5830 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5831 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5833 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5834 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5835 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5836 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5838 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5839 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5840 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5842 /* ADC1: mute amp left and right */
5843 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5844 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5845 /* ADC2: mute amp left and right */
5846 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5847 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5848 /* ADC3: mute amp left and right */
5849 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5850 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5855 /* iMac 24 mixer. */
5856 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
5857 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
5858 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
5862 /* iMac 24 init verbs. */
5863 static struct hda_verb alc885_imac24_init_verbs
[] = {
5864 /* Internal speakers: output 0 (0x0c) */
5865 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5866 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5867 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5868 /* Internal speakers: output 0 (0x0c) */
5869 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5870 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5871 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
5872 /* Headphone: output 0 (0x0c) */
5873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5874 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5875 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5876 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5877 /* Front Mic: input vref at 80% */
5878 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5879 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5883 /* Toggle speaker-output according to the hp-jack state */
5884 static void alc885_imac24_automute(struct hda_codec
*codec
)
5886 unsigned int present
;
5888 present
= snd_hda_codec_read(codec
, 0x14, 0,
5889 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5890 snd_hda_codec_amp_stereo(codec
, 0x18, HDA_OUTPUT
, 0,
5891 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5892 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_OUTPUT
, 0,
5893 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5896 /* Processes unsolicited events. */
5897 static void alc885_imac24_unsol_event(struct hda_codec
*codec
,
5900 /* Headphone insertion or removal. */
5901 if ((res
>> 26) == ALC880_HP_EVENT
)
5902 alc885_imac24_automute(codec
);
5905 static void alc885_mbp3_automute(struct hda_codec
*codec
)
5907 unsigned int present
;
5909 present
= snd_hda_codec_read(codec
, 0x15, 0,
5910 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5911 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
5912 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5913 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
5914 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
5917 static void alc885_mbp3_unsol_event(struct hda_codec
*codec
,
5920 /* Headphone insertion or removal. */
5921 if ((res
>> 26) == ALC880_HP_EVENT
)
5922 alc885_mbp3_automute(codec
);
5926 static struct hda_verb alc882_targa_verbs
[] = {
5927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5928 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5930 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5931 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5933 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5934 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5935 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5937 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5938 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
5939 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
5940 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
5944 /* toggle speaker-output according to the hp-jack state */
5945 static void alc882_targa_automute(struct hda_codec
*codec
)
5947 unsigned int present
;
5949 present
= snd_hda_codec_read(codec
, 0x14, 0,
5950 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5951 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
5952 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5953 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
5957 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
5959 /* Looks like the unsol event is incompatible with the standard
5960 * definition. 4bit tag is placed at 26 bit!
5962 if (((res
>> 26) == ALC880_HP_EVENT
)) {
5963 alc882_targa_automute(codec
);
5967 static struct hda_verb alc882_asus_a7j_verbs
[] = {
5968 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5969 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5971 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5972 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5973 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5975 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5976 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5977 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5979 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5980 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5981 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5985 static struct hda_verb alc882_asus_a7m_verbs
[] = {
5986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5987 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5989 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5990 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5991 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5993 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5994 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5995 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5997 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5998 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5999 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6003 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
6005 unsigned int gpiostate
, gpiomask
, gpiodir
;
6007 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6008 AC_VERB_GET_GPIO_DATA
, 0);
6011 gpiostate
|= (1 << pin
);
6013 gpiostate
&= ~(1 << pin
);
6015 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6016 AC_VERB_GET_GPIO_MASK
, 0);
6017 gpiomask
|= (1 << pin
);
6019 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
6020 AC_VERB_GET_GPIO_DIRECTION
, 0);
6021 gpiodir
|= (1 << pin
);
6024 snd_hda_codec_write(codec
, codec
->afg
, 0,
6025 AC_VERB_SET_GPIO_MASK
, gpiomask
);
6026 snd_hda_codec_write(codec
, codec
->afg
, 0,
6027 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
6031 snd_hda_codec_write(codec
, codec
->afg
, 0,
6032 AC_VERB_SET_GPIO_DATA
, gpiostate
);
6035 /* set up GPIO at initialization */
6036 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
6038 alc882_gpio_mute(codec
, 0, 0);
6039 alc882_gpio_mute(codec
, 1, 0);
6042 /* set up GPIO and update auto-muting at initialization */
6043 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
6045 alc885_macpro_init_hook(codec
);
6046 alc885_imac24_automute(codec
);
6050 * generic initialization of ADC, input mixers and output mixers
6052 static struct hda_verb alc882_auto_init_verbs
[] = {
6054 * Unmute ADC0-2 and set the default input to mic-in
6056 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6058 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6059 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6060 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6061 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6063 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6065 * Note: PASD motherboards uses the Line In 2 as the input for
6066 * front panel mic (mic 2)
6068 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6069 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6070 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6071 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6072 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6073 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6076 * Set up output mixers (0x0c - 0x0f)
6078 /* set vol=0 to output mixers */
6079 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6080 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6083 /* set up input amps for analog loopback */
6084 /* Amp Indices: DAC = 0, mixer = 1 */
6085 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6086 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6087 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6088 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6089 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6090 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6091 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6092 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6093 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6094 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6096 /* FIXME: use matrix-type input source selection */
6097 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6098 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6099 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6100 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6101 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6102 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6104 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6105 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6106 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6107 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6111 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6112 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6117 /* capture mixer elements */
6118 static struct snd_kcontrol_new alc882_capture_alt_mixer
[] = {
6119 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6120 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6121 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6122 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6124 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6125 /* The multiple "Capture Source" controls confuse alsamixer
6126 * So call somewhat different..
6128 /* .name = "Capture Source", */
6129 .name
= "Input Source",
6131 .info
= alc882_mux_enum_info
,
6132 .get
= alc882_mux_enum_get
,
6133 .put
= alc882_mux_enum_put
,
6138 static struct snd_kcontrol_new alc882_capture_mixer
[] = {
6139 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
6140 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
6141 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
6142 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
6143 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
6144 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
6146 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6147 /* The multiple "Capture Source" controls confuse alsamixer
6148 * So call somewhat different..
6150 /* .name = "Capture Source", */
6151 .name
= "Input Source",
6153 .info
= alc882_mux_enum_info
,
6154 .get
= alc882_mux_enum_get
,
6155 .put
= alc882_mux_enum_put
,
6160 #ifdef CONFIG_SND_HDA_POWER_SAVE
6161 #define alc882_loopbacks alc880_loopbacks
6164 /* pcm configuration: identiacal with ALC880 */
6165 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6166 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6167 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6168 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6171 * configuration and preset
6173 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
6174 [ALC882_3ST_DIG
] = "3stack-dig",
6175 [ALC882_6ST_DIG
] = "6stack-dig",
6176 [ALC882_ARIMA
] = "arima",
6177 [ALC882_W2JC
] = "w2jc",
6178 [ALC882_TARGA
] = "targa",
6179 [ALC882_ASUS_A7J
] = "asus-a7j",
6180 [ALC882_ASUS_A7M
] = "asus-a7m",
6181 [ALC885_MACPRO
] = "macpro",
6182 [ALC885_MBP3
] = "mbp3",
6183 [ALC885_IMAC24
] = "imac24",
6184 [ALC882_AUTO
] = "auto",
6187 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
6188 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
6189 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
6190 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
6191 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
6192 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
6193 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
6194 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
6195 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
6196 SND_PCI_QUIRK(0x106b, 0x00a0, "Apple iMac 24''", ALC885_IMAC24
),
6197 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
6198 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
6199 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
6200 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA
),
6204 static struct alc_config_preset alc882_presets
[] = {
6205 [ALC882_3ST_DIG
] = {
6206 .mixers
= { alc882_base_mixer
},
6207 .init_verbs
= { alc882_init_verbs
},
6208 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6209 .dac_nids
= alc882_dac_nids
,
6210 .dig_out_nid
= ALC882_DIGOUT_NID
,
6211 .dig_in_nid
= ALC882_DIGIN_NID
,
6212 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6213 .channel_mode
= alc882_ch_modes
,
6215 .input_mux
= &alc882_capture_source
,
6217 [ALC882_6ST_DIG
] = {
6218 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
6219 .init_verbs
= { alc882_init_verbs
},
6220 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6221 .dac_nids
= alc882_dac_nids
,
6222 .dig_out_nid
= ALC882_DIGOUT_NID
,
6223 .dig_in_nid
= ALC882_DIGIN_NID
,
6224 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
6225 .channel_mode
= alc882_sixstack_modes
,
6226 .input_mux
= &alc882_capture_source
,
6229 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
6230 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
},
6231 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6232 .dac_nids
= alc882_dac_nids
,
6233 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
6234 .channel_mode
= alc882_sixstack_modes
,
6235 .input_mux
= &alc882_capture_source
,
6238 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
6239 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
6240 alc880_gpio1_init_verbs
},
6241 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6242 .dac_nids
= alc882_dac_nids
,
6243 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
6244 .channel_mode
= alc880_threestack_modes
,
6246 .input_mux
= &alc882_capture_source
,
6247 .dig_out_nid
= ALC882_DIGOUT_NID
,
6250 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
6251 .init_verbs
= { alc885_mbp3_init_verbs
,
6252 alc880_gpio1_init_verbs
},
6253 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6254 .dac_nids
= alc882_dac_nids
,
6255 .channel_mode
= alc885_mbp_6ch_modes
,
6256 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_6ch_modes
),
6257 .input_mux
= &alc882_capture_source
,
6258 .dig_out_nid
= ALC882_DIGOUT_NID
,
6259 .dig_in_nid
= ALC882_DIGIN_NID
,
6260 .unsol_event
= alc885_mbp3_unsol_event
,
6261 .init_hook
= alc885_mbp3_automute
,
6264 .mixers
= { alc882_macpro_mixer
},
6265 .init_verbs
= { alc882_macpro_init_verbs
},
6266 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6267 .dac_nids
= alc882_dac_nids
,
6268 .dig_out_nid
= ALC882_DIGOUT_NID
,
6269 .dig_in_nid
= ALC882_DIGIN_NID
,
6270 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6271 .channel_mode
= alc882_ch_modes
,
6272 .input_mux
= &alc882_capture_source
,
6273 .init_hook
= alc885_macpro_init_hook
,
6276 .mixers
= { alc885_imac24_mixer
},
6277 .init_verbs
= { alc885_imac24_init_verbs
},
6278 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6279 .dac_nids
= alc882_dac_nids
,
6280 .dig_out_nid
= ALC882_DIGOUT_NID
,
6281 .dig_in_nid
= ALC882_DIGIN_NID
,
6282 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6283 .channel_mode
= alc882_ch_modes
,
6284 .input_mux
= &alc882_capture_source
,
6285 .unsol_event
= alc885_imac24_unsol_event
,
6286 .init_hook
= alc885_imac24_init_hook
,
6289 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
,
6290 alc882_capture_mixer
},
6291 .init_verbs
= { alc882_init_verbs
, alc882_targa_verbs
},
6292 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6293 .dac_nids
= alc882_dac_nids
,
6294 .dig_out_nid
= ALC882_DIGOUT_NID
,
6295 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
6296 .adc_nids
= alc882_adc_nids
,
6297 .capsrc_nids
= alc882_capsrc_nids
,
6298 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
6299 .channel_mode
= alc882_3ST_6ch_modes
,
6301 .input_mux
= &alc882_capture_source
,
6302 .unsol_event
= alc882_targa_unsol_event
,
6303 .init_hook
= alc882_targa_automute
,
6305 [ALC882_ASUS_A7J
] = {
6306 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
,
6307 alc882_capture_mixer
},
6308 .init_verbs
= { alc882_init_verbs
, alc882_asus_a7j_verbs
},
6309 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6310 .dac_nids
= alc882_dac_nids
,
6311 .dig_out_nid
= ALC882_DIGOUT_NID
,
6312 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
6313 .adc_nids
= alc882_adc_nids
,
6314 .capsrc_nids
= alc882_capsrc_nids
,
6315 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
6316 .channel_mode
= alc882_3ST_6ch_modes
,
6318 .input_mux
= &alc882_capture_source
,
6320 [ALC882_ASUS_A7M
] = {
6321 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
6322 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
6323 alc880_gpio1_init_verbs
,
6324 alc882_asus_a7m_verbs
},
6325 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6326 .dac_nids
= alc882_dac_nids
,
6327 .dig_out_nid
= ALC882_DIGOUT_NID
,
6328 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
6329 .channel_mode
= alc880_threestack_modes
,
6331 .input_mux
= &alc882_capture_source
,
6340 PINFIX_ABIT_AW9D_MAX
6343 static struct alc_pincfg alc882_abit_aw9d_pinfix
[] = {
6344 { 0x15, 0x01080104 }, /* side */
6345 { 0x16, 0x01011012 }, /* rear */
6346 { 0x17, 0x01016011 }, /* clfe */
6350 static const struct alc_pincfg
*alc882_pin_fixes
[] = {
6351 [PINFIX_ABIT_AW9D_MAX
] = alc882_abit_aw9d_pinfix
,
6354 static struct snd_pci_quirk alc882_pinfix_tbl
[] = {
6355 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
6360 * BIOS auto configuration
6362 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
6363 hda_nid_t nid
, int pin_type
,
6367 struct alc_spec
*spec
= codec
->spec
;
6370 alc_set_pin_output(codec
, nid
, pin_type
);
6371 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
6374 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
6375 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
6379 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
6381 struct alc_spec
*spec
= codec
->spec
;
6384 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
6385 for (i
= 0; i
<= HDA_SIDE
; i
++) {
6386 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
6387 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
6389 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
6394 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
6396 struct alc_spec
*spec
= codec
->spec
;
6399 pin
= spec
->autocfg
.hp_pins
[0];
6400 if (pin
) /* connect to front */
6402 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
6403 pin
= spec
->autocfg
.speaker_pins
[0];
6405 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
6408 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6409 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6411 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
6413 struct alc_spec
*spec
= codec
->spec
;
6416 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
6417 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
6422 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) {
6423 unsigned int pincap
;
6424 pincap
= snd_hda_param_read(codec
, nid
, AC_PAR_PIN_CAP
);
6425 if ((pincap
>> AC_PINCAP_VREF_SHIFT
) &
6429 snd_hda_codec_write(codec
, nid
, 0,
6430 AC_VERB_SET_PIN_WIDGET_CONTROL
, vref
);
6431 if (get_wcaps(codec
, nid
) & AC_WCAP_OUT_AMP
)
6432 snd_hda_codec_write(codec
, nid
, 0,
6433 AC_VERB_SET_AMP_GAIN_MUTE
,
6438 /* add mic boosts if needed */
6439 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
6441 struct alc_spec
*spec
= codec
->spec
;
6445 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
6446 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
6447 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6449 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6453 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
6454 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
6455 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6457 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6464 /* almost identical with ALC880 parser... */
6465 static int alc882_parse_auto_config(struct hda_codec
*codec
)
6467 struct alc_spec
*spec
= codec
->spec
;
6468 int err
= alc880_parse_auto_config(codec
);
6473 return 0; /* no config found */
6475 err
= alc_auto_add_mic_boost(codec
);
6479 /* hack - override the init verbs */
6480 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
6482 return 1; /* config found */
6485 /* additional initialization for auto-configuration model */
6486 static void alc882_auto_init(struct hda_codec
*codec
)
6488 struct alc_spec
*spec
= codec
->spec
;
6489 alc882_auto_init_multi_out(codec
);
6490 alc882_auto_init_hp_out(codec
);
6491 alc882_auto_init_analog_input(codec
);
6492 if (spec
->unsol_event
)
6493 alc_sku_automute(codec
);
6496 static int patch_alc883(struct hda_codec
*codec
); /* called in patch_alc882() */
6498 static int patch_alc882(struct hda_codec
*codec
)
6500 struct alc_spec
*spec
;
6501 int err
, board_config
;
6503 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6509 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
6513 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
6514 /* Pick up systems that don't supply PCI SSID */
6515 switch (codec
->subsystem_id
) {
6516 case 0x106b0c00: /* Mac Pro */
6517 board_config
= ALC885_MACPRO
;
6519 case 0x106b1000: /* iMac 24 */
6520 board_config
= ALC885_IMAC24
;
6522 case 0x106b00a1: /* Macbook */
6523 case 0x106b2c00: /* Macbook Pro rev3 */
6524 board_config
= ALC885_MBP3
;
6527 /* ALC889A is handled better as ALC888-compatible */
6528 if (codec
->revision_id
== 0x100103) {
6530 return patch_alc883(codec
);
6532 printk(KERN_INFO
"hda_codec: Unknown model for ALC882, "
6533 "trying auto-probe from BIOS...\n");
6534 board_config
= ALC882_AUTO
;
6538 alc_fix_pincfg(codec
, alc882_pinfix_tbl
, alc882_pin_fixes
);
6540 if (board_config
== ALC882_AUTO
) {
6541 /* automatic parse from the BIOS config */
6542 err
= alc882_parse_auto_config(codec
);
6548 "hda_codec: Cannot set up configuration "
6549 "from BIOS. Using base mode...\n");
6550 board_config
= ALC882_3ST_DIG
;
6554 if (board_config
!= ALC882_AUTO
)
6555 setup_preset(spec
, &alc882_presets
[board_config
]);
6557 if (codec
->vendor_id
== 0x10ec0885) {
6558 spec
->stream_name_analog
= "ALC885 Analog";
6559 spec
->stream_name_digital
= "ALC885 Digital";
6561 spec
->stream_name_analog
= "ALC882 Analog";
6562 spec
->stream_name_digital
= "ALC882 Digital";
6565 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
6566 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
6567 /* FIXME: setup DAC5 */
6568 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6569 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
6571 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
6572 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
6574 if (!spec
->adc_nids
&& spec
->input_mux
) {
6575 /* check whether NID 0x07 is valid */
6576 unsigned int wcap
= get_wcaps(codec
, 0x07);
6578 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
6579 if (wcap
!= AC_WID_AUD_IN
) {
6580 spec
->adc_nids
= alc882_adc_nids_alt
;
6581 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
6582 spec
->capsrc_nids
= alc882_capsrc_nids_alt
;
6583 spec
->mixers
[spec
->num_mixers
] =
6584 alc882_capture_alt_mixer
;
6587 spec
->adc_nids
= alc882_adc_nids
;
6588 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
6589 spec
->capsrc_nids
= alc882_capsrc_nids
;
6590 spec
->mixers
[spec
->num_mixers
] = alc882_capture_mixer
;
6595 spec
->vmaster_nid
= 0x0c;
6597 codec
->patch_ops
= alc_patch_ops
;
6598 if (board_config
== ALC882_AUTO
)
6599 spec
->init_hook
= alc882_auto_init
;
6600 #ifdef CONFIG_SND_HDA_POWER_SAVE
6601 if (!spec
->loopback
.amplist
)
6602 spec
->loopback
.amplist
= alc882_loopbacks
;
6611 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6612 * configuration. Each pin widget can choose any input DACs and a mixer.
6613 * Each ADC is connected from a mixer of all inputs. This makes possible
6614 * 6-channel independent captures.
6616 * In addition, an independent DAC for the multi-playback (not used in this
6619 #define ALC883_DIGOUT_NID 0x06
6620 #define ALC883_DIGIN_NID 0x0a
6622 static hda_nid_t alc883_dac_nids
[4] = {
6623 /* front, rear, clfe, rear_surr */
6624 0x02, 0x03, 0x04, 0x05
6627 static hda_nid_t alc883_adc_nids
[2] = {
6632 static hda_nid_t alc883_capsrc_nids
[2] = { 0x23, 0x22 };
6635 /* FIXME: should be a matrix-type input source selection */
6637 static struct hda_input_mux alc883_capture_source
= {
6641 { "Front Mic", 0x1 },
6647 static struct hda_input_mux alc883_3stack_6ch_intel
= {
6651 { "Front Mic", 0x0 },
6657 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
6665 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
6675 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
6683 #define alc883_mux_enum_info alc_mux_enum_info
6684 #define alc883_mux_enum_get alc_mux_enum_get
6685 /* ALC883 has the ALC882-type input selection */
6686 #define alc883_mux_enum_put alc882_mux_enum_put
6691 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
6698 static struct hda_verb alc883_3ST_ch2_init
[] = {
6699 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6700 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6701 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6702 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6709 static struct hda_verb alc883_3ST_ch4_init
[] = {
6710 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6711 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6712 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6713 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6714 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6721 static struct hda_verb alc883_3ST_ch6_init
[] = {
6722 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6723 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6724 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6725 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6726 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6727 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6731 static struct hda_channel_mode alc883_3ST_6ch_modes
[3] = {
6732 { 2, alc883_3ST_ch2_init
},
6733 { 4, alc883_3ST_ch4_init
},
6734 { 6, alc883_3ST_ch6_init
},
6740 static struct hda_verb alc883_3ST_ch2_intel_init
[] = {
6741 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6742 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6743 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6744 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6751 static struct hda_verb alc883_3ST_ch4_intel_init
[] = {
6752 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6753 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6754 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6755 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6756 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6763 static struct hda_verb alc883_3ST_ch6_intel_init
[] = {
6764 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6765 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6766 { 0x19, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6767 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6768 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6769 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6773 static struct hda_channel_mode alc883_3ST_6ch_intel_modes
[3] = {
6774 { 2, alc883_3ST_ch2_intel_init
},
6775 { 4, alc883_3ST_ch4_intel_init
},
6776 { 6, alc883_3ST_ch6_intel_init
},
6782 static struct hda_verb alc883_sixstack_ch6_init
[] = {
6783 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6784 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6785 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6786 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6793 static struct hda_verb alc883_sixstack_ch8_init
[] = {
6794 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6795 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6796 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6797 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6801 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
6802 { 6, alc883_sixstack_ch6_init
},
6803 { 8, alc883_sixstack_ch8_init
},
6806 static struct hda_verb alc883_medion_eapd_verbs
[] = {
6807 /* eanable EAPD on medion laptop */
6808 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
6809 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
6813 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6814 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6817 static struct snd_kcontrol_new alc883_base_mixer
[] = {
6818 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6819 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6820 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6821 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6822 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6823 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6824 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6825 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6826 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
6827 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
6828 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6829 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6830 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6831 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6832 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6834 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6835 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6836 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6837 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6838 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6839 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6840 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6841 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6842 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6843 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6844 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6846 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6847 /* .name = "Capture Source", */
6848 .name
= "Input Source",
6850 .info
= alc883_mux_enum_info
,
6851 .get
= alc883_mux_enum_get
,
6852 .put
= alc883_mux_enum_put
,
6857 static struct snd_kcontrol_new alc883_mitac_mixer
[] = {
6858 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6859 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6860 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6861 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6862 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6863 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6864 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6865 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6866 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6867 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6868 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6869 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6870 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6871 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6872 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6873 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6874 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6876 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6877 /* .name = "Capture Source", */
6878 .name
= "Input Source",
6880 .info
= alc883_mux_enum_info
,
6881 .get
= alc883_mux_enum_get
,
6882 .put
= alc883_mux_enum_put
,
6887 static struct snd_kcontrol_new alc883_clevo_m720_mixer
[] = {
6888 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6889 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
6890 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6891 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
6892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6893 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6894 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6895 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6896 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
6897 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6898 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6899 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6900 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6901 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6903 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6904 /* .name = "Capture Source", */
6905 .name
= "Input Source",
6907 .info
= alc883_mux_enum_info
,
6908 .get
= alc883_mux_enum_get
,
6909 .put
= alc883_mux_enum_put
,
6914 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
6915 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6916 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
6917 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6918 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
6919 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6920 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6922 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6923 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
6924 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6925 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6926 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6927 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6928 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6930 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6931 /* .name = "Capture Source", */
6932 .name
= "Input Source",
6934 .info
= alc883_mux_enum_info
,
6935 .get
= alc883_mux_enum_get
,
6936 .put
= alc883_mux_enum_put
,
6941 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
6942 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6943 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6944 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6945 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6946 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6947 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6948 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6949 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6950 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6951 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6952 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6953 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6954 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6955 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6956 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6957 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6958 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6959 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6960 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6962 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6963 /* .name = "Capture Source", */
6964 .name
= "Input Source",
6966 .info
= alc883_mux_enum_info
,
6967 .get
= alc883_mux_enum_get
,
6968 .put
= alc883_mux_enum_put
,
6973 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
6974 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6975 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6976 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6977 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6978 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6979 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6980 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6981 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6982 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6983 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6984 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6985 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6986 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6987 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6988 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6989 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6990 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6991 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6992 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6993 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6994 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6995 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6996 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6997 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6998 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7000 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7001 /* .name = "Capture Source", */
7002 .name
= "Input Source",
7004 .info
= alc883_mux_enum_info
,
7005 .get
= alc883_mux_enum_get
,
7006 .put
= alc883_mux_enum_put
,
7011 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer
[] = {
7012 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7013 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7014 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7015 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7016 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7018 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7019 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7020 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7021 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7022 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7023 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7024 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7025 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7026 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7027 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
7028 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7029 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7030 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT
),
7031 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7032 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7033 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7034 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7035 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7036 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7037 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7039 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7040 /* .name = "Capture Source", */
7041 .name
= "Input Source",
7043 .info
= alc883_mux_enum_info
,
7044 .get
= alc883_mux_enum_get
,
7045 .put
= alc883_mux_enum_put
,
7050 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
7051 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7052 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7053 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7054 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7055 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7056 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7057 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT
),
7058 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
7059 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7060 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7061 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7062 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7063 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7064 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7065 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7066 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7067 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7068 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7069 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7070 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7071 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7072 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7073 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7076 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7077 /* .name = "Capture Source", */
7078 .name
= "Input Source",
7080 .info
= alc883_mux_enum_info
,
7081 .get
= alc883_mux_enum_get
,
7082 .put
= alc883_mux_enum_put
,
7087 static struct snd_kcontrol_new alc883_tagra_mixer
[] = {
7088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7089 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7090 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7091 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7092 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
7093 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
7094 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7095 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
7096 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
7097 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7098 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7100 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7102 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7104 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7105 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7106 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7107 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7109 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7110 /* .name = "Capture Source", */
7111 .name
= "Input Source",
7113 .info
= alc883_mux_enum_info
,
7114 .get
= alc883_mux_enum_get
,
7115 .put
= alc883_mux_enum_put
,
7120 static struct snd_kcontrol_new alc883_tagra_2ch_mixer
[] = {
7121 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7122 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7123 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7124 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7125 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7127 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7129 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7130 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
7131 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7132 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7133 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7134 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7135 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7137 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7138 /* .name = "Capture Source", */
7139 .name
= "Input Source",
7141 .info
= alc883_mux_enum_info
,
7142 .get
= alc883_mux_enum_get
,
7143 .put
= alc883_mux_enum_put
,
7148 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
7149 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7150 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7151 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7152 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
7153 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7155 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7156 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7157 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7158 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7160 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7161 /* .name = "Capture Source", */
7162 .name
= "Input Source",
7164 .info
= alc883_mux_enum_info
,
7165 .get
= alc883_mux_enum_get
,
7166 .put
= alc883_mux_enum_put
,
7171 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
7172 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7173 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
7174 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7175 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7176 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7179 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7180 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7181 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7182 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7183 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7184 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7186 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7187 /* .name = "Capture Source", */
7188 .name
= "Input Source",
7190 .info
= alc883_mux_enum_info
,
7191 .get
= alc883_mux_enum_get
,
7192 .put
= alc883_mux_enum_put
,
7197 static struct snd_kcontrol_new alc883_medion_md2_mixer
[] = {
7198 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7199 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7200 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7201 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7202 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7205 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7206 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7207 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7208 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7209 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7210 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7212 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7213 /* .name = "Capture Source", */
7214 .name
= "Input Source",
7216 .info
= alc883_mux_enum_info
,
7217 .get
= alc883_mux_enum_get
,
7218 .put
= alc883_mux_enum_put
,
7223 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
7224 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7225 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7226 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7227 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7228 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7229 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7230 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7231 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7232 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7233 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7234 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7235 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7237 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7238 /* .name = "Capture Source", */
7239 .name
= "Input Source",
7241 .info
= alc883_mux_enum_info
,
7242 .get
= alc883_mux_enum_get
,
7243 .put
= alc883_mux_enum_put
,
7248 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
7250 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7251 .name
= "Channel Mode",
7252 .info
= alc_ch_mode_info
,
7253 .get
= alc_ch_mode_get
,
7254 .put
= alc_ch_mode_put
,
7259 static struct hda_verb alc883_init_verbs
[] = {
7260 /* ADC1: mute amp left and right */
7261 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7262 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7263 /* ADC2: mute amp left and right */
7264 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7265 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7266 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7267 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7268 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7271 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7272 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7273 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7275 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7276 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7277 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7279 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7280 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7281 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7283 /* mute analog input loopbacks */
7284 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7290 /* Front Pin: output 0 (0x0c) */
7291 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7292 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7293 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7294 /* Rear Pin: output 1 (0x0d) */
7295 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7296 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7297 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7298 /* CLFE Pin: output 2 (0x0e) */
7299 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7300 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7301 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
7302 /* Side Pin: output 3 (0x0f) */
7303 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7304 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7305 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
7306 /* Mic (rear) pin: input vref at 80% */
7307 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7308 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7309 /* Front Mic pin: input vref at 80% */
7310 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7311 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7312 /* Line In pin: input */
7313 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7314 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7315 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7316 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7317 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7318 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7319 /* CD pin widget for input */
7320 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7322 /* FIXME: use matrix-type input source selection */
7323 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7325 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7326 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7327 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7328 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7330 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7333 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7337 /* toggle speaker-output according to the hp-jack state */
7338 static void alc883_mitac_hp_automute(struct hda_codec
*codec
)
7340 unsigned int present
;
7342 present
= snd_hda_codec_read(codec
, 0x15, 0,
7343 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7344 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7345 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7346 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
7347 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7350 /* auto-toggle front mic */
7352 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7354 unsigned int present;
7357 present = snd_hda_codec_read(codec, 0x18, 0,
7358 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7359 bits = present ? HDA_AMP_MUTE : 0;
7360 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7364 static void alc883_mitac_automute(struct hda_codec
*codec
)
7366 alc883_mitac_hp_automute(codec
);
7367 /* alc883_mitac_mic_automute(codec); */
7370 static void alc883_mitac_unsol_event(struct hda_codec
*codec
,
7373 switch (res
>> 26) {
7374 case ALC880_HP_EVENT
:
7375 alc883_mitac_hp_automute(codec
);
7377 case ALC880_MIC_EVENT
:
7378 /* alc883_mitac_mic_automute(codec); */
7383 static struct hda_verb alc883_mitac_verbs
[] = {
7385 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7386 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7388 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
7389 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7391 /* enable unsolicited event */
7392 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7393 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7398 static struct hda_verb alc883_clevo_m720_verbs
[] = {
7400 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7401 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7403 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
7404 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7406 /* enable unsolicited event */
7407 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7408 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
7413 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
7415 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7416 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7418 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7421 /* enable unsolicited event */
7422 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7427 static struct hda_verb alc883_tagra_verbs
[] = {
7428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7431 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7432 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7434 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
7435 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
7436 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
7438 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7439 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
7440 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
7441 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
7446 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
7447 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7448 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
7449 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
7453 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
7454 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7455 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7456 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7457 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7461 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
7462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7464 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7465 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
7466 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7470 static struct hda_verb alc883_haier_w66_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_OUT
},
7476 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7477 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7478 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7479 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7483 static struct hda_verb alc888_3st_hp_verbs
[] = {
7484 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
7485 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
7486 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
7490 static struct hda_verb alc888_6st_dell_verbs
[] = {
7491 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7495 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
7496 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7497 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7498 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7499 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7503 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
7504 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7505 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7506 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7507 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7511 static struct hda_channel_mode alc888_3st_hp_modes
[2] = {
7512 { 2, alc888_3st_hp_2ch_init
},
7513 { 6, alc888_3st_hp_6ch_init
},
7516 /* toggle front-jack and RCA according to the hp-jack state */
7517 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
7519 unsigned int present
;
7521 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7522 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7523 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7524 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7525 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7526 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7529 /* toggle RCA according to the front-jack state */
7530 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
7532 unsigned int present
;
7534 present
= snd_hda_codec_read(codec
, 0x14, 0,
7535 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7536 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7537 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7540 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
7543 if ((res
>> 26) == ALC880_HP_EVENT
)
7544 alc888_lenovo_ms7195_front_automute(codec
);
7545 if ((res
>> 26) == ALC880_FRONT_EVENT
)
7546 alc888_lenovo_ms7195_rca_automute(codec
);
7549 static struct hda_verb alc883_medion_md2_verbs
[] = {
7550 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7551 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7553 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7555 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7559 /* toggle speaker-output according to the hp-jack state */
7560 static void alc883_medion_md2_automute(struct hda_codec
*codec
)
7562 unsigned int present
;
7564 present
= snd_hda_codec_read(codec
, 0x14, 0,
7565 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7566 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7567 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7570 static void alc883_medion_md2_unsol_event(struct hda_codec
*codec
,
7573 if ((res
>> 26) == ALC880_HP_EVENT
)
7574 alc883_medion_md2_automute(codec
);
7577 /* toggle speaker-output according to the hp-jack state */
7578 static void alc883_tagra_automute(struct hda_codec
*codec
)
7580 unsigned int present
;
7583 present
= snd_hda_codec_read(codec
, 0x14, 0,
7584 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7585 bits
= present
? HDA_AMP_MUTE
: 0;
7586 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
7587 HDA_AMP_MUTE
, bits
);
7588 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
7592 static void alc883_tagra_unsol_event(struct hda_codec
*codec
, unsigned int res
)
7594 if ((res
>> 26) == ALC880_HP_EVENT
)
7595 alc883_tagra_automute(codec
);
7598 /* toggle speaker-output according to the hp-jack state */
7599 static void alc883_clevo_m720_hp_automute(struct hda_codec
*codec
)
7601 unsigned int present
;
7604 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0)
7605 & AC_PINSENSE_PRESENCE
;
7606 bits
= present
? HDA_AMP_MUTE
: 0;
7607 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7608 HDA_AMP_MUTE
, bits
);
7611 static void alc883_clevo_m720_mic_automute(struct hda_codec
*codec
)
7613 unsigned int present
;
7615 present
= snd_hda_codec_read(codec
, 0x18, 0,
7616 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7617 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
7618 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7621 static void alc883_clevo_m720_automute(struct hda_codec
*codec
)
7623 alc883_clevo_m720_hp_automute(codec
);
7624 alc883_clevo_m720_mic_automute(codec
);
7627 static void alc883_clevo_m720_unsol_event(struct hda_codec
*codec
,
7630 switch (res
>> 26) {
7631 case ALC880_HP_EVENT
:
7632 alc883_clevo_m720_hp_automute(codec
);
7634 case ALC880_MIC_EVENT
:
7635 alc883_clevo_m720_mic_automute(codec
);
7640 /* toggle speaker-output according to the hp-jack state */
7641 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec
*codec
)
7643 unsigned int present
;
7646 present
= snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_GET_PIN_SENSE
, 0)
7647 & AC_PINSENSE_PRESENCE
;
7648 bits
= present
? HDA_AMP_MUTE
: 0;
7649 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7650 HDA_AMP_MUTE
, bits
);
7653 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec
*codec
,
7656 if ((res
>> 26) == ALC880_HP_EVENT
)
7657 alc883_2ch_fujitsu_pi2515_automute(codec
);
7660 static void alc883_haier_w66_automute(struct hda_codec
*codec
)
7662 unsigned int present
;
7665 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7666 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7667 bits
= present
? 0x80 : 0;
7668 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7672 static void alc883_haier_w66_unsol_event(struct hda_codec
*codec
,
7675 if ((res
>> 26) == ALC880_HP_EVENT
)
7676 alc883_haier_w66_automute(codec
);
7679 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
7681 unsigned int present
;
7684 present
= snd_hda_codec_read(codec
, 0x14, 0,
7685 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7686 bits
= present
? HDA_AMP_MUTE
: 0;
7687 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7688 HDA_AMP_MUTE
, bits
);
7691 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
7693 unsigned int present
;
7696 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7697 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7698 bits
= present
? HDA_AMP_MUTE
: 0;
7699 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7700 HDA_AMP_MUTE
, bits
);
7701 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7702 HDA_AMP_MUTE
, bits
);
7705 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
7708 if ((res
>> 26) == ALC880_HP_EVENT
)
7709 alc883_lenovo_101e_all_automute(codec
);
7710 if ((res
>> 26) == ALC880_FRONT_EVENT
)
7711 alc883_lenovo_101e_ispeaker_automute(codec
);
7714 /* toggle speaker-output according to the hp-jack state */
7715 static void alc883_acer_aspire_automute(struct hda_codec
*codec
)
7717 unsigned int present
;
7719 present
= snd_hda_codec_read(codec
, 0x14, 0,
7720 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7721 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7722 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7723 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
7724 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7727 static void alc883_acer_aspire_unsol_event(struct hda_codec
*codec
,
7730 if ((res
>> 26) == ALC880_HP_EVENT
)
7731 alc883_acer_aspire_automute(codec
);
7734 static struct hda_verb alc883_acer_eapd_verbs
[] = {
7735 /* HP Pin: output 0 (0x0c) */
7736 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7737 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7738 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7739 /* Front Pin: output 0 (0x0c) */
7740 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7741 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7742 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7743 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
7744 /* eanable EAPD on medion laptop */
7745 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
7746 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
7747 /* enable unsolicited event */
7748 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7752 static void alc888_6st_dell_front_automute(struct hda_codec
*codec
)
7754 unsigned int present
;
7756 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7757 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7758 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7759 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7760 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7761 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7762 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
7763 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7764 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
7765 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7768 static void alc888_6st_dell_unsol_event(struct hda_codec
*codec
,
7771 switch (res
>> 26) {
7772 case ALC880_HP_EVENT
:
7773 printk("hp_event\n");
7774 alc888_6st_dell_front_automute(codec
);
7780 * generic initialization of ADC, input mixers and output mixers
7782 static struct hda_verb alc883_auto_init_verbs
[] = {
7784 * Unmute ADC0-2 and set the default input to mic-in
7786 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7787 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7788 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7789 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7791 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7793 * Note: PASD motherboards uses the Line In 2 as the input for
7794 * front panel mic (mic 2)
7796 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7798 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7799 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7800 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7801 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7804 * Set up output mixers (0x0c - 0x0f)
7806 /* set vol=0 to output mixers */
7807 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7808 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7809 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7810 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7811 /* set up input amps for analog loopback */
7812 /* Amp Indices: DAC = 0, mixer = 1 */
7813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7815 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7816 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7817 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7818 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7819 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7820 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7821 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7822 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7824 /* FIXME: use matrix-type input source selection */
7825 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7827 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7828 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7829 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7830 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7831 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7833 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7834 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7835 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7836 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7837 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7842 /* capture mixer elements */
7843 static struct snd_kcontrol_new alc883_capture_mixer
[] = {
7844 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7845 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7846 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7847 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7849 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7850 /* The multiple "Capture Source" controls confuse alsamixer
7851 * So call somewhat different..
7853 /* .name = "Capture Source", */
7854 .name
= "Input Source",
7856 .info
= alc882_mux_enum_info
,
7857 .get
= alc882_mux_enum_get
,
7858 .put
= alc882_mux_enum_put
,
7863 #ifdef CONFIG_SND_HDA_POWER_SAVE
7864 #define alc883_loopbacks alc880_loopbacks
7867 /* pcm configuration: identiacal with ALC880 */
7868 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7869 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7870 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7871 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7872 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7875 * configuration and preset
7877 static const char *alc883_models
[ALC883_MODEL_LAST
] = {
7878 [ALC883_3ST_2ch_DIG
] = "3stack-dig",
7879 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
7880 [ALC883_3ST_6ch
] = "3stack-6ch",
7881 [ALC883_6ST_DIG
] = "6stack-dig",
7882 [ALC883_TARGA_DIG
] = "targa-dig",
7883 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
7884 [ALC883_ACER
] = "acer",
7885 [ALC883_ACER_ASPIRE
] = "acer-aspire",
7886 [ALC883_MEDION
] = "medion",
7887 [ALC883_MEDION_MD2
] = "medion-md2",
7888 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
7889 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
7890 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
7891 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
7892 [ALC883_HAIER_W66
] = "haier-w66",
7893 [ALC888_3ST_HP
] = "3stack-hp",
7894 [ALC888_6ST_DELL
] = "6stack-dell",
7895 [ALC883_MITAC
] = "mitac",
7896 [ALC883_CLEVO_M720
] = "clevo-m720",
7897 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
7898 [ALC883_3ST_6ch_INTEL
] = "3stack-6ch-intel",
7899 [ALC883_AUTO
] = "auto",
7902 static struct snd_pci_quirk alc883_cfg_tbl
[] = {
7903 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG
),
7904 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
7905 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
7906 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
7907 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER
), /* default Acer */
7908 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
7909 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
7910 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
7911 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
7912 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG
),
7913 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
7914 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG
),
7915 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG
),
7916 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
7917 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
7918 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
7919 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG
),
7920 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
7921 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
7922 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
7923 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG
),
7924 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
7925 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
7926 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
7927 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
7928 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
7929 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
7930 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
7931 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
7932 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
7933 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
7934 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
7935 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
7936 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
7937 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
7938 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG
),
7939 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
7940 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
7941 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
7942 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
7943 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720
),
7944 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720
),
7945 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD
),
7946 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
7947 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
7948 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515
),
7949 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
7950 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7951 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7952 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7953 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2
),
7954 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
7955 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
7956 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL
),
7957 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL
),
7958 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch
),
7962 static struct alc_config_preset alc883_presets
[] = {
7963 [ALC883_3ST_2ch_DIG
] = {
7964 .mixers
= { alc883_3ST_2ch_mixer
},
7965 .init_verbs
= { alc883_init_verbs
},
7966 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7967 .dac_nids
= alc883_dac_nids
,
7968 .dig_out_nid
= ALC883_DIGOUT_NID
,
7969 .dig_in_nid
= ALC883_DIGIN_NID
,
7970 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7971 .channel_mode
= alc883_3ST_2ch_modes
,
7972 .input_mux
= &alc883_capture_source
,
7974 [ALC883_3ST_6ch_DIG
] = {
7975 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
7976 .init_verbs
= { alc883_init_verbs
},
7977 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7978 .dac_nids
= alc883_dac_nids
,
7979 .dig_out_nid
= ALC883_DIGOUT_NID
,
7980 .dig_in_nid
= ALC883_DIGIN_NID
,
7981 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7982 .channel_mode
= alc883_3ST_6ch_modes
,
7984 .input_mux
= &alc883_capture_source
,
7986 [ALC883_3ST_6ch
] = {
7987 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
7988 .init_verbs
= { alc883_init_verbs
},
7989 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7990 .dac_nids
= alc883_dac_nids
,
7991 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7992 .channel_mode
= alc883_3ST_6ch_modes
,
7994 .input_mux
= &alc883_capture_source
,
7996 [ALC883_3ST_6ch_INTEL
] = {
7997 .mixers
= { alc883_3ST_6ch_intel_mixer
, alc883_chmode_mixer
},
7998 .init_verbs
= { alc883_init_verbs
},
7999 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8000 .dac_nids
= alc883_dac_nids
,
8001 .dig_out_nid
= ALC883_DIGOUT_NID
,
8002 .dig_in_nid
= ALC883_DIGIN_NID
,
8003 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_intel_modes
),
8004 .channel_mode
= alc883_3ST_6ch_intel_modes
,
8006 .input_mux
= &alc883_3stack_6ch_intel
,
8008 [ALC883_6ST_DIG
] = {
8009 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
8010 .init_verbs
= { alc883_init_verbs
},
8011 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8012 .dac_nids
= alc883_dac_nids
,
8013 .dig_out_nid
= ALC883_DIGOUT_NID
,
8014 .dig_in_nid
= ALC883_DIGIN_NID
,
8015 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8016 .channel_mode
= alc883_sixstack_modes
,
8017 .input_mux
= &alc883_capture_source
,
8019 [ALC883_TARGA_DIG
] = {
8020 .mixers
= { alc883_tagra_mixer
, alc883_chmode_mixer
},
8021 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
8022 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8023 .dac_nids
= alc883_dac_nids
,
8024 .dig_out_nid
= ALC883_DIGOUT_NID
,
8025 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8026 .channel_mode
= alc883_3ST_6ch_modes
,
8028 .input_mux
= &alc883_capture_source
,
8029 .unsol_event
= alc883_tagra_unsol_event
,
8030 .init_hook
= alc883_tagra_automute
,
8032 [ALC883_TARGA_2ch_DIG
] = {
8033 .mixers
= { alc883_tagra_2ch_mixer
},
8034 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
8035 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8036 .dac_nids
= alc883_dac_nids
,
8037 .dig_out_nid
= ALC883_DIGOUT_NID
,
8038 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8039 .channel_mode
= alc883_3ST_2ch_modes
,
8040 .input_mux
= &alc883_capture_source
,
8041 .unsol_event
= alc883_tagra_unsol_event
,
8042 .init_hook
= alc883_tagra_automute
,
8045 .mixers
= { alc883_base_mixer
},
8046 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8047 * and the headphone jack. Turn this on and rely on the
8048 * standard mute methods whenever the user wants to turn
8049 * these outputs off.
8051 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
8052 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8053 .dac_nids
= alc883_dac_nids
,
8054 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8055 .channel_mode
= alc883_3ST_2ch_modes
,
8056 .input_mux
= &alc883_capture_source
,
8058 [ALC883_ACER_ASPIRE
] = {
8059 .mixers
= { alc883_acer_aspire_mixer
},
8060 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
8061 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8062 .dac_nids
= alc883_dac_nids
,
8063 .dig_out_nid
= ALC883_DIGOUT_NID
,
8064 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8065 .channel_mode
= alc883_3ST_2ch_modes
,
8066 .input_mux
= &alc883_capture_source
,
8067 .unsol_event
= alc883_acer_aspire_unsol_event
,
8068 .init_hook
= alc883_acer_aspire_automute
,
8071 .mixers
= { alc883_fivestack_mixer
,
8072 alc883_chmode_mixer
},
8073 .init_verbs
= { alc883_init_verbs
,
8074 alc883_medion_eapd_verbs
},
8075 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8076 .dac_nids
= alc883_dac_nids
,
8077 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8078 .channel_mode
= alc883_sixstack_modes
,
8079 .input_mux
= &alc883_capture_source
,
8081 [ALC883_MEDION_MD2
] = {
8082 .mixers
= { alc883_medion_md2_mixer
},
8083 .init_verbs
= { alc883_init_verbs
, alc883_medion_md2_verbs
},
8084 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8085 .dac_nids
= alc883_dac_nids
,
8086 .dig_out_nid
= ALC883_DIGOUT_NID
,
8087 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8088 .channel_mode
= alc883_3ST_2ch_modes
,
8089 .input_mux
= &alc883_capture_source
,
8090 .unsol_event
= alc883_medion_md2_unsol_event
,
8091 .init_hook
= alc883_medion_md2_automute
,
8093 [ALC883_LAPTOP_EAPD
] = {
8094 .mixers
= { alc883_base_mixer
},
8095 .init_verbs
= { alc883_init_verbs
, alc882_eapd_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_CLEVO_M720
] = {
8103 .mixers
= { alc883_clevo_m720_mixer
},
8104 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720_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_clevo_m720_unsol_event
,
8112 .init_hook
= alc883_clevo_m720_automute
,
8114 [ALC883_LENOVO_101E_2ch
] = {
8115 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
8116 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
8117 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8118 .dac_nids
= alc883_dac_nids
,
8119 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8120 .channel_mode
= alc883_3ST_2ch_modes
,
8121 .input_mux
= &alc883_lenovo_101e_capture_source
,
8122 .unsol_event
= alc883_lenovo_101e_unsol_event
,
8123 .init_hook
= alc883_lenovo_101e_all_automute
,
8125 [ALC883_LENOVO_NB0763
] = {
8126 .mixers
= { alc883_lenovo_nb0763_mixer
},
8127 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
8128 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8129 .dac_nids
= alc883_dac_nids
,
8130 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8131 .channel_mode
= alc883_3ST_2ch_modes
,
8133 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
8134 .unsol_event
= alc883_medion_md2_unsol_event
,
8135 .init_hook
= alc883_medion_md2_automute
,
8137 [ALC888_LENOVO_MS7195_DIG
] = {
8138 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8139 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
8140 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8141 .dac_nids
= alc883_dac_nids
,
8142 .dig_out_nid
= ALC883_DIGOUT_NID
,
8143 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
8144 .channel_mode
= alc883_3ST_6ch_modes
,
8146 .input_mux
= &alc883_capture_source
,
8147 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
8148 .init_hook
= alc888_lenovo_ms7195_front_automute
,
8150 [ALC883_HAIER_W66
] = {
8151 .mixers
= { alc883_tagra_2ch_mixer
},
8152 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
8153 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8154 .dac_nids
= alc883_dac_nids
,
8155 .dig_out_nid
= ALC883_DIGOUT_NID
,
8156 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8157 .channel_mode
= alc883_3ST_2ch_modes
,
8158 .input_mux
= &alc883_capture_source
,
8159 .unsol_event
= alc883_haier_w66_unsol_event
,
8160 .init_hook
= alc883_haier_w66_automute
,
8163 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
8164 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
8165 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8166 .dac_nids
= alc883_dac_nids
,
8167 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
8168 .channel_mode
= alc888_3st_hp_modes
,
8170 .input_mux
= &alc883_capture_source
,
8172 [ALC888_6ST_DELL
] = {
8173 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
8174 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
8175 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8176 .dac_nids
= alc883_dac_nids
,
8177 .dig_out_nid
= ALC883_DIGOUT_NID
,
8178 .dig_in_nid
= ALC883_DIGIN_NID
,
8179 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8180 .channel_mode
= alc883_sixstack_modes
,
8181 .input_mux
= &alc883_capture_source
,
8182 .unsol_event
= alc888_6st_dell_unsol_event
,
8183 .init_hook
= alc888_6st_dell_front_automute
,
8186 .mixers
= { alc883_mitac_mixer
},
8187 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
8188 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8189 .dac_nids
= alc883_dac_nids
,
8190 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8191 .channel_mode
= alc883_3ST_2ch_modes
,
8192 .input_mux
= &alc883_capture_source
,
8193 .unsol_event
= alc883_mitac_unsol_event
,
8194 .init_hook
= alc883_mitac_automute
,
8196 [ALC883_FUJITSU_PI2515
] = {
8197 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
8198 .init_verbs
= { alc883_init_verbs
,
8199 alc883_2ch_fujitsu_pi2515_verbs
},
8200 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8201 .dac_nids
= alc883_dac_nids
,
8202 .dig_out_nid
= ALC883_DIGOUT_NID
,
8203 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8204 .channel_mode
= alc883_3ST_2ch_modes
,
8205 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
8206 .unsol_event
= alc883_2ch_fujitsu_pi2515_unsol_event
,
8207 .init_hook
= alc883_2ch_fujitsu_pi2515_automute
,
8213 * BIOS auto configuration
8215 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
8216 hda_nid_t nid
, int pin_type
,
8220 struct alc_spec
*spec
= codec
->spec
;
8223 alc_set_pin_output(codec
, nid
, pin_type
);
8224 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
8227 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
8228 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
8232 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
8234 struct alc_spec
*spec
= codec
->spec
;
8237 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
8238 for (i
= 0; i
<= HDA_SIDE
; i
++) {
8239 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
8240 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
8242 alc883_auto_set_output_and_unmute(codec
, nid
, pin_type
,
8247 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
8249 struct alc_spec
*spec
= codec
->spec
;
8252 pin
= spec
->autocfg
.hp_pins
[0];
8253 if (pin
) /* connect to front */
8255 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
8256 pin
= spec
->autocfg
.speaker_pins
[0];
8258 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
8261 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8262 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8264 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
8266 struct alc_spec
*spec
= codec
->spec
;
8269 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
8270 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
8271 if (alc883_is_input_pin(nid
)) {
8272 snd_hda_codec_write(codec
, nid
, 0,
8273 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8274 (i
<= AUTO_PIN_FRONT_MIC
?
8275 PIN_VREF80
: PIN_IN
));
8276 if (nid
!= ALC883_PIN_CD_NID
)
8277 snd_hda_codec_write(codec
, nid
, 0,
8278 AC_VERB_SET_AMP_GAIN_MUTE
,
8284 /* almost identical with ALC880 parser... */
8285 static int alc883_parse_auto_config(struct hda_codec
*codec
)
8287 struct alc_spec
*spec
= codec
->spec
;
8288 int err
= alc880_parse_auto_config(codec
);
8293 return 0; /* no config found */
8295 err
= alc_auto_add_mic_boost(codec
);
8299 /* hack - override the init verbs */
8300 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
8301 spec
->mixers
[spec
->num_mixers
] = alc883_capture_mixer
;
8304 return 1; /* config found */
8307 /* additional initialization for auto-configuration model */
8308 static void alc883_auto_init(struct hda_codec
*codec
)
8310 struct alc_spec
*spec
= codec
->spec
;
8311 alc883_auto_init_multi_out(codec
);
8312 alc883_auto_init_hp_out(codec
);
8313 alc883_auto_init_analog_input(codec
);
8314 if (spec
->unsol_event
)
8315 alc_sku_automute(codec
);
8318 static int patch_alc883(struct hda_codec
*codec
)
8320 struct alc_spec
*spec
;
8321 int err
, board_config
;
8323 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
8329 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
8331 board_config
= snd_hda_check_board_config(codec
, ALC883_MODEL_LAST
,
8334 if (board_config
< 0) {
8335 printk(KERN_INFO
"hda_codec: Unknown model for ALC883, "
8336 "trying auto-probe from BIOS...\n");
8337 board_config
= ALC883_AUTO
;
8340 if (board_config
== ALC883_AUTO
) {
8341 /* automatic parse from the BIOS config */
8342 err
= alc883_parse_auto_config(codec
);
8348 "hda_codec: Cannot set up configuration "
8349 "from BIOS. Using base mode...\n");
8350 board_config
= ALC883_3ST_2ch_DIG
;
8354 if (board_config
!= ALC883_AUTO
)
8355 setup_preset(spec
, &alc883_presets
[board_config
]);
8357 switch (codec
->vendor_id
) {
8359 spec
->stream_name_analog
= "ALC888 Analog";
8360 spec
->stream_name_digital
= "ALC888 Digital";
8363 spec
->stream_name_analog
= "ALC889 Analog";
8364 spec
->stream_name_digital
= "ALC889 Digital";
8367 spec
->stream_name_analog
= "ALC883 Analog";
8368 spec
->stream_name_digital
= "ALC883 Digital";
8372 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
8373 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
8374 spec
->stream_analog_alt_capture
= &alc883_pcm_analog_alt_capture
;
8376 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
8377 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
8379 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
8380 spec
->adc_nids
= alc883_adc_nids
;
8381 spec
->capsrc_nids
= alc883_capsrc_nids
;
8383 spec
->vmaster_nid
= 0x0c;
8385 codec
->patch_ops
= alc_patch_ops
;
8386 if (board_config
== ALC883_AUTO
)
8387 spec
->init_hook
= alc883_auto_init
;
8388 else if (codec
->vendor_id
== 0x10ec0888)
8389 spec
->init_hook
= alc888_coef_init
;
8391 #ifdef CONFIG_SND_HDA_POWER_SAVE
8392 if (!spec
->loopback
.amplist
)
8393 spec
->loopback
.amplist
= alc883_loopbacks
;
8403 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8404 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8406 #define alc262_dac_nids alc260_dac_nids
8407 #define alc262_adc_nids alc882_adc_nids
8408 #define alc262_adc_nids_alt alc882_adc_nids_alt
8409 #define alc262_capsrc_nids alc882_capsrc_nids
8410 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8412 #define alc262_modes alc260_modes
8413 #define alc262_capture_source alc882_capture_source
8415 static struct snd_kcontrol_new alc262_base_mixer
[] = {
8416 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8417 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8418 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8419 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8420 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8421 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8423 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8424 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8425 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8426 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8427 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8428 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8429 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8430 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
8431 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8432 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8433 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
8437 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
8438 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8439 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8440 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8441 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8442 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8443 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8444 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8445 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8446 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8447 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8448 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8449 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8450 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8451 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8452 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8453 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8457 /* update HP, line and mono-out pins according to the master switch */
8458 static void alc262_hp_master_update(struct hda_codec
*codec
)
8460 struct alc_spec
*spec
= codec
->spec
;
8461 int val
= spec
->master_sw
;
8464 snd_hda_codec_write_cache(codec
, 0x1b, 0,
8465 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8467 snd_hda_codec_write_cache(codec
, 0x15, 0,
8468 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8470 /* mono (speaker) depending on the HP jack sense */
8471 val
= val
&& !spec
->jack_present
;
8472 snd_hda_codec_write_cache(codec
, 0x16, 0,
8473 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8477 static void alc262_hp_bpc_automute(struct hda_codec
*codec
)
8479 struct alc_spec
*spec
= codec
->spec
;
8480 unsigned int presence
;
8481 presence
= snd_hda_codec_read(codec
, 0x1b, 0,
8482 AC_VERB_GET_PIN_SENSE
, 0);
8483 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
8484 alc262_hp_master_update(codec
);
8487 static void alc262_hp_bpc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
8489 if ((res
>> 26) != ALC880_HP_EVENT
)
8491 alc262_hp_bpc_automute(codec
);
8494 static void alc262_hp_wildwest_automute(struct hda_codec
*codec
)
8496 struct alc_spec
*spec
= codec
->spec
;
8497 unsigned int presence
;
8498 presence
= snd_hda_codec_read(codec
, 0x15, 0,
8499 AC_VERB_GET_PIN_SENSE
, 0);
8500 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
8501 alc262_hp_master_update(codec
);
8504 static void alc262_hp_wildwest_unsol_event(struct hda_codec
*codec
,
8507 if ((res
>> 26) != ALC880_HP_EVENT
)
8509 alc262_hp_wildwest_automute(codec
);
8512 static int alc262_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
8513 struct snd_ctl_elem_value
*ucontrol
)
8515 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8516 struct alc_spec
*spec
= codec
->spec
;
8517 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
8521 static int alc262_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
8522 struct snd_ctl_elem_value
*ucontrol
)
8524 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8525 struct alc_spec
*spec
= codec
->spec
;
8526 int val
= !!*ucontrol
->value
.integer
.value
;
8528 if (val
== spec
->master_sw
)
8530 spec
->master_sw
= val
;
8531 alc262_hp_master_update(codec
);
8535 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
8537 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8538 .name
= "Master Playback Switch",
8539 .info
= snd_ctl_boolean_mono_info
,
8540 .get
= alc262_hp_master_sw_get
,
8541 .put
= alc262_hp_master_sw_put
,
8543 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8544 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8545 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8546 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8548 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8550 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8551 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8552 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8553 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8554 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8555 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8556 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8557 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8558 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8559 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8560 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
8561 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
8562 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
8563 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
8567 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
8569 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8570 .name
= "Master Playback Switch",
8571 .info
= snd_ctl_boolean_mono_info
,
8572 .get
= alc262_hp_master_sw_get
,
8573 .put
= alc262_hp_master_sw_put
,
8575 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8576 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8577 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8578 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8579 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8581 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8583 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8584 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8585 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT
),
8586 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8587 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8588 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8589 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8590 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
8591 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
8595 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
8596 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8597 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8598 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT
),
8602 /* mute/unmute internal speaker according to the hp jack and mute state */
8603 static void alc262_hp_t5735_automute(struct hda_codec
*codec
, int force
)
8605 struct alc_spec
*spec
= codec
->spec
;
8607 if (force
|| !spec
->sense_updated
) {
8608 unsigned int present
;
8609 present
= snd_hda_codec_read(codec
, 0x15, 0,
8610 AC_VERB_GET_PIN_SENSE
, 0);
8611 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
8612 spec
->sense_updated
= 1;
8614 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0, HDA_AMP_MUTE
,
8615 spec
->jack_present
? HDA_AMP_MUTE
: 0);
8618 static void alc262_hp_t5735_unsol_event(struct hda_codec
*codec
,
8621 if ((res
>> 26) != ALC880_HP_EVENT
)
8623 alc262_hp_t5735_automute(codec
, 1);
8626 static void alc262_hp_t5735_init_hook(struct hda_codec
*codec
)
8628 alc262_hp_t5735_automute(codec
, 1);
8631 static struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
8632 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8633 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8634 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8635 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8636 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8637 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8638 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8642 static struct hda_verb alc262_hp_t5735_verbs
[] = {
8643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8644 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8646 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8650 static struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
8651 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8652 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8653 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
8654 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
8655 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8656 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8660 static struct hda_verb alc262_hp_rp5700_verbs
[] = {
8661 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8662 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8663 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8664 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8665 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8666 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8668 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8669 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
8670 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
8674 static struct hda_input_mux alc262_hp_rp5700_capture_source
= {
8681 /* bind hp and internal speaker mute (with plug check) */
8682 static int alc262_sony_master_sw_put(struct snd_kcontrol
*kcontrol
,
8683 struct snd_ctl_elem_value
*ucontrol
)
8685 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8686 long *valp
= ucontrol
->value
.integer
.value
;
8689 /* change hp mute */
8690 change
= snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
8692 valp
[0] ? 0 : HDA_AMP_MUTE
);
8693 change
|= snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
8695 valp
[1] ? 0 : HDA_AMP_MUTE
);
8697 /* change speaker according to HP jack state */
8698 struct alc_spec
*spec
= codec
->spec
;
8700 if (spec
->jack_present
)
8701 mute
= HDA_AMP_MUTE
;
8703 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0,
8705 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8706 HDA_AMP_MUTE
, mute
);
8711 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
8712 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8714 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8715 .name
= "Master Playback Switch",
8716 .info
= snd_hda_mixer_amp_switch_info
,
8717 .get
= snd_hda_mixer_amp_switch_get
,
8718 .put
= alc262_sony_master_sw_put
,
8719 .private_value
= HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
8721 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8722 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8723 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8724 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8728 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
8729 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8730 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8731 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8734 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8735 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8739 #define alc262_capture_mixer alc882_capture_mixer
8740 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8743 * generic initialization of ADC, input mixers and output mixers
8745 static struct hda_verb alc262_init_verbs
[] = {
8747 * Unmute ADC0-2 and set the default input to mic-in
8749 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8750 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8751 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8752 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8753 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8754 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8756 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8758 * Note: PASD motherboards uses the Line In 2 as the input for
8759 * front panel mic (mic 2)
8761 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8762 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8763 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8764 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8765 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8766 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8769 * Set up output mixers (0x0c - 0x0e)
8771 /* set vol=0 to output mixers */
8772 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8773 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8774 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8775 /* set up input amps for analog loopback */
8776 /* Amp Indices: DAC = 0, mixer = 1 */
8777 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8779 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8780 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8781 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8782 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8784 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8785 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8786 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8787 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8788 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8789 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8791 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8793 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8794 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8797 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8798 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8800 /* FIXME: use matrix-type input source selection */
8801 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8802 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8803 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8804 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8805 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8806 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8808 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8809 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8810 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8811 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8813 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8814 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8815 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8816 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8821 static struct hda_verb alc262_hippo_unsol_verbs
[] = {
8822 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8823 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8827 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
8828 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8829 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8830 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8832 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8833 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8837 static struct hda_verb alc262_sony_unsol_verbs
[] = {
8838 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8839 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8840 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
8842 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8843 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8847 /* mute/unmute internal speaker according to the hp jack and mute state */
8848 static void alc262_hippo_automute(struct hda_codec
*codec
)
8850 struct alc_spec
*spec
= codec
->spec
;
8852 unsigned int present
;
8854 /* need to execute and sync at first */
8855 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
8856 present
= snd_hda_codec_read(codec
, 0x15, 0,
8857 AC_VERB_GET_PIN_SENSE
, 0);
8858 spec
->jack_present
= (present
& 0x80000000) != 0;
8859 if (spec
->jack_present
) {
8860 /* mute internal speaker */
8861 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8862 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8864 /* unmute internal speaker if necessary */
8865 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
8866 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8867 HDA_AMP_MUTE
, mute
);
8871 /* unsolicited event for HP jack sensing */
8872 static void alc262_hippo_unsol_event(struct hda_codec
*codec
,
8875 if ((res
>> 26) != ALC880_HP_EVENT
)
8877 alc262_hippo_automute(codec
);
8880 static void alc262_hippo1_automute(struct hda_codec
*codec
)
8883 unsigned int present
;
8885 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
8886 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8887 AC_VERB_GET_PIN_SENSE
, 0);
8888 present
= (present
& 0x80000000) != 0;
8890 /* mute internal speaker */
8891 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8892 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8894 /* unmute internal speaker if necessary */
8895 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
8896 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8897 HDA_AMP_MUTE
, mute
);
8901 /* unsolicited event for HP jack sensing */
8902 static void alc262_hippo1_unsol_event(struct hda_codec
*codec
,
8905 if ((res
>> 26) != ALC880_HP_EVENT
)
8907 alc262_hippo1_automute(codec
);
8912 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
8913 * 0x1b = port replicator headphone out
8916 #define ALC_HP_EVENT 0x37
8918 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
8919 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
8920 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8921 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
8922 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8926 static struct hda_verb alc262_lenovo_3000_unsol_verbs
[] = {
8927 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
8928 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8932 static struct hda_input_mux alc262_fujitsu_capture_source
= {
8941 static struct hda_input_mux alc262_HP_capture_source
= {
8945 { "Front Mic", 0x1 },
8952 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
8956 { "Front Mic", 0x2 },
8962 /* mute/unmute internal speaker according to the hp jacks and mute state */
8963 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
8965 struct alc_spec
*spec
= codec
->spec
;
8968 if (force
|| !spec
->sense_updated
) {
8969 unsigned int present
;
8970 /* need to execute and sync at first */
8971 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
8972 /* check laptop HP jack */
8973 present
= snd_hda_codec_read(codec
, 0x14, 0,
8974 AC_VERB_GET_PIN_SENSE
, 0);
8975 /* need to execute and sync at first */
8976 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
8977 /* check docking HP jack */
8978 present
|= snd_hda_codec_read(codec
, 0x1b, 0,
8979 AC_VERB_GET_PIN_SENSE
, 0);
8980 if (present
& AC_PINSENSE_PRESENCE
)
8981 spec
->jack_present
= 1;
8983 spec
->jack_present
= 0;
8984 spec
->sense_updated
= 1;
8986 /* unmute internal speaker only if both HPs are unplugged and
8987 * master switch is on
8989 if (spec
->jack_present
)
8990 mute
= HDA_AMP_MUTE
;
8992 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
8993 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8994 HDA_AMP_MUTE
, mute
);
8997 /* unsolicited event for HP jack sensing */
8998 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
9001 if ((res
>> 26) != ALC_HP_EVENT
)
9003 alc262_fujitsu_automute(codec
, 1);
9006 static void alc262_fujitsu_init_hook(struct hda_codec
*codec
)
9008 alc262_fujitsu_automute(codec
, 1);
9011 /* bind volumes of both NID 0x0c and 0x0d */
9012 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
9013 .ops
= &snd_hda_bind_vol
,
9015 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
9016 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
9021 /* mute/unmute internal speaker according to the hp jack and mute state */
9022 static void alc262_lenovo_3000_automute(struct hda_codec
*codec
, int force
)
9024 struct alc_spec
*spec
= codec
->spec
;
9027 if (force
|| !spec
->sense_updated
) {
9028 unsigned int present_int_hp
;
9029 /* need to execute and sync at first */
9030 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
9031 present_int_hp
= snd_hda_codec_read(codec
, 0x1b, 0,
9032 AC_VERB_GET_PIN_SENSE
, 0);
9033 spec
->jack_present
= (present_int_hp
& 0x80000000) != 0;
9034 spec
->sense_updated
= 1;
9036 if (spec
->jack_present
) {
9037 /* mute internal speaker */
9038 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9039 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9040 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9041 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
9043 /* unmute internal speaker if necessary */
9044 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
9045 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9046 HDA_AMP_MUTE
, mute
);
9047 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
9048 HDA_AMP_MUTE
, mute
);
9052 /* unsolicited event for HP jack sensing */
9053 static void alc262_lenovo_3000_unsol_event(struct hda_codec
*codec
,
9056 if ((res
>> 26) != ALC_HP_EVENT
)
9058 alc262_lenovo_3000_automute(codec
, 1);
9061 /* bind hp and internal speaker mute (with plug check) */
9062 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
9063 struct snd_ctl_elem_value
*ucontrol
)
9065 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9066 long *valp
= ucontrol
->value
.integer
.value
;
9069 change
= snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9071 valp
? 0 : HDA_AMP_MUTE
);
9072 change
|= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
9074 valp
? 0 : HDA_AMP_MUTE
);
9077 alc262_fujitsu_automute(codec
, 0);
9081 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
9082 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
9084 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9085 .name
= "Master Playback Switch",
9086 .info
= snd_hda_mixer_amp_switch_info
,
9087 .get
= snd_hda_mixer_amp_switch_get
,
9088 .put
= alc262_fujitsu_master_sw_put
,
9089 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
9091 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9092 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9093 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT
),
9094 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT
),
9095 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9096 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9097 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9098 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
9099 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9100 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9104 /* bind hp and internal speaker mute (with plug check) */
9105 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol
*kcontrol
,
9106 struct snd_ctl_elem_value
*ucontrol
)
9108 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9109 long *valp
= ucontrol
->value
.integer
.value
;
9112 change
= snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
9114 valp
? 0 : HDA_AMP_MUTE
);
9117 alc262_lenovo_3000_automute(codec
, 0);
9121 static struct snd_kcontrol_new alc262_lenovo_3000_mixer
[] = {
9122 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
9124 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9125 .name
= "Master Playback Switch",
9126 .info
= snd_hda_mixer_amp_switch_info
,
9127 .get
= snd_hda_mixer_amp_switch_get
,
9128 .put
= alc262_lenovo_3000_master_sw_put
,
9129 .private_value
= HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT
),
9131 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
9132 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
9133 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
9135 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
9136 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
9137 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
9138 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
9142 /* additional init verbs for Benq laptops */
9143 static struct hda_verb alc262_EAPD_verbs
[] = {
9144 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9145 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
9149 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
9150 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9151 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9153 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
9154 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
9158 /* Samsung Q1 Ultra Vista model setup */
9159 static struct snd_kcontrol_new alc262_ultra_mixer
[] = {
9160 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
9161 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
9162 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
9163 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
9164 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
9165 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT
),
9169 static struct hda_verb alc262_ultra_verbs
[] = {
9171 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9172 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9173 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9175 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9176 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9177 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9178 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
9180 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9181 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9183 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9184 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
9186 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
9187 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9188 /* ADC, choose mic */
9189 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9190 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9191 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9192 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
9198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(8)},
9202 /* mute/unmute internal speaker according to the hp jack and mute state */
9203 static void alc262_ultra_automute(struct hda_codec
*codec
)
9205 struct alc_spec
*spec
= codec
->spec
;
9209 /* auto-mute only when HP is used as HP */
9210 if (!spec
->cur_mux
[0]) {
9211 unsigned int present
;
9212 /* need to execute and sync at first */
9213 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
9214 present
= snd_hda_codec_read(codec
, 0x15, 0,
9215 AC_VERB_GET_PIN_SENSE
, 0);
9216 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
9217 if (spec
->jack_present
)
9218 mute
= HDA_AMP_MUTE
;
9220 /* mute/unmute internal speaker */
9221 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9222 HDA_AMP_MUTE
, mute
);
9223 /* mute/unmute HP */
9224 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9225 HDA_AMP_MUTE
, mute
? 0 : HDA_AMP_MUTE
);
9228 /* unsolicited event for HP jack sensing */
9229 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
9232 if ((res
>> 26) != ALC880_HP_EVENT
)
9234 alc262_ultra_automute(codec
);
9237 static struct hda_input_mux alc262_ultra_capture_source
= {
9241 { "Headphone", 0x7 },
9245 static int alc262_ultra_mux_enum_put(struct snd_kcontrol
*kcontrol
,
9246 struct snd_ctl_elem_value
*ucontrol
)
9248 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9249 struct alc_spec
*spec
= codec
->spec
;
9252 ret
= alc882_mux_enum_put(kcontrol
, ucontrol
);
9255 /* reprogram the HP pin as mic or HP according to the input source */
9256 snd_hda_codec_write_cache(codec
, 0x15, 0,
9257 AC_VERB_SET_PIN_WIDGET_CONTROL
,
9258 spec
->cur_mux
[0] ? PIN_VREF80
: PIN_HP
);
9259 alc262_ultra_automute(codec
); /* mute/unmute HP */
9263 static struct snd_kcontrol_new alc262_ultra_capture_mixer
[] = {
9264 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
9265 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
9267 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9268 .name
= "Capture Source",
9269 .info
= alc882_mux_enum_info
,
9270 .get
= alc882_mux_enum_get
,
9271 .put
= alc262_ultra_mux_enum_put
,
9276 /* add playback controls from the parsed DAC table */
9277 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
9278 const struct auto_pin_cfg
*cfg
)
9283 spec
->multiout
.num_dacs
= 1; /* only use one dac */
9284 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
9285 spec
->multiout
.dac_nids
[0] = 2;
9287 nid
= cfg
->line_out_pins
[0];
9289 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9290 "Front Playback Volume",
9291 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
));
9294 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9295 "Front Playback Switch",
9296 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
9301 nid
= cfg
->speaker_pins
[0];
9304 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9305 "Speaker Playback Volume",
9306 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9310 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9311 "Speaker Playback Switch",
9312 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
9317 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9318 "Speaker Playback Switch",
9319 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
9325 nid
= cfg
->hp_pins
[0];
9327 /* spec->multiout.hp_nid = 2; */
9329 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9330 "Headphone Playback Volume",
9331 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
9335 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9336 "Headphone Playback Switch",
9337 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
9342 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9343 "Headphone Playback Switch",
9344 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
9353 /* identical with ALC880 */
9354 #define alc262_auto_create_analog_input_ctls \
9355 alc880_auto_create_analog_input_ctls
9358 * generic initialization of ADC, input mixers and output mixers
9360 static struct hda_verb alc262_volume_init_verbs
[] = {
9362 * Unmute ADC0-2 and set the default input to mic-in
9364 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9365 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9366 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9367 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9368 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9369 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9371 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9373 * Note: PASD motherboards uses the Line In 2 as the input for
9374 * front panel mic (mic 2)
9376 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9379 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9380 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9381 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9384 * Set up output mixers (0x0c - 0x0f)
9386 /* set vol=0 to output mixers */
9387 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9388 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9389 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9391 /* set up input amps for analog loopback */
9392 /* Amp Indices: DAC = 0, mixer = 1 */
9393 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9394 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9395 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9396 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9397 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9398 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9400 /* FIXME: use matrix-type input source selection */
9401 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9402 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9403 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9404 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9405 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9406 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9408 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9409 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9410 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9413 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9414 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9415 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9421 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
9423 * Unmute ADC0-2 and set the default input to mic-in
9425 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9426 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9427 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9428 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9429 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9430 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9432 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9434 * Note: PASD motherboards uses the Line In 2 as the input for
9435 * front panel mic (mic 2)
9437 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9438 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9439 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9440 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9441 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9442 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9443 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9444 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9447 * Set up output mixers (0x0c - 0x0e)
9449 /* set vol=0 to output mixers */
9450 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9451 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9452 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9454 /* set up input amps for analog loopback */
9455 /* Amp Indices: DAC = 0, mixer = 1 */
9456 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9457 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9458 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9459 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9460 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9461 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9463 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9464 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9465 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9467 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9468 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9470 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9471 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9473 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9474 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9475 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9476 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9477 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9479 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
9480 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9481 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9482 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
9483 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9484 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9487 /* FIXME: use matrix-type input source selection */
9488 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9489 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9490 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9491 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9492 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9493 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9495 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9496 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9497 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9498 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9500 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9501 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9502 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9505 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9510 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
9512 * Unmute ADC0-2 and set the default input to mic-in
9514 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9515 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9516 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9517 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9518 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9519 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9521 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9523 * Note: PASD motherboards uses the Line In 2 as the input for front
9526 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9527 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9529 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9530 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9531 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9532 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9533 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9534 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
9536 * Set up output mixers (0x0c - 0x0e)
9538 /* set vol=0 to output mixers */
9539 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9540 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9541 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9543 /* set up input amps for analog loopback */
9544 /* Amp Indices: DAC = 0, mixer = 1 */
9545 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9546 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9547 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9548 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9549 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9550 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9553 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
9554 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
9555 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
9556 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
9557 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
9558 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
9559 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
9561 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9562 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9564 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9565 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
9567 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9568 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9569 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9570 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
9571 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9572 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9574 /* FIXME: use matrix-type input source selection */
9575 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9576 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9577 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9578 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
9579 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
9580 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
9581 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
9582 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9583 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
9585 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9586 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9587 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9588 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9589 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9590 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9591 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
9593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9595 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9596 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9598 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9599 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
9601 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9606 #ifdef CONFIG_SND_HDA_POWER_SAVE
9607 #define alc262_loopbacks alc880_loopbacks
9610 /* pcm configuration: identiacal with ALC880 */
9611 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9612 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9613 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9614 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9617 * BIOS auto configuration
9619 static int alc262_parse_auto_config(struct hda_codec
*codec
)
9621 struct alc_spec
*spec
= codec
->spec
;
9623 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
9625 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
9629 if (!spec
->autocfg
.line_outs
)
9630 return 0; /* can't find valid BIOS pin config */
9631 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
9634 err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
9638 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
9640 if (spec
->autocfg
.dig_out_pin
)
9641 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
9642 if (spec
->autocfg
.dig_in_pin
)
9643 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
9645 if (spec
->kctl_alloc
)
9646 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
9648 spec
->init_verbs
[spec
->num_init_verbs
++] = alc262_volume_init_verbs
;
9649 spec
->num_mux_defs
= 1;
9650 spec
->input_mux
= &spec
->private_imux
;
9652 err
= alc_auto_add_mic_boost(codec
);
9659 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9660 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9661 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9664 /* init callback for auto-configuration model -- overriding the default init */
9665 static void alc262_auto_init(struct hda_codec
*codec
)
9667 struct alc_spec
*spec
= codec
->spec
;
9668 alc262_auto_init_multi_out(codec
);
9669 alc262_auto_init_hp_out(codec
);
9670 alc262_auto_init_analog_input(codec
);
9671 if (spec
->unsol_event
)
9672 alc_sku_automute(codec
);
9676 * configuration and preset
9678 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
9679 [ALC262_BASIC
] = "basic",
9680 [ALC262_HIPPO
] = "hippo",
9681 [ALC262_HIPPO_1
] = "hippo_1",
9682 [ALC262_FUJITSU
] = "fujitsu",
9683 [ALC262_HP_BPC
] = "hp-bpc",
9684 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
9685 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
9686 [ALC262_HP_RP5700
] = "hp-rp5700",
9687 [ALC262_BENQ_ED8
] = "benq",
9688 [ALC262_BENQ_T31
] = "benq-t31",
9689 [ALC262_SONY_ASSAMD
] = "sony-assamd",
9690 [ALC262_ULTRA
] = "ultra",
9691 [ALC262_LENOVO_3000
] = "lenovo-3000",
9692 [ALC262_AUTO
] = "auto",
9695 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
9696 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
9697 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC
),
9698 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC
),
9699 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC
),
9700 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC
),
9701 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC
),
9702 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC
),
9703 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC
),
9704 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC
),
9705 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9706 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9707 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9708 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9709 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9710 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9711 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9712 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9713 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
9714 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
9715 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
9716 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9717 ALC262_HP_TC_T5735
),
9718 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
9719 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
9720 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
9721 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
9722 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
9723 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD
),
9724 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
9725 ALC262_SONY_ASSAMD
),
9726 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
9727 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
9728 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA
),
9729 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA
),
9730 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000
),
9731 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
9732 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
9733 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
9737 static struct alc_config_preset alc262_presets
[] = {
9739 .mixers
= { alc262_base_mixer
},
9740 .init_verbs
= { alc262_init_verbs
},
9741 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9742 .dac_nids
= alc262_dac_nids
,
9744 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9745 .channel_mode
= alc262_modes
,
9746 .input_mux
= &alc262_capture_source
,
9749 .mixers
= { alc262_base_mixer
},
9750 .init_verbs
= { alc262_init_verbs
, alc262_hippo_unsol_verbs
},
9751 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9752 .dac_nids
= alc262_dac_nids
,
9754 .dig_out_nid
= ALC262_DIGOUT_NID
,
9755 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9756 .channel_mode
= alc262_modes
,
9757 .input_mux
= &alc262_capture_source
,
9758 .unsol_event
= alc262_hippo_unsol_event
,
9759 .init_hook
= alc262_hippo_automute
,
9761 [ALC262_HIPPO_1
] = {
9762 .mixers
= { alc262_hippo1_mixer
},
9763 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
9764 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9765 .dac_nids
= alc262_dac_nids
,
9767 .dig_out_nid
= ALC262_DIGOUT_NID
,
9768 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9769 .channel_mode
= alc262_modes
,
9770 .input_mux
= &alc262_capture_source
,
9771 .unsol_event
= alc262_hippo1_unsol_event
,
9772 .init_hook
= alc262_hippo1_automute
,
9774 [ALC262_FUJITSU
] = {
9775 .mixers
= { alc262_fujitsu_mixer
},
9776 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
9777 alc262_fujitsu_unsol_verbs
},
9778 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9779 .dac_nids
= alc262_dac_nids
,
9781 .dig_out_nid
= ALC262_DIGOUT_NID
,
9782 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9783 .channel_mode
= alc262_modes
,
9784 .input_mux
= &alc262_fujitsu_capture_source
,
9785 .unsol_event
= alc262_fujitsu_unsol_event
,
9786 .init_hook
= alc262_fujitsu_init_hook
,
9789 .mixers
= { alc262_HP_BPC_mixer
},
9790 .init_verbs
= { alc262_HP_BPC_init_verbs
},
9791 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9792 .dac_nids
= alc262_dac_nids
,
9794 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9795 .channel_mode
= alc262_modes
,
9796 .input_mux
= &alc262_HP_capture_source
,
9797 .unsol_event
= alc262_hp_bpc_unsol_event
,
9798 .init_hook
= alc262_hp_bpc_automute
,
9800 [ALC262_HP_BPC_D7000_WF
] = {
9801 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
9802 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
9803 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9804 .dac_nids
= alc262_dac_nids
,
9806 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9807 .channel_mode
= alc262_modes
,
9808 .input_mux
= &alc262_HP_D7000_capture_source
,
9809 .unsol_event
= alc262_hp_wildwest_unsol_event
,
9810 .init_hook
= alc262_hp_wildwest_automute
,
9812 [ALC262_HP_BPC_D7000_WL
] = {
9813 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
9814 alc262_HP_BPC_WildWest_option_mixer
},
9815 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
9816 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9817 .dac_nids
= alc262_dac_nids
,
9819 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9820 .channel_mode
= alc262_modes
,
9821 .input_mux
= &alc262_HP_D7000_capture_source
,
9822 .unsol_event
= alc262_hp_wildwest_unsol_event
,
9823 .init_hook
= alc262_hp_wildwest_automute
,
9825 [ALC262_HP_TC_T5735
] = {
9826 .mixers
= { alc262_hp_t5735_mixer
},
9827 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
9828 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9829 .dac_nids
= alc262_dac_nids
,
9831 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9832 .channel_mode
= alc262_modes
,
9833 .input_mux
= &alc262_capture_source
,
9834 .unsol_event
= alc262_hp_t5735_unsol_event
,
9835 .init_hook
= alc262_hp_t5735_init_hook
,
9837 [ALC262_HP_RP5700
] = {
9838 .mixers
= { alc262_hp_rp5700_mixer
},
9839 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
9840 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9841 .dac_nids
= alc262_dac_nids
,
9842 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9843 .channel_mode
= alc262_modes
,
9844 .input_mux
= &alc262_hp_rp5700_capture_source
,
9846 [ALC262_BENQ_ED8
] = {
9847 .mixers
= { alc262_base_mixer
},
9848 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
9849 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9850 .dac_nids
= alc262_dac_nids
,
9852 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9853 .channel_mode
= alc262_modes
,
9854 .input_mux
= &alc262_capture_source
,
9856 [ALC262_SONY_ASSAMD
] = {
9857 .mixers
= { alc262_sony_mixer
},
9858 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
9859 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9860 .dac_nids
= alc262_dac_nids
,
9862 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9863 .channel_mode
= alc262_modes
,
9864 .input_mux
= &alc262_capture_source
,
9865 .unsol_event
= alc262_hippo_unsol_event
,
9866 .init_hook
= alc262_hippo_automute
,
9868 [ALC262_BENQ_T31
] = {
9869 .mixers
= { alc262_benq_t31_mixer
},
9870 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
, alc262_hippo_unsol_verbs
},
9871 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9872 .dac_nids
= alc262_dac_nids
,
9874 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9875 .channel_mode
= alc262_modes
,
9876 .input_mux
= &alc262_capture_source
,
9877 .unsol_event
= alc262_hippo_unsol_event
,
9878 .init_hook
= alc262_hippo_automute
,
9881 .mixers
= { alc262_ultra_mixer
, alc262_ultra_capture_mixer
},
9882 .init_verbs
= { alc262_ultra_verbs
},
9883 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9884 .dac_nids
= alc262_dac_nids
,
9885 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9886 .channel_mode
= alc262_modes
,
9887 .input_mux
= &alc262_ultra_capture_source
,
9888 .adc_nids
= alc262_adc_nids
, /* ADC0 */
9889 .capsrc_nids
= alc262_capsrc_nids
,
9890 .num_adc_nids
= 1, /* single ADC */
9891 .unsol_event
= alc262_ultra_unsol_event
,
9892 .init_hook
= alc262_ultra_automute
,
9894 [ALC262_LENOVO_3000
] = {
9895 .mixers
= { alc262_lenovo_3000_mixer
},
9896 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
9897 alc262_lenovo_3000_unsol_verbs
},
9898 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9899 .dac_nids
= alc262_dac_nids
,
9901 .dig_out_nid
= ALC262_DIGOUT_NID
,
9902 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9903 .channel_mode
= alc262_modes
,
9904 .input_mux
= &alc262_fujitsu_capture_source
,
9905 .unsol_event
= alc262_lenovo_3000_unsol_event
,
9909 static int patch_alc262(struct hda_codec
*codec
)
9911 struct alc_spec
*spec
;
9915 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
9921 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9926 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
9927 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
9928 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
9929 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
9933 alc_fix_pll_init(codec
, 0x20, 0x0a, 10);
9935 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
9939 if (board_config
< 0) {
9940 printk(KERN_INFO
"hda_codec: Unknown model for ALC262, "
9941 "trying auto-probe from BIOS...\n");
9942 board_config
= ALC262_AUTO
;
9945 if (board_config
== ALC262_AUTO
) {
9946 /* automatic parse from the BIOS config */
9947 err
= alc262_parse_auto_config(codec
);
9953 "hda_codec: Cannot set up configuration "
9954 "from BIOS. Using base mode...\n");
9955 board_config
= ALC262_BASIC
;
9959 if (board_config
!= ALC262_AUTO
)
9960 setup_preset(spec
, &alc262_presets
[board_config
]);
9962 spec
->stream_name_analog
= "ALC262 Analog";
9963 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
9964 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
9966 spec
->stream_name_digital
= "ALC262 Digital";
9967 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
9968 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
9970 if (!spec
->adc_nids
&& spec
->input_mux
) {
9971 /* check whether NID 0x07 is valid */
9972 unsigned int wcap
= get_wcaps(codec
, 0x07);
9975 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
9976 if (wcap
!= AC_WID_AUD_IN
) {
9977 spec
->adc_nids
= alc262_adc_nids_alt
;
9978 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids_alt
);
9979 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
9980 spec
->mixers
[spec
->num_mixers
] =
9981 alc262_capture_alt_mixer
;
9984 spec
->adc_nids
= alc262_adc_nids
;
9985 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids
);
9986 spec
->capsrc_nids
= alc262_capsrc_nids
;
9987 spec
->mixers
[spec
->num_mixers
] = alc262_capture_mixer
;
9992 spec
->vmaster_nid
= 0x0c;
9994 codec
->patch_ops
= alc_patch_ops
;
9995 if (board_config
== ALC262_AUTO
)
9996 spec
->init_hook
= alc262_auto_init
;
9997 #ifdef CONFIG_SND_HDA_POWER_SAVE
9998 if (!spec
->loopback
.amplist
)
9999 spec
->loopback
.amplist
= alc262_loopbacks
;
10006 * ALC268 channel source setting (2 channel)
10008 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
10009 #define alc268_modes alc260_modes
10011 static hda_nid_t alc268_dac_nids
[2] = {
10016 static hda_nid_t alc268_adc_nids
[2] = {
10021 static hda_nid_t alc268_adc_nids_alt
[1] = {
10026 static hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
10028 static struct snd_kcontrol_new alc268_base_mixer
[] = {
10029 /* output mixer control */
10030 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
10031 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10032 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
10033 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10034 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10035 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10036 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
10040 /* bind Beep switches of both NID 0x0f and 0x10 */
10041 static struct hda_bind_ctls alc268_bind_beep_sw
= {
10042 .ops
= &snd_hda_bind_sw
,
10044 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
10045 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
10050 static struct snd_kcontrol_new alc268_beep_mixer
[] = {
10051 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
10052 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
10056 static struct hda_verb alc268_eapd_verbs
[] = {
10057 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10058 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10062 /* Toshiba specific */
10063 #define alc268_toshiba_automute alc262_hippo_automute
10065 static struct hda_verb alc268_toshiba_verbs
[] = {
10066 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10070 /* Acer specific */
10071 /* bind volumes of both NID 0x02 and 0x03 */
10072 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
10073 .ops
= &snd_hda_bind_vol
,
10075 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
10076 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
10081 /* mute/unmute internal speaker according to the hp jack and mute state */
10082 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
10084 struct alc_spec
*spec
= codec
->spec
;
10087 if (force
|| !spec
->sense_updated
) {
10088 unsigned int present
;
10089 present
= snd_hda_codec_read(codec
, 0x14, 0,
10090 AC_VERB_GET_PIN_SENSE
, 0);
10091 spec
->jack_present
= (present
& 0x80000000) != 0;
10092 spec
->sense_updated
= 1;
10094 if (spec
->jack_present
)
10095 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
10096 else /* unmute internal speaker if necessary */
10097 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
10098 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
10099 HDA_AMP_MUTE
, mute
);
10103 /* bind hp and internal speaker mute (with plug check) */
10104 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
10105 struct snd_ctl_elem_value
*ucontrol
)
10107 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10108 long *valp
= ucontrol
->value
.integer
.value
;
10111 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
10113 valp
[0] ? 0 : HDA_AMP_MUTE
);
10114 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
10116 valp
[1] ? 0 : HDA_AMP_MUTE
);
10118 alc268_acer_automute(codec
, 0);
10122 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
10123 /* output mixer control */
10124 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
10126 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10127 .name
= "Master Playback Switch",
10128 .info
= snd_hda_mixer_amp_switch_info
,
10129 .get
= snd_hda_mixer_amp_switch_get
,
10130 .put
= alc268_acer_master_sw_put
,
10131 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
10133 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10134 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
10135 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
10139 static struct hda_verb alc268_acer_verbs
[] = {
10140 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* internal dmic? */
10141 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10142 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10143 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10144 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10145 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10147 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10151 /* unsolicited event for HP jack sensing */
10152 static void alc268_toshiba_unsol_event(struct hda_codec
*codec
,
10155 if ((res
>> 26) != ALC880_HP_EVENT
)
10157 alc268_toshiba_automute(codec
);
10160 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
10163 if ((res
>> 26) != ALC880_HP_EVENT
)
10165 alc268_acer_automute(codec
, 1);
10168 static void alc268_acer_init_hook(struct hda_codec
*codec
)
10170 alc268_acer_automute(codec
, 1);
10173 static struct snd_kcontrol_new alc268_dell_mixer
[] = {
10174 /* output mixer control */
10175 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10176 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10177 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10178 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10179 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10180 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
10184 static struct hda_verb alc268_dell_verbs
[] = {
10185 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10186 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10187 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10191 /* mute/unmute internal speaker according to the hp jack and mute state */
10192 static void alc268_dell_automute(struct hda_codec
*codec
)
10194 unsigned int present
;
10197 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0);
10198 if (present
& 0x80000000)
10199 mute
= HDA_AMP_MUTE
;
10201 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
10202 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10203 HDA_AMP_MUTE
, mute
);
10206 static void alc268_dell_unsol_event(struct hda_codec
*codec
,
10209 if ((res
>> 26) != ALC880_HP_EVENT
)
10211 alc268_dell_automute(codec
);
10214 #define alc268_dell_init_hook alc268_dell_automute
10216 static struct snd_kcontrol_new alc267_quanta_il1_mixer
[] = {
10217 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
10218 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10219 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
10220 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10221 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10222 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT
),
10223 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
10224 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
10228 static struct hda_verb alc267_quanta_il1_verbs
[] = {
10229 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
10230 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_MIC_EVENT
| AC_USRSP_EN
},
10234 static void alc267_quanta_il1_hp_automute(struct hda_codec
*codec
)
10236 unsigned int present
;
10238 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0)
10239 & AC_PINSENSE_PRESENCE
;
10240 snd_hda_codec_write(codec
, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
10241 present
? 0 : PIN_OUT
);
10244 static void alc267_quanta_il1_mic_automute(struct hda_codec
*codec
)
10246 unsigned int present
;
10248 present
= snd_hda_codec_read(codec
, 0x18, 0,
10249 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
10250 snd_hda_codec_write(codec
, 0x23, 0,
10251 AC_VERB_SET_CONNECT_SEL
,
10252 present
? 0x00 : 0x01);
10255 static void alc267_quanta_il1_automute(struct hda_codec
*codec
)
10257 alc267_quanta_il1_hp_automute(codec
);
10258 alc267_quanta_il1_mic_automute(codec
);
10261 static void alc267_quanta_il1_unsol_event(struct hda_codec
*codec
,
10264 switch (res
>> 26) {
10265 case ALC880_HP_EVENT
:
10266 alc267_quanta_il1_hp_automute(codec
);
10268 case ALC880_MIC_EVENT
:
10269 alc267_quanta_il1_mic_automute(codec
);
10275 * generic initialization of ADC, input mixers and output mixers
10277 static struct hda_verb alc268_base_init_verbs
[] = {
10278 /* Unmute DAC0-1 and set vol = 0 */
10279 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10280 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10281 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10282 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10283 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10284 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10287 * Set up output mixers (0x0c - 0x0e)
10289 /* set vol=0 to output mixers */
10290 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10291 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10292 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10293 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
10295 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10296 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10298 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
10299 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
10300 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
10301 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10302 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10303 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10304 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10305 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10307 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10308 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10309 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10310 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10311 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10312 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10313 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10315 /* set PCBEEP vol = 0, mute connections */
10316 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10317 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10318 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10320 /* Unmute Selector 23h,24h and set the default input to mic-in */
10322 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
10323 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10324 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
10325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10331 * generic initialization of ADC, input mixers and output mixers
10333 static struct hda_verb alc268_volume_init_verbs
[] = {
10334 /* set output DAC */
10335 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10336 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10337 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10338 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10340 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10341 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
10342 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10343 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10344 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
10346 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10349 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10350 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10352 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10353 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10354 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10355 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10357 /* set PCBEEP vol = 0, mute connections */
10358 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10359 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10360 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10365 #define alc268_mux_enum_info alc_mux_enum_info
10366 #define alc268_mux_enum_get alc_mux_enum_get
10367 #define alc268_mux_enum_put alc_mux_enum_put
10369 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
10370 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10371 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
10373 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10374 /* The multiple "Capture Source" controls confuse alsamixer
10375 * So call somewhat different..
10377 /* .name = "Capture Source", */
10378 .name
= "Input Source",
10380 .info
= alc268_mux_enum_info
,
10381 .get
= alc268_mux_enum_get
,
10382 .put
= alc268_mux_enum_put
,
10387 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
10388 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10389 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
10390 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
10391 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
10393 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10394 /* The multiple "Capture Source" controls confuse alsamixer
10395 * So call somewhat different..
10397 /* .name = "Capture Source", */
10398 .name
= "Input Source",
10400 .info
= alc268_mux_enum_info
,
10401 .get
= alc268_mux_enum_get
,
10402 .put
= alc268_mux_enum_put
,
10407 static struct hda_input_mux alc268_capture_source
= {
10411 { "Front Mic", 0x1 },
10417 static struct hda_input_mux alc268_acer_capture_source
= {
10421 { "Internal Mic", 0x6 },
10426 #ifdef CONFIG_SND_DEBUG
10427 static struct snd_kcontrol_new alc268_test_mixer
[] = {
10428 /* Volume widgets */
10429 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10430 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10431 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
10432 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
10433 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
10434 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
10435 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
10436 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
10437 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
10438 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
10439 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
10440 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
10441 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
10442 /* The below appears problematic on some hardwares */
10443 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10444 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10445 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
10446 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
10447 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
10449 /* Modes for retasking pin widgets */
10450 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
10451 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
10452 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
10453 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
10455 /* Controls for GPIO pins, assuming they are configured as outputs */
10456 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10457 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10458 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10459 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10461 /* Switches to allow the digital SPDIF output pin to be enabled.
10462 * The ALC268 does not have an SPDIF input.
10464 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10466 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10467 * this output to turn on an external amplifier.
10469 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10470 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10476 /* create input playback/capture controls for the given pin */
10477 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
10478 const char *ctlname
, int idx
)
10483 sprintf(name
, "%s Playback Volume", ctlname
);
10485 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
10486 HDA_COMPOSE_AMP_VAL(0x02, 3, idx
,
10490 } else if (nid
== 0x15) {
10491 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
10492 HDA_COMPOSE_AMP_VAL(0x03, 3, idx
,
10498 sprintf(name
, "%s Playback Switch", ctlname
);
10499 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
10500 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
10506 /* add playback controls from the parsed DAC table */
10507 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
10508 const struct auto_pin_cfg
*cfg
)
10513 spec
->multiout
.num_dacs
= 2; /* only use one dac */
10514 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
10515 spec
->multiout
.dac_nids
[0] = 2;
10516 spec
->multiout
.dac_nids
[1] = 3;
10518 nid
= cfg
->line_out_pins
[0];
10520 alc268_new_analog_output(spec
, nid
, "Front", 0);
10522 nid
= cfg
->speaker_pins
[0];
10524 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10525 "Speaker Playback Volume",
10526 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
10530 nid
= cfg
->hp_pins
[0];
10532 alc268_new_analog_output(spec
, nid
, "Headphone", 0);
10534 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
10536 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10537 "Mono Playback Switch",
10538 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_INPUT
));
10545 /* create playback/capture controls for input pins */
10546 static int alc268_auto_create_analog_input_ctls(struct alc_spec
*spec
,
10547 const struct auto_pin_cfg
*cfg
)
10549 struct hda_input_mux
*imux
= &spec
->private_imux
;
10552 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
10553 switch(cfg
->input_pins
[i
]) {
10555 idx1
= 0; /* Mic 1 */
10558 idx1
= 1; /* Mic 2 */
10561 idx1
= 2; /* Line In */
10568 idx1
= 6; /* digital mics */
10573 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
10574 imux
->items
[imux
->num_items
].index
= idx1
;
10580 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
10582 struct alc_spec
*spec
= codec
->spec
;
10583 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
10584 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
10585 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
10586 unsigned int dac_vol1
, dac_vol2
;
10589 snd_hda_codec_write(codec
, speaker_nid
, 0,
10590 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
10591 snd_hda_codec_write(codec
, 0x0f, 0,
10592 AC_VERB_SET_AMP_GAIN_MUTE
,
10594 snd_hda_codec_write(codec
, 0x10, 0,
10595 AC_VERB_SET_AMP_GAIN_MUTE
,
10598 snd_hda_codec_write(codec
, 0x0f, 0,
10599 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
10600 snd_hda_codec_write(codec
, 0x10, 0,
10601 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
10604 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
10605 if (line_nid
== 0x14)
10606 dac_vol2
= AMP_OUT_ZERO
;
10607 else if (line_nid
== 0x15)
10608 dac_vol1
= AMP_OUT_ZERO
;
10609 if (hp_nid
== 0x14)
10610 dac_vol2
= AMP_OUT_ZERO
;
10611 else if (hp_nid
== 0x15)
10612 dac_vol1
= AMP_OUT_ZERO
;
10613 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
10614 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
10615 spec
->autocfg
.line_out_pins
[2] != 0x16)
10616 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
10618 snd_hda_codec_write(codec
, 0x02, 0,
10619 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
10620 snd_hda_codec_write(codec
, 0x03, 0,
10621 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
10624 /* pcm configuration: identiacal with ALC880 */
10625 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10626 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10627 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10628 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10631 * BIOS auto configuration
10633 static int alc268_parse_auto_config(struct hda_codec
*codec
)
10635 struct alc_spec
*spec
= codec
->spec
;
10637 static hda_nid_t alc268_ignore
[] = { 0 };
10639 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10643 if (!spec
->autocfg
.line_outs
)
10644 return 0; /* can't find valid BIOS pin config */
10646 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
10649 err
= alc268_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
10653 spec
->multiout
.max_channels
= 2;
10655 /* digital only support output */
10656 if (spec
->autocfg
.dig_out_pin
)
10657 spec
->multiout
.dig_out_nid
= ALC268_DIGOUT_NID
;
10659 if (spec
->kctl_alloc
)
10660 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
10662 if (spec
->autocfg
.speaker_pins
[0] != 0x1d)
10663 spec
->mixers
[spec
->num_mixers
++] = alc268_beep_mixer
;
10665 spec
->init_verbs
[spec
->num_init_verbs
++] = alc268_volume_init_verbs
;
10666 spec
->num_mux_defs
= 1;
10667 spec
->input_mux
= &spec
->private_imux
;
10669 err
= alc_auto_add_mic_boost(codec
);
10676 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10677 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10678 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10680 /* init callback for auto-configuration model -- overriding the default init */
10681 static void alc268_auto_init(struct hda_codec
*codec
)
10683 struct alc_spec
*spec
= codec
->spec
;
10684 alc268_auto_init_multi_out(codec
);
10685 alc268_auto_init_hp_out(codec
);
10686 alc268_auto_init_mono_speaker_out(codec
);
10687 alc268_auto_init_analog_input(codec
);
10688 if (spec
->unsol_event
)
10689 alc_sku_automute(codec
);
10693 * configuration and preset
10695 static const char *alc268_models
[ALC268_MODEL_LAST
] = {
10696 [ALC267_QUANTA_IL1
] = "quanta-il1",
10697 [ALC268_3ST
] = "3stack",
10698 [ALC268_TOSHIBA
] = "toshiba",
10699 [ALC268_ACER
] = "acer",
10700 [ALC268_DELL
] = "dell",
10701 [ALC268_ZEPTO
] = "zepto",
10702 #ifdef CONFIG_SND_DEBUG
10703 [ALC268_TEST
] = "test",
10705 [ALC268_AUTO
] = "auto",
10708 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
10709 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER
),
10710 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
10711 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
10712 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
10713 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
10714 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
10715 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA
),
10716 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
10717 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA
),
10718 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA
),
10719 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA
),
10720 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
10721 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1
),
10722 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
10726 static struct alc_config_preset alc268_presets
[] = {
10727 [ALC267_QUANTA_IL1
] = {
10728 .mixers
= { alc267_quanta_il1_mixer
},
10729 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10730 alc267_quanta_il1_verbs
},
10731 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10732 .dac_nids
= alc268_dac_nids
,
10733 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10734 .adc_nids
= alc268_adc_nids_alt
,
10736 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10737 .channel_mode
= alc268_modes
,
10738 .input_mux
= &alc268_capture_source
,
10739 .unsol_event
= alc267_quanta_il1_unsol_event
,
10740 .init_hook
= alc267_quanta_il1_automute
,
10743 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
10744 alc268_beep_mixer
},
10745 .init_verbs
= { alc268_base_init_verbs
},
10746 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10747 .dac_nids
= alc268_dac_nids
,
10748 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10749 .adc_nids
= alc268_adc_nids_alt
,
10750 .capsrc_nids
= alc268_capsrc_nids
,
10752 .dig_out_nid
= ALC268_DIGOUT_NID
,
10753 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10754 .channel_mode
= alc268_modes
,
10755 .input_mux
= &alc268_capture_source
,
10757 [ALC268_TOSHIBA
] = {
10758 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
10759 alc268_beep_mixer
},
10760 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10761 alc268_toshiba_verbs
},
10762 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10763 .dac_nids
= alc268_dac_nids
,
10764 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10765 .adc_nids
= alc268_adc_nids_alt
,
10766 .capsrc_nids
= alc268_capsrc_nids
,
10768 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10769 .channel_mode
= alc268_modes
,
10770 .input_mux
= &alc268_capture_source
,
10771 .unsol_event
= alc268_toshiba_unsol_event
,
10772 .init_hook
= alc268_toshiba_automute
,
10775 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
10776 alc268_beep_mixer
},
10777 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10778 alc268_acer_verbs
},
10779 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10780 .dac_nids
= alc268_dac_nids
,
10781 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10782 .adc_nids
= alc268_adc_nids_alt
,
10783 .capsrc_nids
= alc268_capsrc_nids
,
10785 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10786 .channel_mode
= alc268_modes
,
10787 .input_mux
= &alc268_acer_capture_source
,
10788 .unsol_event
= alc268_acer_unsol_event
,
10789 .init_hook
= alc268_acer_init_hook
,
10792 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
},
10793 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10794 alc268_dell_verbs
},
10795 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10796 .dac_nids
= alc268_dac_nids
,
10798 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10799 .channel_mode
= alc268_modes
,
10800 .unsol_event
= alc268_dell_unsol_event
,
10801 .init_hook
= alc268_dell_init_hook
,
10802 .input_mux
= &alc268_capture_source
,
10805 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
10806 alc268_beep_mixer
},
10807 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10808 alc268_toshiba_verbs
},
10809 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10810 .dac_nids
= alc268_dac_nids
,
10811 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10812 .adc_nids
= alc268_adc_nids_alt
,
10813 .capsrc_nids
= alc268_capsrc_nids
,
10815 .dig_out_nid
= ALC268_DIGOUT_NID
,
10816 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10817 .channel_mode
= alc268_modes
,
10818 .input_mux
= &alc268_capture_source
,
10819 .unsol_event
= alc268_toshiba_unsol_event
,
10820 .init_hook
= alc268_toshiba_automute
10822 #ifdef CONFIG_SND_DEBUG
10824 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
10825 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10826 alc268_volume_init_verbs
},
10827 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10828 .dac_nids
= alc268_dac_nids
,
10829 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10830 .adc_nids
= alc268_adc_nids_alt
,
10831 .capsrc_nids
= alc268_capsrc_nids
,
10833 .dig_out_nid
= ALC268_DIGOUT_NID
,
10834 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10835 .channel_mode
= alc268_modes
,
10836 .input_mux
= &alc268_capture_source
,
10841 static int patch_alc268(struct hda_codec
*codec
)
10843 struct alc_spec
*spec
;
10847 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
10851 codec
->spec
= spec
;
10853 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
10857 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
10858 printk(KERN_INFO
"hda_codec: Unknown model for ALC268, "
10859 "trying auto-probe from BIOS...\n");
10860 board_config
= ALC268_AUTO
;
10863 if (board_config
== ALC268_AUTO
) {
10864 /* automatic parse from the BIOS config */
10865 err
= alc268_parse_auto_config(codec
);
10871 "hda_codec: Cannot set up configuration "
10872 "from BIOS. Using base mode...\n");
10873 board_config
= ALC268_3ST
;
10877 if (board_config
!= ALC268_AUTO
)
10878 setup_preset(spec
, &alc268_presets
[board_config
]);
10880 if (codec
->vendor_id
== 0x10ec0267) {
10881 spec
->stream_name_analog
= "ALC267 Analog";
10882 spec
->stream_name_digital
= "ALC267 Digital";
10884 spec
->stream_name_analog
= "ALC268 Analog";
10885 spec
->stream_name_digital
= "ALC268 Digital";
10888 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
10889 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
10890 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
10892 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
10894 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
10895 /* override the amp caps for beep generator */
10896 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
10897 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
10898 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
10899 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
10900 (0 << AC_AMPCAP_MUTE_SHIFT
));
10902 if (!spec
->adc_nids
&& spec
->input_mux
) {
10903 /* check whether NID 0x07 is valid */
10904 unsigned int wcap
= get_wcaps(codec
, 0x07);
10908 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
10909 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
10910 spec
->adc_nids
= alc268_adc_nids_alt
;
10911 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
10912 spec
->mixers
[spec
->num_mixers
] =
10913 alc268_capture_alt_mixer
;
10914 spec
->num_mixers
++;
10916 spec
->adc_nids
= alc268_adc_nids
;
10917 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
10918 spec
->mixers
[spec
->num_mixers
] =
10919 alc268_capture_mixer
;
10920 spec
->num_mixers
++;
10922 spec
->capsrc_nids
= alc268_capsrc_nids
;
10923 /* set default input source */
10924 for (i
= 0; i
< spec
->num_adc_nids
; i
++)
10925 snd_hda_codec_write_cache(codec
, alc268_capsrc_nids
[i
],
10926 0, AC_VERB_SET_CONNECT_SEL
,
10927 spec
->input_mux
->items
[0].index
);
10930 spec
->vmaster_nid
= 0x02;
10932 codec
->patch_ops
= alc_patch_ops
;
10933 if (board_config
== ALC268_AUTO
)
10934 spec
->init_hook
= alc268_auto_init
;
10940 * ALC269 channel source setting (2 channel)
10942 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10944 #define alc269_dac_nids alc260_dac_nids
10946 static hda_nid_t alc269_adc_nids
[1] = {
10951 #define alc269_modes alc260_modes
10952 #define alc269_capture_source alc880_lg_lw_capture_source
10954 static struct snd_kcontrol_new alc269_base_mixer
[] = {
10955 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10956 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10957 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10958 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10959 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10960 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10961 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10962 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10963 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10964 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10965 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10966 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
10970 /* capture mixer elements */
10971 static struct snd_kcontrol_new alc269_capture_mixer
[] = {
10972 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
10973 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
10975 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10976 /* The multiple "Capture Source" controls confuse alsamixer
10977 * So call somewhat different..
10979 /* .name = "Capture Source", */
10980 .name
= "Input Source",
10982 .info
= alc_mux_enum_info
,
10983 .get
= alc_mux_enum_get
,
10984 .put
= alc_mux_enum_put
,
10990 * generic initialization of ADC, input mixers and output mixers
10992 static struct hda_verb alc269_init_verbs
[] = {
10994 * Unmute ADC0 and set the default input to mic-in
10996 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10998 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10999 * analog-loopback mixer widget
11000 * Note: PASD motherboards uses the Line In 2 as the input for
11001 * front panel mic (mic 2)
11003 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11004 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11005 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11006 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11007 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11008 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11011 * Set up output mixers (0x0c - 0x0e)
11013 /* set vol=0 to output mixers */
11014 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11015 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11017 /* set up input amps for analog loopback */
11018 /* Amp Indices: DAC = 0, mixer = 1 */
11019 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11020 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11021 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11022 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11023 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11024 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11026 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11027 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11028 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11029 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11030 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11031 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11032 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11034 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11035 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11036 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11037 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11038 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11039 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11040 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11042 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11043 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
11045 /* FIXME: use matrix-type input source selection */
11046 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
11047 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11048 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11049 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11050 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11051 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11054 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11055 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11059 /* add playback controls from the parsed DAC table */
11060 static int alc269_auto_create_multi_out_ctls(struct alc_spec
*spec
,
11061 const struct auto_pin_cfg
*cfg
)
11066 spec
->multiout
.num_dacs
= 1; /* only use one dac */
11067 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
11068 spec
->multiout
.dac_nids
[0] = 2;
11070 nid
= cfg
->line_out_pins
[0];
11072 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11073 "Front Playback Volume",
11074 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
));
11077 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11078 "Front Playback Switch",
11079 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
11084 nid
= cfg
->speaker_pins
[0];
11086 if (!cfg
->line_out_pins
[0]) {
11087 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11088 "Speaker Playback Volume",
11089 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11095 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11096 "Speaker Playback Switch",
11097 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
11102 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11103 "Speaker Playback Switch",
11104 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
11110 nid
= cfg
->hp_pins
[0];
11112 /* spec->multiout.hp_nid = 2; */
11113 if (!cfg
->line_out_pins
[0] && !cfg
->speaker_pins
[0]) {
11114 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11115 "Headphone Playback Volume",
11116 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
11122 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11123 "Headphone Playback Switch",
11124 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
11129 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11130 "Headphone Playback Switch",
11131 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
11140 #define alc269_auto_create_analog_input_ctls \
11141 alc880_auto_create_analog_input_ctls
11143 #ifdef CONFIG_SND_HDA_POWER_SAVE
11144 #define alc269_loopbacks alc880_loopbacks
11147 /* pcm configuration: identiacal with ALC880 */
11148 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
11149 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
11150 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
11151 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
11154 * BIOS auto configuration
11156 static int alc269_parse_auto_config(struct hda_codec
*codec
)
11158 struct alc_spec
*spec
= codec
->spec
;
11160 static hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
11162 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
11167 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
11170 err
= alc269_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
11174 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
11176 if (spec
->autocfg
.dig_out_pin
)
11177 spec
->multiout
.dig_out_nid
= ALC269_DIGOUT_NID
;
11179 if (spec
->kctl_alloc
)
11180 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
11182 spec
->init_verbs
[spec
->num_init_verbs
++] = alc269_init_verbs
;
11183 spec
->num_mux_defs
= 1;
11184 spec
->input_mux
= &spec
->private_imux
;
11186 err
= alc_auto_add_mic_boost(codec
);
11193 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
11194 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
11195 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
11198 /* init callback for auto-configuration model -- overriding the default init */
11199 static void alc269_auto_init(struct hda_codec
*codec
)
11201 struct alc_spec
*spec
= codec
->spec
;
11202 alc269_auto_init_multi_out(codec
);
11203 alc269_auto_init_hp_out(codec
);
11204 alc269_auto_init_analog_input(codec
);
11205 if (spec
->unsol_event
)
11206 alc_sku_automute(codec
);
11210 * configuration and preset
11212 static const char *alc269_models
[ALC269_MODEL_LAST
] = {
11213 [ALC269_BASIC
] = "basic",
11216 static struct snd_pci_quirk alc269_cfg_tbl
[] = {
11220 static struct alc_config_preset alc269_presets
[] = {
11222 .mixers
= { alc269_base_mixer
},
11223 .init_verbs
= { alc269_init_verbs
},
11224 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
11225 .dac_nids
= alc269_dac_nids
,
11227 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
11228 .channel_mode
= alc269_modes
,
11229 .input_mux
= &alc269_capture_source
,
11233 static int patch_alc269(struct hda_codec
*codec
)
11235 struct alc_spec
*spec
;
11239 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
11243 codec
->spec
= spec
;
11245 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
11247 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
11251 if (board_config
< 0) {
11252 printk(KERN_INFO
"hda_codec: Unknown model for ALC269, "
11253 "trying auto-probe from BIOS...\n");
11254 board_config
= ALC269_AUTO
;
11257 if (board_config
== ALC269_AUTO
) {
11258 /* automatic parse from the BIOS config */
11259 err
= alc269_parse_auto_config(codec
);
11265 "hda_codec: Cannot set up configuration "
11266 "from BIOS. Using base mode...\n");
11267 board_config
= ALC269_BASIC
;
11271 if (board_config
!= ALC269_AUTO
)
11272 setup_preset(spec
, &alc269_presets
[board_config
]);
11274 spec
->stream_name_analog
= "ALC269 Analog";
11275 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
11276 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
11278 spec
->stream_name_digital
= "ALC269 Digital";
11279 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
11280 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
11282 spec
->adc_nids
= alc269_adc_nids
;
11283 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
11284 spec
->mixers
[spec
->num_mixers
] = alc269_capture_mixer
;
11285 spec
->num_mixers
++;
11287 codec
->patch_ops
= alc_patch_ops
;
11288 if (board_config
== ALC269_AUTO
)
11289 spec
->init_hook
= alc269_auto_init
;
11290 #ifdef CONFIG_SND_HDA_POWER_SAVE
11291 if (!spec
->loopback
.amplist
)
11292 spec
->loopback
.amplist
= alc269_loopbacks
;
11299 * ALC861 channel source setting (2/6 channel selection for 3-stack)
11303 * set the path ways for 2 channel output
11304 * need to set the codec line out and mic 1 pin widgets to inputs
11306 static struct hda_verb alc861_threestack_ch2_init
[] = {
11307 /* set pin widget 1Ah (line in) for input */
11308 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11309 /* set pin widget 18h (mic1/2) for input, for mic also enable
11312 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11314 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
11316 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
11317 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
11323 * need to set the codec line out and mic 1 pin widgets to outputs
11325 static struct hda_verb alc861_threestack_ch6_init
[] = {
11326 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11327 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11328 /* set pin widget 18h (mic1) for output (CLFE)*/
11329 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11331 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11332 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11334 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
11336 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
11337 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
11342 static struct hda_channel_mode alc861_threestack_modes
[2] = {
11343 { 2, alc861_threestack_ch2_init
},
11344 { 6, alc861_threestack_ch6_init
},
11346 /* Set mic1 as input and unmute the mixer */
11347 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
11348 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11349 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
11352 /* Set mic1 as output and mute mixer */
11353 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
11354 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11355 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
11359 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
11360 { 2, alc861_uniwill_m31_ch2_init
},
11361 { 4, alc861_uniwill_m31_ch4_init
},
11364 /* Set mic1 and line-in as input and unmute the mixer */
11365 static struct hda_verb alc861_asus_ch2_init
[] = {
11366 /* set pin widget 1Ah (line in) for input */
11367 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11368 /* set pin widget 18h (mic1/2) for input, for mic also enable
11371 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11373 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
11375 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
11376 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
11380 /* Set mic1 nad line-in as output and mute mixer */
11381 static struct hda_verb alc861_asus_ch6_init
[] = {
11382 /* set pin widget 1Ah (line in) for output (Back Surround)*/
11383 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11384 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11385 /* set pin widget 18h (mic1) for output (CLFE)*/
11386 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11387 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
11388 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11389 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11391 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
11393 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
11394 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
11399 static struct hda_channel_mode alc861_asus_modes
[2] = {
11400 { 2, alc861_asus_ch2_init
},
11401 { 6, alc861_asus_ch6_init
},
11406 static struct snd_kcontrol_new alc861_base_mixer
[] = {
11407 /* output mixer control */
11408 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11409 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11410 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11411 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11412 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
11414 /*Input mixer control */
11415 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11416 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11417 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11418 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11419 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11420 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11421 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11422 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11423 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11424 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
11426 /* Capture mixer control */
11427 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11428 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11430 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11431 .name
= "Capture Source",
11433 .info
= alc_mux_enum_info
,
11434 .get
= alc_mux_enum_get
,
11435 .put
= alc_mux_enum_put
,
11440 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
11441 /* output mixer control */
11442 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11443 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11444 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11445 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11446 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11448 /* Input mixer control */
11449 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11450 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11451 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11452 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11453 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11454 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11455 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11456 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11457 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11458 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
11460 /* Capture mixer control */
11461 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11462 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11464 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11465 .name
= "Capture Source",
11467 .info
= alc_mux_enum_info
,
11468 .get
= alc_mux_enum_get
,
11469 .put
= alc_mux_enum_put
,
11472 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11473 .name
= "Channel Mode",
11474 .info
= alc_ch_mode_info
,
11475 .get
= alc_ch_mode_get
,
11476 .put
= alc_ch_mode_put
,
11477 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
11482 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
11483 /* output mixer control */
11484 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11486 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11488 /*Capture mixer control */
11489 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11490 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11492 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11493 .name
= "Capture Source",
11495 .info
= alc_mux_enum_info
,
11496 .get
= alc_mux_enum_get
,
11497 .put
= alc_mux_enum_put
,
11503 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
11504 /* output mixer control */
11505 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11506 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11507 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11508 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11509 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11511 /* Input mixer control */
11512 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11513 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11514 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11515 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11516 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11517 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11518 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11519 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11520 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11521 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
11523 /* Capture mixer control */
11524 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11525 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11527 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11528 .name
= "Capture Source",
11530 .info
= alc_mux_enum_info
,
11531 .get
= alc_mux_enum_get
,
11532 .put
= alc_mux_enum_put
,
11535 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11536 .name
= "Channel Mode",
11537 .info
= alc_ch_mode_info
,
11538 .get
= alc_ch_mode_get
,
11539 .put
= alc_ch_mode_put
,
11540 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
11545 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
11546 /* output mixer control */
11547 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11548 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11549 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11550 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11551 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
11553 /* Input mixer control */
11554 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
11555 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11556 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11557 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11558 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11559 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11560 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11561 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11562 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11563 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
11565 /* Capture mixer control */
11566 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11567 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11569 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11570 .name
= "Capture Source",
11572 .info
= alc_mux_enum_info
,
11573 .get
= alc_mux_enum_get
,
11574 .put
= alc_mux_enum_put
,
11577 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11578 .name
= "Channel Mode",
11579 .info
= alc_ch_mode_info
,
11580 .get
= alc_ch_mode_get
,
11581 .put
= alc_ch_mode_put
,
11582 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
11587 /* additional mixer */
11588 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
11589 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11590 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11591 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT
),
11592 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT
),
11597 * generic initialization of ADC, input mixers and output mixers
11599 static struct hda_verb alc861_base_init_verbs
[] = {
11601 * Unmute ADC0 and set the default input to mic-in
11603 /* port-A for surround (rear panel) */
11604 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11605 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11606 /* port-B for mic-in (rear panel) with vref */
11607 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11608 /* port-C for line-in (rear panel) */
11609 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11610 /* port-D for Front */
11611 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11612 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11613 /* port-E for HP out (front panel) */
11614 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
11615 /* route front PCM to HP */
11616 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11617 /* port-F for mic-in (front panel) with vref */
11618 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11619 /* port-G for CLFE (rear panel) */
11620 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11621 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11622 /* port-H for side (rear panel) */
11623 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11624 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11626 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11627 /* route front mic to ADC1*/
11628 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11629 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11631 /* Unmute DAC0~3 & spdif out*/
11632 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11633 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11634 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11635 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11638 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11639 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11640 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11641 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11642 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11644 /* Unmute Stereo Mixer 15 */
11645 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11646 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11647 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11648 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
11650 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11651 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11652 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11653 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11654 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11655 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11656 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11657 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11658 /* hp used DAC 3 (Front) */
11659 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11660 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11665 static struct hda_verb alc861_threestack_init_verbs
[] = {
11667 * Unmute ADC0 and set the default input to mic-in
11669 /* port-A for surround (rear panel) */
11670 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11671 /* port-B for mic-in (rear panel) with vref */
11672 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11673 /* port-C for line-in (rear panel) */
11674 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11675 /* port-D for Front */
11676 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11677 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11678 /* port-E for HP out (front panel) */
11679 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
11680 /* route front PCM to HP */
11681 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11682 /* port-F for mic-in (front panel) with vref */
11683 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11684 /* port-G for CLFE (rear panel) */
11685 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11686 /* port-H for side (rear panel) */
11687 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11689 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11690 /* route front mic to ADC1*/
11691 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11692 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11693 /* Unmute DAC0~3 & spdif out*/
11694 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11695 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11696 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11697 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11700 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11701 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11702 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11703 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11704 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11706 /* Unmute Stereo Mixer 15 */
11707 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11708 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11709 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11710 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
11712 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11713 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11714 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11715 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11716 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11717 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11718 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11719 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11720 /* hp used DAC 3 (Front) */
11721 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11722 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11726 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
11728 * Unmute ADC0 and set the default input to mic-in
11730 /* port-A for surround (rear panel) */
11731 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11732 /* port-B for mic-in (rear panel) with vref */
11733 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11734 /* port-C for line-in (rear panel) */
11735 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11736 /* port-D for Front */
11737 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11738 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11739 /* port-E for HP out (front panel) */
11740 /* this has to be set to VREF80 */
11741 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11742 /* route front PCM to HP */
11743 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11744 /* port-F for mic-in (front panel) with vref */
11745 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11746 /* port-G for CLFE (rear panel) */
11747 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11748 /* port-H for side (rear panel) */
11749 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11751 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11752 /* route front mic to ADC1*/
11753 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11754 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11755 /* Unmute DAC0~3 & spdif out*/
11756 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11757 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11758 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11759 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11760 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11762 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11763 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11764 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11765 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11766 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11768 /* Unmute Stereo Mixer 15 */
11769 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11771 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11772 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
11774 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11775 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11776 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11777 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11778 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11779 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11780 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11781 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11782 /* hp used DAC 3 (Front) */
11783 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11784 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11788 static struct hda_verb alc861_asus_init_verbs
[] = {
11790 * Unmute ADC0 and set the default input to mic-in
11792 /* port-A for surround (rear panel)
11793 * according to codec#0 this is the HP jack
11795 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
11796 /* route front PCM to HP */
11797 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
11798 /* port-B for mic-in (rear panel) with vref */
11799 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11800 /* port-C for line-in (rear panel) */
11801 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11802 /* port-D for Front */
11803 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11804 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11805 /* port-E for HP out (front panel) */
11806 /* this has to be set to VREF80 */
11807 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11808 /* route front PCM to HP */
11809 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11810 /* port-F for mic-in (front panel) with vref */
11811 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11812 /* port-G for CLFE (rear panel) */
11813 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11814 /* port-H for side (rear panel) */
11815 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11817 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11818 /* route front mic to ADC1*/
11819 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11820 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11821 /* Unmute DAC0~3 & spdif out*/
11822 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11823 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11824 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11825 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11826 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11827 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11828 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11829 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11830 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11831 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11833 /* Unmute Stereo Mixer 15 */
11834 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11835 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11836 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11837 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
11839 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11840 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11841 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11842 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11843 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11844 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11845 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11846 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11847 /* hp used DAC 3 (Front) */
11848 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11849 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11853 /* additional init verbs for ASUS laptops */
11854 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
11855 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
11856 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
11861 * generic initialization of ADC, input mixers and output mixers
11863 static struct hda_verb alc861_auto_init_verbs
[] = {
11865 * Unmute ADC0 and set the default input to mic-in
11867 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11868 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11870 /* Unmute DAC0~3 & spdif out*/
11871 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11872 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11873 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11874 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11875 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11877 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11878 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11879 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11880 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11881 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11883 /* Unmute Stereo Mixer 15 */
11884 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11885 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11886 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11887 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
11889 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11890 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11891 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11892 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11893 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11894 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11895 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11896 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11898 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11899 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11900 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11901 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11902 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11903 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11904 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11905 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11907 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
11912 static struct hda_verb alc861_toshiba_init_verbs
[] = {
11913 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11918 /* toggle speaker-output according to the hp-jack state */
11919 static void alc861_toshiba_automute(struct hda_codec
*codec
)
11921 unsigned int present
;
11923 present
= snd_hda_codec_read(codec
, 0x0f, 0,
11924 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11925 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
11926 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
11927 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
11928 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
11931 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
11934 if ((res
>> 26) == ALC880_HP_EVENT
)
11935 alc861_toshiba_automute(codec
);
11938 /* pcm configuration: identiacal with ALC880 */
11939 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11940 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11941 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11942 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11945 #define ALC861_DIGOUT_NID 0x07
11947 static struct hda_channel_mode alc861_8ch_modes
[1] = {
11951 static hda_nid_t alc861_dac_nids
[4] = {
11952 /* front, surround, clfe, side */
11953 0x03, 0x06, 0x05, 0x04
11956 static hda_nid_t alc660_dac_nids
[3] = {
11957 /* front, clfe, surround */
11961 static hda_nid_t alc861_adc_nids
[1] = {
11966 static struct hda_input_mux alc861_capture_source
= {
11970 { "Front Mic", 0x3 },
11977 /* fill in the dac_nids table from the parsed pin configuration */
11978 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
,
11979 const struct auto_pin_cfg
*cfg
)
11984 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
11985 for (i
= 0; i
< cfg
->line_outs
; i
++) {
11986 nid
= cfg
->line_out_pins
[i
];
11988 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
11990 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
11993 spec
->multiout
.num_dacs
= cfg
->line_outs
;
11997 /* add playback controls from the parsed DAC table */
11998 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
11999 const struct auto_pin_cfg
*cfg
)
12002 static const char *chname
[4] = {
12003 "Front", "Surround", NULL
/*CLFE*/, "Side"
12008 for (i
= 0; i
< cfg
->line_outs
; i
++) {
12009 nid
= spec
->multiout
.dac_nids
[i
];
12014 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
12015 "Center Playback Switch",
12016 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
12020 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
12021 "LFE Playback Switch",
12022 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
12027 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1;
12029 if (nid
== alc861_dac_nids
[idx
])
12031 sprintf(name
, "%s Playback Switch", chname
[idx
]);
12032 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
12033 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
12042 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
12050 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
12052 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
12053 "Headphone Playback Switch",
12054 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
12057 spec
->multiout
.hp_nid
= nid
;
12062 /* create playback/capture controls for input pins */
12063 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
,
12064 const struct auto_pin_cfg
*cfg
)
12066 struct hda_input_mux
*imux
= &spec
->private_imux
;
12067 int i
, err
, idx
, idx1
;
12069 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12070 switch (cfg
->input_pins
[i
]) {
12073 idx
= 2; /* Line In */
12077 idx
= 2; /* Line In */
12081 idx
= 1; /* Mic In */
12085 idx
= 1; /* Mic In */
12095 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
12096 auto_pin_cfg_labels
[i
], idx
, 0x15);
12100 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
12101 imux
->items
[imux
->num_items
].index
= idx1
;
12107 static struct snd_kcontrol_new alc861_capture_mixer
[] = {
12108 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
12109 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
12112 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12113 /* The multiple "Capture Source" controls confuse alsamixer
12114 * So call somewhat different..
12116 /* .name = "Capture Source", */
12117 .name
= "Input Source",
12119 .info
= alc_mux_enum_info
,
12120 .get
= alc_mux_enum_get
,
12121 .put
= alc_mux_enum_put
,
12126 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
12128 int pin_type
, int dac_idx
)
12130 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
12132 snd_hda_codec_write(codec
, dac_idx
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12136 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
12138 struct alc_spec
*spec
= codec
->spec
;
12141 alc_subsystem_id(codec
, 0x0e, 0x0f, 0x0b);
12142 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
12143 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
12144 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
12146 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
12147 spec
->multiout
.dac_nids
[i
]);
12151 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
12153 struct alc_spec
*spec
= codec
->spec
;
12156 pin
= spec
->autocfg
.hp_pins
[0];
12157 if (pin
) /* connect to front */
12158 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
12159 spec
->multiout
.dac_nids
[0]);
12160 pin
= spec
->autocfg
.speaker_pins
[0];
12162 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
12165 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
12167 struct alc_spec
*spec
= codec
->spec
;
12170 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12171 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
12172 if (nid
>= 0x0c && nid
<= 0x11) {
12173 snd_hda_codec_write(codec
, nid
, 0,
12174 AC_VERB_SET_PIN_WIDGET_CONTROL
,
12175 i
<= AUTO_PIN_FRONT_MIC
?
12176 PIN_VREF80
: PIN_IN
);
12181 /* parse the BIOS configuration and set up the alc_spec */
12182 /* return 1 if successful, 0 if the proper config is not found,
12183 * or a negative error code
12185 static int alc861_parse_auto_config(struct hda_codec
*codec
)
12187 struct alc_spec
*spec
= codec
->spec
;
12189 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
12191 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12195 if (!spec
->autocfg
.line_outs
)
12196 return 0; /* can't find valid BIOS pin config */
12198 err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
);
12201 err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12204 err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pins
[0]);
12207 err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
12211 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12213 if (spec
->autocfg
.dig_out_pin
)
12214 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
12216 if (spec
->kctl_alloc
)
12217 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
12219 spec
->init_verbs
[spec
->num_init_verbs
++] = alc861_auto_init_verbs
;
12221 spec
->num_mux_defs
= 1;
12222 spec
->input_mux
= &spec
->private_imux
;
12224 spec
->adc_nids
= alc861_adc_nids
;
12225 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
12226 spec
->mixers
[spec
->num_mixers
] = alc861_capture_mixer
;
12227 spec
->num_mixers
++;
12232 /* additional initialization for auto-configuration model */
12233 static void alc861_auto_init(struct hda_codec
*codec
)
12235 struct alc_spec
*spec
= codec
->spec
;
12236 alc861_auto_init_multi_out(codec
);
12237 alc861_auto_init_hp_out(codec
);
12238 alc861_auto_init_analog_input(codec
);
12239 if (spec
->unsol_event
)
12240 alc_sku_automute(codec
);
12243 #ifdef CONFIG_SND_HDA_POWER_SAVE
12244 static struct hda_amp_list alc861_loopbacks
[] = {
12245 { 0x15, HDA_INPUT
, 0 },
12246 { 0x15, HDA_INPUT
, 1 },
12247 { 0x15, HDA_INPUT
, 2 },
12248 { 0x15, HDA_INPUT
, 3 },
12255 * configuration and preset
12257 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
12258 [ALC861_3ST
] = "3stack",
12259 [ALC660_3ST
] = "3stack-660",
12260 [ALC861_3ST_DIG
] = "3stack-dig",
12261 [ALC861_6ST_DIG
] = "6stack-dig",
12262 [ALC861_UNIWILL_M31
] = "uniwill-m31",
12263 [ALC861_TOSHIBA
] = "toshiba",
12264 [ALC861_ASUS
] = "asus",
12265 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
12266 [ALC861_AUTO
] = "auto",
12269 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
12270 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
12271 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
12272 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
12273 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
12274 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
12275 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
12276 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
12277 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
12278 * Any other models that need this preset?
12280 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
12281 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
12282 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
12283 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
12284 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
12285 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
12286 /* FIXME: the below seems conflict */
12287 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
12288 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
12289 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
12293 static struct alc_config_preset alc861_presets
[] = {
12295 .mixers
= { alc861_3ST_mixer
},
12296 .init_verbs
= { alc861_threestack_init_verbs
},
12297 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12298 .dac_nids
= alc861_dac_nids
,
12299 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
12300 .channel_mode
= alc861_threestack_modes
,
12302 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12303 .adc_nids
= alc861_adc_nids
,
12304 .input_mux
= &alc861_capture_source
,
12306 [ALC861_3ST_DIG
] = {
12307 .mixers
= { alc861_base_mixer
},
12308 .init_verbs
= { alc861_threestack_init_verbs
},
12309 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12310 .dac_nids
= alc861_dac_nids
,
12311 .dig_out_nid
= ALC861_DIGOUT_NID
,
12312 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
12313 .channel_mode
= alc861_threestack_modes
,
12315 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12316 .adc_nids
= alc861_adc_nids
,
12317 .input_mux
= &alc861_capture_source
,
12319 [ALC861_6ST_DIG
] = {
12320 .mixers
= { alc861_base_mixer
},
12321 .init_verbs
= { alc861_base_init_verbs
},
12322 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12323 .dac_nids
= alc861_dac_nids
,
12324 .dig_out_nid
= ALC861_DIGOUT_NID
,
12325 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
12326 .channel_mode
= alc861_8ch_modes
,
12327 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12328 .adc_nids
= alc861_adc_nids
,
12329 .input_mux
= &alc861_capture_source
,
12332 .mixers
= { alc861_3ST_mixer
},
12333 .init_verbs
= { alc861_threestack_init_verbs
},
12334 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
12335 .dac_nids
= alc660_dac_nids
,
12336 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
12337 .channel_mode
= alc861_threestack_modes
,
12339 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12340 .adc_nids
= alc861_adc_nids
,
12341 .input_mux
= &alc861_capture_source
,
12343 [ALC861_UNIWILL_M31
] = {
12344 .mixers
= { alc861_uniwill_m31_mixer
},
12345 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
12346 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12347 .dac_nids
= alc861_dac_nids
,
12348 .dig_out_nid
= ALC861_DIGOUT_NID
,
12349 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
12350 .channel_mode
= alc861_uniwill_m31_modes
,
12352 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12353 .adc_nids
= alc861_adc_nids
,
12354 .input_mux
= &alc861_capture_source
,
12356 [ALC861_TOSHIBA
] = {
12357 .mixers
= { alc861_toshiba_mixer
},
12358 .init_verbs
= { alc861_base_init_verbs
,
12359 alc861_toshiba_init_verbs
},
12360 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12361 .dac_nids
= alc861_dac_nids
,
12362 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
12363 .channel_mode
= alc883_3ST_2ch_modes
,
12364 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12365 .adc_nids
= alc861_adc_nids
,
12366 .input_mux
= &alc861_capture_source
,
12367 .unsol_event
= alc861_toshiba_unsol_event
,
12368 .init_hook
= alc861_toshiba_automute
,
12371 .mixers
= { alc861_asus_mixer
},
12372 .init_verbs
= { alc861_asus_init_verbs
},
12373 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12374 .dac_nids
= alc861_dac_nids
,
12375 .dig_out_nid
= ALC861_DIGOUT_NID
,
12376 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
12377 .channel_mode
= alc861_asus_modes
,
12380 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12381 .adc_nids
= alc861_adc_nids
,
12382 .input_mux
= &alc861_capture_source
,
12384 [ALC861_ASUS_LAPTOP
] = {
12385 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
12386 .init_verbs
= { alc861_asus_init_verbs
,
12387 alc861_asus_laptop_init_verbs
},
12388 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
12389 .dac_nids
= alc861_dac_nids
,
12390 .dig_out_nid
= ALC861_DIGOUT_NID
,
12391 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
12392 .channel_mode
= alc883_3ST_2ch_modes
,
12394 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
12395 .adc_nids
= alc861_adc_nids
,
12396 .input_mux
= &alc861_capture_source
,
12401 static int patch_alc861(struct hda_codec
*codec
)
12403 struct alc_spec
*spec
;
12407 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
12411 codec
->spec
= spec
;
12413 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
12417 if (board_config
< 0) {
12418 printk(KERN_INFO
"hda_codec: Unknown model for ALC861, "
12419 "trying auto-probe from BIOS...\n");
12420 board_config
= ALC861_AUTO
;
12423 if (board_config
== ALC861_AUTO
) {
12424 /* automatic parse from the BIOS config */
12425 err
= alc861_parse_auto_config(codec
);
12431 "hda_codec: Cannot set up configuration "
12432 "from BIOS. Using base mode...\n");
12433 board_config
= ALC861_3ST_DIG
;
12437 if (board_config
!= ALC861_AUTO
)
12438 setup_preset(spec
, &alc861_presets
[board_config
]);
12440 spec
->stream_name_analog
= "ALC861 Analog";
12441 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
12442 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
12444 spec
->stream_name_digital
= "ALC861 Digital";
12445 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
12446 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
12448 spec
->vmaster_nid
= 0x03;
12450 codec
->patch_ops
= alc_patch_ops
;
12451 if (board_config
== ALC861_AUTO
)
12452 spec
->init_hook
= alc861_auto_init
;
12453 #ifdef CONFIG_SND_HDA_POWER_SAVE
12454 if (!spec
->loopback
.amplist
)
12455 spec
->loopback
.amplist
= alc861_loopbacks
;
12462 * ALC861-VD support
12466 * In addition, an independent DAC
12468 #define ALC861VD_DIGOUT_NID 0x06
12470 static hda_nid_t alc861vd_dac_nids
[4] = {
12471 /* front, surr, clfe, side surr */
12472 0x02, 0x03, 0x04, 0x05
12475 /* dac_nids for ALC660vd are in a different order - according to
12476 * Realtek's driver.
12477 * This should probably tesult in a different mixer for 6stack models
12478 * of ALC660vd codecs, but for now there is only 3stack mixer
12479 * - and it is the same as in 861vd.
12480 * adc_nids in ALC660vd are (is) the same as in 861vd
12482 static hda_nid_t alc660vd_dac_nids
[3] = {
12483 /* front, rear, clfe, rear_surr */
12487 static hda_nid_t alc861vd_adc_nids
[1] = {
12492 static hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
12495 /* FIXME: should be a matrix-type input source selection */
12496 static struct hda_input_mux alc861vd_capture_source
= {
12500 { "Front Mic", 0x1 },
12506 static struct hda_input_mux alc861vd_dallas_capture_source
= {
12509 { "Ext Mic", 0x0 },
12510 { "Int Mic", 0x1 },
12514 static struct hda_input_mux alc861vd_hp_capture_source
= {
12517 { "Front Mic", 0x0 },
12518 { "ATAPI Mic", 0x1 },
12522 #define alc861vd_mux_enum_info alc_mux_enum_info
12523 #define alc861vd_mux_enum_get alc_mux_enum_get
12524 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12525 #define alc861vd_mux_enum_put alc882_mux_enum_put
12530 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
12537 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
12538 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12539 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12540 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12541 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12548 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
12549 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12550 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12551 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12552 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12556 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
12557 { 6, alc861vd_6stack_ch6_init
},
12558 { 8, alc861vd_6stack_ch8_init
},
12561 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
12563 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12564 .name
= "Channel Mode",
12565 .info
= alc_ch_mode_info
,
12566 .get
= alc_ch_mode_get
,
12567 .put
= alc_ch_mode_put
,
12572 static struct snd_kcontrol_new alc861vd_capture_mixer
[] = {
12573 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
12574 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
12577 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12578 /* The multiple "Capture Source" controls confuse alsamixer
12579 * So call somewhat different..
12581 /* .name = "Capture Source", */
12582 .name
= "Input Source",
12584 .info
= alc861vd_mux_enum_info
,
12585 .get
= alc861vd_mux_enum_get
,
12586 .put
= alc861vd_mux_enum_put
,
12591 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12592 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12594 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
12595 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12596 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12598 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12599 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
12601 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12603 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12605 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
12606 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
12608 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
12609 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
12611 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
12613 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12614 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12615 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12617 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12618 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12619 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12621 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
12622 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
12624 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12625 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12627 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
12628 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
12633 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
12634 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12635 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12637 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
12639 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12640 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12641 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12643 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12644 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12645 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12647 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
12648 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
12650 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12651 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12653 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
12654 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
12659 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
12660 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12661 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12662 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
12666 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12668 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12670 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12671 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12672 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12674 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12675 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12680 /* Pin assignment: Speaker=0x14, HP = 0x15,
12681 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
12683 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
12684 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12685 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
12686 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12687 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
12688 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT
),
12689 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12690 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12691 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
12692 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12693 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12694 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT
),
12695 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT
),
12699 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12700 * Front Mic=0x18, ATAPI Mic = 0x19,
12702 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
12703 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12704 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12705 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12706 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
12707 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12708 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12709 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12710 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12716 * generic initialization of ADC, input mixers and output mixers
12718 static struct hda_verb alc861vd_volume_init_verbs
[] = {
12720 * Unmute ADC0 and set the default input to mic-in
12722 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12723 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12725 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12726 * the analog-loopback mixer widget
12728 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12735 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12736 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12737 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12738 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12739 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
12742 * Set up output mixers (0x02 - 0x05)
12744 /* set vol=0 to output mixers */
12745 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12746 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12747 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12748 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12750 /* set up input amps for analog loopback */
12751 /* Amp Indices: DAC = 0, mixer = 1 */
12752 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12754 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12755 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12756 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12757 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12758 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12759 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12765 * 3-stack pin configuration:
12766 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
12768 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
12770 * Set pin mode and muting
12772 /* set front pin widgets 0x14 for output */
12773 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12774 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12775 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
12777 /* Mic (rear) pin: input vref at 80% */
12778 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12779 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12780 /* Front Mic pin: input vref at 80% */
12781 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12782 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12783 /* Line In pin: input */
12784 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12785 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12786 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12787 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12788 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12789 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12790 /* CD pin widget for input */
12791 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12797 * 6-stack pin configuration:
12799 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
12801 * Set pin mode and muting
12803 /* set front pin widgets 0x14 for output */
12804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12805 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12806 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
12808 /* Rear Pin: output 1 (0x0d) */
12809 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12811 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12812 /* CLFE Pin: output 2 (0x0e) */
12813 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12814 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12815 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
12816 /* Side Pin: output 3 (0x0f) */
12817 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12818 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12819 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
12821 /* Mic (rear) pin: input vref at 80% */
12822 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12824 /* Front Mic pin: input vref at 80% */
12825 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12826 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12827 /* Line In pin: input */
12828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12829 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12830 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12831 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12832 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12833 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12834 /* CD pin widget for input */
12835 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12840 static struct hda_verb alc861vd_eapd_verbs
[] = {
12841 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
12845 static struct hda_verb alc660vd_eapd_verbs
[] = {
12846 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
12847 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
12851 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
12852 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12853 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12855 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12856 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
12860 /* toggle speaker-output according to the hp-jack state */
12861 static void alc861vd_lenovo_hp_automute(struct hda_codec
*codec
)
12863 unsigned int present
;
12864 unsigned char bits
;
12866 present
= snd_hda_codec_read(codec
, 0x1b, 0,
12867 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12868 bits
= present
? HDA_AMP_MUTE
: 0;
12869 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
12870 HDA_AMP_MUTE
, bits
);
12873 static void alc861vd_lenovo_mic_automute(struct hda_codec
*codec
)
12875 unsigned int present
;
12876 unsigned char bits
;
12878 present
= snd_hda_codec_read(codec
, 0x18, 0,
12879 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12880 bits
= present
? HDA_AMP_MUTE
: 0;
12881 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
12882 HDA_AMP_MUTE
, bits
);
12885 static void alc861vd_lenovo_automute(struct hda_codec
*codec
)
12887 alc861vd_lenovo_hp_automute(codec
);
12888 alc861vd_lenovo_mic_automute(codec
);
12891 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
12894 switch (res
>> 26) {
12895 case ALC880_HP_EVENT
:
12896 alc861vd_lenovo_hp_automute(codec
);
12898 case ALC880_MIC_EVENT
:
12899 alc861vd_lenovo_mic_automute(codec
);
12904 static struct hda_verb alc861vd_dallas_verbs
[] = {
12905 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12906 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12907 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12908 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12910 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12911 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12912 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12913 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12914 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12915 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12916 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12917 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12919 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12920 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12921 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12922 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12923 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12924 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12925 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12926 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12928 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
12929 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12930 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
12931 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12932 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12933 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12934 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12935 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12937 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12939 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12940 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12942 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12943 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12944 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12949 /* toggle speaker-output according to the hp-jack state */
12950 static void alc861vd_dallas_automute(struct hda_codec
*codec
)
12952 unsigned int present
;
12954 present
= snd_hda_codec_read(codec
, 0x15, 0,
12955 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12956 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
12957 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
12960 static void alc861vd_dallas_unsol_event(struct hda_codec
*codec
, unsigned int res
)
12962 if ((res
>> 26) == ALC880_HP_EVENT
)
12963 alc861vd_dallas_automute(codec
);
12966 #ifdef CONFIG_SND_HDA_POWER_SAVE
12967 #define alc861vd_loopbacks alc880_loopbacks
12970 /* pcm configuration: identiacal with ALC880 */
12971 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12972 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12973 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12974 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12977 * configuration and preset
12979 static const char *alc861vd_models
[ALC861VD_MODEL_LAST
] = {
12980 [ALC660VD_3ST
] = "3stack-660",
12981 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
12982 [ALC861VD_3ST
] = "3stack",
12983 [ALC861VD_3ST_DIG
] = "3stack-digout",
12984 [ALC861VD_6ST_DIG
] = "6stack-digout",
12985 [ALC861VD_LENOVO
] = "lenovo",
12986 [ALC861VD_DALLAS
] = "dallas",
12987 [ALC861VD_HP
] = "hp",
12988 [ALC861VD_AUTO
] = "auto",
12991 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
12992 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
12993 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
12994 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
12995 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST
),
12996 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
12997 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
12998 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
12999 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
13000 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS
),
13001 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
13002 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS
),
13003 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
13004 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO
),
13005 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO
),
13006 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
13010 static struct alc_config_preset alc861vd_presets
[] = {
13012 .mixers
= { alc861vd_3st_mixer
},
13013 .init_verbs
= { alc861vd_volume_init_verbs
,
13014 alc861vd_3stack_init_verbs
},
13015 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
13016 .dac_nids
= alc660vd_dac_nids
,
13017 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13018 .channel_mode
= alc861vd_3stack_2ch_modes
,
13019 .input_mux
= &alc861vd_capture_source
,
13021 [ALC660VD_3ST_DIG
] = {
13022 .mixers
= { alc861vd_3st_mixer
},
13023 .init_verbs
= { alc861vd_volume_init_verbs
,
13024 alc861vd_3stack_init_verbs
},
13025 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
13026 .dac_nids
= alc660vd_dac_nids
,
13027 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
13028 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13029 .channel_mode
= alc861vd_3stack_2ch_modes
,
13030 .input_mux
= &alc861vd_capture_source
,
13033 .mixers
= { alc861vd_3st_mixer
},
13034 .init_verbs
= { alc861vd_volume_init_verbs
,
13035 alc861vd_3stack_init_verbs
},
13036 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13037 .dac_nids
= alc861vd_dac_nids
,
13038 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13039 .channel_mode
= alc861vd_3stack_2ch_modes
,
13040 .input_mux
= &alc861vd_capture_source
,
13042 [ALC861VD_3ST_DIG
] = {
13043 .mixers
= { alc861vd_3st_mixer
},
13044 .init_verbs
= { alc861vd_volume_init_verbs
,
13045 alc861vd_3stack_init_verbs
},
13046 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13047 .dac_nids
= alc861vd_dac_nids
,
13048 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
13049 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13050 .channel_mode
= alc861vd_3stack_2ch_modes
,
13051 .input_mux
= &alc861vd_capture_source
,
13053 [ALC861VD_6ST_DIG
] = {
13054 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
13055 .init_verbs
= { alc861vd_volume_init_verbs
,
13056 alc861vd_6stack_init_verbs
},
13057 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13058 .dac_nids
= alc861vd_dac_nids
,
13059 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
13060 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
13061 .channel_mode
= alc861vd_6stack_modes
,
13062 .input_mux
= &alc861vd_capture_source
,
13064 [ALC861VD_LENOVO
] = {
13065 .mixers
= { alc861vd_lenovo_mixer
},
13066 .init_verbs
= { alc861vd_volume_init_verbs
,
13067 alc861vd_3stack_init_verbs
,
13068 alc861vd_eapd_verbs
,
13069 alc861vd_lenovo_unsol_verbs
},
13070 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
13071 .dac_nids
= alc660vd_dac_nids
,
13072 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13073 .channel_mode
= alc861vd_3stack_2ch_modes
,
13074 .input_mux
= &alc861vd_capture_source
,
13075 .unsol_event
= alc861vd_lenovo_unsol_event
,
13076 .init_hook
= alc861vd_lenovo_automute
,
13078 [ALC861VD_DALLAS
] = {
13079 .mixers
= { alc861vd_dallas_mixer
},
13080 .init_verbs
= { alc861vd_dallas_verbs
},
13081 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13082 .dac_nids
= alc861vd_dac_nids
,
13083 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13084 .channel_mode
= alc861vd_3stack_2ch_modes
,
13085 .input_mux
= &alc861vd_dallas_capture_source
,
13086 .unsol_event
= alc861vd_dallas_unsol_event
,
13087 .init_hook
= alc861vd_dallas_automute
,
13090 .mixers
= { alc861vd_hp_mixer
},
13091 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
13092 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
13093 .dac_nids
= alc861vd_dac_nids
,
13094 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
13095 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
13096 .channel_mode
= alc861vd_3stack_2ch_modes
,
13097 .input_mux
= &alc861vd_hp_capture_source
,
13098 .unsol_event
= alc861vd_dallas_unsol_event
,
13099 .init_hook
= alc861vd_dallas_automute
,
13104 * BIOS auto configuration
13106 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
13107 hda_nid_t nid
, int pin_type
, int dac_idx
)
13109 alc_set_pin_output(codec
, nid
, pin_type
);
13112 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
13114 struct alc_spec
*spec
= codec
->spec
;
13117 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
13118 for (i
= 0; i
<= HDA_SIDE
; i
++) {
13119 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
13120 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
13122 alc861vd_auto_set_output_and_unmute(codec
, nid
,
13128 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
13130 struct alc_spec
*spec
= codec
->spec
;
13133 pin
= spec
->autocfg
.hp_pins
[0];
13134 if (pin
) /* connect to front and use dac 0 */
13135 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
13136 pin
= spec
->autocfg
.speaker_pins
[0];
13138 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
13141 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
13142 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
13144 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
13146 struct alc_spec
*spec
= codec
->spec
;
13149 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
13150 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
13151 if (alc861vd_is_input_pin(nid
)) {
13152 snd_hda_codec_write(codec
, nid
, 0,
13153 AC_VERB_SET_PIN_WIDGET_CONTROL
,
13154 i
<= AUTO_PIN_FRONT_MIC
?
13155 PIN_VREF80
: PIN_IN
);
13156 if (nid
!= ALC861VD_PIN_CD_NID
)
13157 snd_hda_codec_write(codec
, nid
, 0,
13158 AC_VERB_SET_AMP_GAIN_MUTE
,
13164 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
13165 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
13167 /* add playback controls from the parsed DAC table */
13168 /* Based on ALC880 version. But ALC861VD has separate,
13169 * different NIDs for mute/unmute switch and volume control */
13170 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13171 const struct auto_pin_cfg
*cfg
)
13174 static const char *chname
[4] = {"Front", "Surround", "CLFE", "Side"};
13175 hda_nid_t nid_v
, nid_s
;
13178 for (i
= 0; i
< cfg
->line_outs
; i
++) {
13179 if (!spec
->multiout
.dac_nids
[i
])
13181 nid_v
= alc861vd_idx_to_mixer_vol(
13183 spec
->multiout
.dac_nids
[i
]));
13184 nid_s
= alc861vd_idx_to_mixer_switch(
13186 spec
->multiout
.dac_nids
[i
]));
13190 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13191 "Center Playback Volume",
13192 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
13196 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13197 "LFE Playback Volume",
13198 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
13202 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
13203 "Center Playback Switch",
13204 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
13208 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
13209 "LFE Playback Switch",
13210 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
13215 sprintf(name
, "%s Playback Volume", chname
[i
]);
13216 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
13217 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
13221 sprintf(name
, "%s Playback Switch", chname
[i
]);
13222 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
13223 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
13232 /* add playback controls for speaker and HP outputs */
13233 /* Based on ALC880 version. But ALC861VD has separate,
13234 * different NIDs for mute/unmute switch and volume control */
13235 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
13236 hda_nid_t pin
, const char *pfx
)
13238 hda_nid_t nid_v
, nid_s
;
13245 if (alc880_is_fixed_pin(pin
)) {
13246 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
13247 /* specify the DAC as the extra output */
13248 if (!spec
->multiout
.hp_nid
)
13249 spec
->multiout
.hp_nid
= nid_v
;
13251 spec
->multiout
.extra_out_nid
[0] = nid_v
;
13252 /* control HP volume/switch on the output mixer amp */
13253 nid_v
= alc861vd_idx_to_mixer_vol(
13254 alc880_fixed_pin_idx(pin
));
13255 nid_s
= alc861vd_idx_to_mixer_switch(
13256 alc880_fixed_pin_idx(pin
));
13258 sprintf(name
, "%s Playback Volume", pfx
);
13259 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
13260 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
13263 sprintf(name
, "%s Playback Switch", pfx
);
13264 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
13265 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
13268 } else if (alc880_is_multi_pin(pin
)) {
13269 /* set manual connection */
13270 /* we have only a switch on HP-out PIN */
13271 sprintf(name
, "%s Playback Switch", pfx
);
13272 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
13273 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
13280 /* parse the BIOS configuration and set up the alc_spec
13281 * return 1 if successful, 0 if the proper config is not found,
13282 * or a negative error code
13283 * Based on ALC880 version - had to change it to override
13284 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
13285 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
13287 struct alc_spec
*spec
= codec
->spec
;
13289 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
13291 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13295 if (!spec
->autocfg
.line_outs
)
13296 return 0; /* can't find valid BIOS pin config */
13298 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
13301 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13304 err
= alc861vd_auto_create_extra_out(spec
,
13305 spec
->autocfg
.speaker_pins
[0],
13309 err
= alc861vd_auto_create_extra_out(spec
,
13310 spec
->autocfg
.hp_pins
[0],
13314 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
13318 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
13320 if (spec
->autocfg
.dig_out_pin
)
13321 spec
->multiout
.dig_out_nid
= ALC861VD_DIGOUT_NID
;
13323 if (spec
->kctl_alloc
)
13324 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
13326 spec
->init_verbs
[spec
->num_init_verbs
++]
13327 = alc861vd_volume_init_verbs
;
13329 spec
->num_mux_defs
= 1;
13330 spec
->input_mux
= &spec
->private_imux
;
13332 err
= alc_auto_add_mic_boost(codec
);
13339 /* additional initialization for auto-configuration model */
13340 static void alc861vd_auto_init(struct hda_codec
*codec
)
13342 struct alc_spec
*spec
= codec
->spec
;
13343 alc861vd_auto_init_multi_out(codec
);
13344 alc861vd_auto_init_hp_out(codec
);
13345 alc861vd_auto_init_analog_input(codec
);
13346 if (spec
->unsol_event
)
13347 alc_sku_automute(codec
);
13350 static int patch_alc861vd(struct hda_codec
*codec
)
13352 struct alc_spec
*spec
;
13353 int err
, board_config
;
13355 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13359 codec
->spec
= spec
;
13361 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
13365 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
13366 printk(KERN_INFO
"hda_codec: Unknown model for ALC660VD/"
13367 "ALC861VD, trying auto-probe from BIOS...\n");
13368 board_config
= ALC861VD_AUTO
;
13371 if (board_config
== ALC861VD_AUTO
) {
13372 /* automatic parse from the BIOS config */
13373 err
= alc861vd_parse_auto_config(codec
);
13379 "hda_codec: Cannot set up configuration "
13380 "from BIOS. Using base mode...\n");
13381 board_config
= ALC861VD_3ST
;
13385 if (board_config
!= ALC861VD_AUTO
)
13386 setup_preset(spec
, &alc861vd_presets
[board_config
]);
13388 if (codec
->vendor_id
== 0x10ec0660) {
13389 spec
->stream_name_analog
= "ALC660-VD Analog";
13390 spec
->stream_name_digital
= "ALC660-VD Digital";
13391 /* always turn on EAPD */
13392 spec
->init_verbs
[spec
->num_init_verbs
++] = alc660vd_eapd_verbs
;
13394 spec
->stream_name_analog
= "ALC861VD Analog";
13395 spec
->stream_name_digital
= "ALC861VD Digital";
13398 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
13399 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
13401 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
13402 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
13404 spec
->adc_nids
= alc861vd_adc_nids
;
13405 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
13406 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
13408 spec
->mixers
[spec
->num_mixers
] = alc861vd_capture_mixer
;
13409 spec
->num_mixers
++;
13411 spec
->vmaster_nid
= 0x02;
13413 codec
->patch_ops
= alc_patch_ops
;
13415 if (board_config
== ALC861VD_AUTO
)
13416 spec
->init_hook
= alc861vd_auto_init
;
13417 #ifdef CONFIG_SND_HDA_POWER_SAVE
13418 if (!spec
->loopback
.amplist
)
13419 spec
->loopback
.amplist
= alc861vd_loopbacks
;
13428 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
13429 * configuration. Each pin widget can choose any input DACs and a mixer.
13430 * Each ADC is connected from a mixer of all inputs. This makes possible
13431 * 6-channel independent captures.
13433 * In addition, an independent DAC for the multi-playback (not used in this
13436 #define ALC662_DIGOUT_NID 0x06
13437 #define ALC662_DIGIN_NID 0x0a
13439 static hda_nid_t alc662_dac_nids
[4] = {
13440 /* front, rear, clfe, rear_surr */
13444 static hda_nid_t alc662_adc_nids
[1] = {
13449 static hda_nid_t alc662_capsrc_nids
[1] = { 0x22 };
13452 /* FIXME: should be a matrix-type input source selection */
13453 static struct hda_input_mux alc662_capture_source
= {
13457 { "Front Mic", 0x1 },
13463 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
13471 static struct hda_input_mux alc662_eeepc_capture_source
= {
13479 static struct hda_input_mux alc663_capture_source
= {
13483 { "Front Mic", 0x1 },
13488 static struct hda_input_mux alc663_m51va_capture_source
= {
13491 { "Ext-Mic", 0x0 },
13496 #define alc662_mux_enum_info alc_mux_enum_info
13497 #define alc662_mux_enum_get alc_mux_enum_get
13498 #define alc662_mux_enum_put alc882_mux_enum_put
13503 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
13510 static struct hda_verb alc662_3ST_ch2_init
[] = {
13511 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13512 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13513 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13514 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13521 static struct hda_verb alc662_3ST_ch6_init
[] = {
13522 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13523 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13524 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
13525 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13526 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13527 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
13531 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
13532 { 2, alc662_3ST_ch2_init
},
13533 { 6, alc662_3ST_ch6_init
},
13539 static struct hda_verb alc662_sixstack_ch6_init
[] = {
13540 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13541 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13542 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13549 static struct hda_verb alc662_sixstack_ch8_init
[] = {
13550 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13551 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13552 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13556 static struct hda_channel_mode alc662_5stack_modes
[2] = {
13557 { 2, alc662_sixstack_ch6_init
},
13558 { 6, alc662_sixstack_ch8_init
},
13561 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13562 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13565 static struct snd_kcontrol_new alc662_base_mixer
[] = {
13566 /* output mixer control */
13567 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13568 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
13569 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13570 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
13571 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
13572 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
13573 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
13574 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
13575 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13577 /*Input mixer control */
13578 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
13579 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
13580 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
13581 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
13582 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
13583 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
13584 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
13585 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
13589 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
13590 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13591 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
13592 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13593 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13594 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13595 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13596 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13597 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13598 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13599 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13600 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13601 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
13602 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
13606 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
13607 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13608 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT
),
13609 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13610 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT
),
13611 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
13612 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
13613 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT
),
13614 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT
),
13615 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13616 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13617 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13618 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13619 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13620 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13621 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13622 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13623 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13624 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
13625 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
13629 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
13630 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13631 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
13632 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13633 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
13634 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13635 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13636 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13637 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13642 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
13643 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13645 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13646 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13648 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT
),
13649 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13650 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13652 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
13653 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13654 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13658 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
13659 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13660 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13661 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13662 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT
),
13663 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
13664 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
13665 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT
),
13666 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT
),
13667 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13668 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
13669 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13670 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13671 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13672 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13676 static struct snd_kcontrol_new alc663_m51va_mixer
[] = {
13677 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13678 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13679 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
13680 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13681 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13682 HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT
),
13686 static struct snd_kcontrol_new alc663_g71v_mixer
[] = {
13687 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13688 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13689 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13690 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
13691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
13693 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13694 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13695 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13696 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13700 static struct snd_kcontrol_new alc663_g50v_mixer
[] = {
13701 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13702 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13703 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT
),
13705 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13706 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13707 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13708 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13709 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13710 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13714 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
13716 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13717 .name
= "Channel Mode",
13718 .info
= alc_ch_mode_info
,
13719 .get
= alc_ch_mode_get
,
13720 .put
= alc_ch_mode_put
,
13725 static struct hda_verb alc662_init_verbs
[] = {
13726 /* ADC: mute amp left and right */
13727 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13728 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
13729 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13732 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13733 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13734 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
13737 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13739 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13740 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13741 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13742 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13744 /* Front Pin: output 0 (0x0c) */
13745 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13746 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13748 /* Rear Pin: output 1 (0x0d) */
13749 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13752 /* CLFE Pin: output 2 (0x0e) */
13753 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13754 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13756 /* Mic (rear) pin: input vref at 80% */
13757 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13758 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13759 /* Front Mic pin: input vref at 80% */
13760 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13761 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13762 /* Line In pin: input */
13763 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13764 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13765 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13766 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13767 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13768 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
13769 /* CD pin widget for input */
13770 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13772 /* FIXME: use matrix-type input source selection */
13773 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13775 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13776 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13777 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
13780 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13781 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13782 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
13785 /* always trun on EAPD */
13786 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13787 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
13792 static struct hda_verb alc662_sue_init_verbs
[] = {
13793 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
13794 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
13798 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
13799 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13800 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13804 /* Set Unsolicited Event*/
13805 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
13806 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13807 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13812 * generic initialization of ADC, input mixers and output mixers
13814 static struct hda_verb alc662_auto_init_verbs
[] = {
13816 * Unmute ADC and set the default input to mic-in
13818 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
13819 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13821 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
13823 * Note: PASD motherboards uses the Line In 2 as the input for front
13824 * panel mic (mic 2)
13826 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13828 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13829 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13830 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13831 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
13834 * Set up output mixers (0x0c - 0x0f)
13836 /* set vol=0 to output mixers */
13837 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13838 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13839 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13841 /* set up input amps for analog loopback */
13842 /* Amp Indices: DAC = 0, mixer = 1 */
13843 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13844 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13845 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13846 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13847 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13848 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13851 /* FIXME: use matrix-type input source selection */
13852 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13854 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13855 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13859 static struct hda_verb alc663_m51va_init_verbs
[] = {
13860 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13861 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13862 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
13864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(9)},
13866 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13867 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13871 static struct hda_verb alc663_g71v_init_verbs
[] = {
13872 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13873 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
13874 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
13876 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13877 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13878 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
13880 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
13881 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_MIC_EVENT
},
13882 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
13886 static struct hda_verb alc663_g50v_init_verbs
[] = {
13887 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13888 {0x21, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13889 {0x21, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Headphone */
13891 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13892 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13896 /* capture mixer elements */
13897 static struct snd_kcontrol_new alc662_capture_mixer
[] = {
13898 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
13899 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
13901 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13902 /* The multiple "Capture Source" controls confuse alsamixer
13903 * So call somewhat different..
13905 /* .name = "Capture Source", */
13906 .name
= "Input Source",
13908 .info
= alc662_mux_enum_info
,
13909 .get
= alc662_mux_enum_get
,
13910 .put
= alc662_mux_enum_put
,
13915 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
13917 unsigned int present
;
13918 unsigned char bits
;
13920 present
= snd_hda_codec_read(codec
, 0x14, 0,
13921 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13922 bits
= present
? HDA_AMP_MUTE
: 0;
13923 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
13924 HDA_AMP_MUTE
, bits
);
13927 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
13929 unsigned int present
;
13930 unsigned char bits
;
13932 present
= snd_hda_codec_read(codec
, 0x1b, 0,
13933 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13934 bits
= present
? HDA_AMP_MUTE
: 0;
13935 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
13936 HDA_AMP_MUTE
, bits
);
13937 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
13938 HDA_AMP_MUTE
, bits
);
13941 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
13944 if ((res
>> 26) == ALC880_HP_EVENT
)
13945 alc662_lenovo_101e_all_automute(codec
);
13946 if ((res
>> 26) == ALC880_FRONT_EVENT
)
13947 alc662_lenovo_101e_ispeaker_automute(codec
);
13950 static void alc662_eeepc_mic_automute(struct hda_codec
*codec
)
13952 unsigned int present
;
13954 present
= snd_hda_codec_read(codec
, 0x18, 0,
13955 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13956 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13957 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
13958 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13959 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
13960 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13961 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
13962 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13963 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
13966 /* unsolicited event for HP jack sensing */
13967 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
13970 if ((res
>> 26) == ALC880_HP_EVENT
)
13971 alc262_hippo1_automute( codec
);
13973 if ((res
>> 26) == ALC880_MIC_EVENT
)
13974 alc662_eeepc_mic_automute(codec
);
13977 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
13979 alc262_hippo1_automute( codec
);
13980 alc662_eeepc_mic_automute(codec
);
13983 static void alc662_eeepc_ep20_automute(struct hda_codec
*codec
)
13986 unsigned int present
;
13988 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
13989 present
= snd_hda_codec_read(codec
, 0x14, 0,
13990 AC_VERB_GET_PIN_SENSE
, 0);
13991 present
= (present
& 0x80000000) != 0;
13993 /* mute internal speaker */
13994 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
13995 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
13997 /* unmute internal speaker if necessary */
13998 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
13999 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
14000 HDA_AMP_MUTE
, mute
);
14004 /* unsolicited event for HP jack sensing */
14005 static void alc662_eeepc_ep20_unsol_event(struct hda_codec
*codec
,
14008 if ((res
>> 26) == ALC880_HP_EVENT
)
14009 alc662_eeepc_ep20_automute(codec
);
14012 static void alc662_eeepc_ep20_inithook(struct hda_codec
*codec
)
14014 alc662_eeepc_ep20_automute(codec
);
14017 static void alc663_m51va_speaker_automute(struct hda_codec
*codec
)
14019 unsigned int present
;
14020 unsigned char bits
;
14022 present
= snd_hda_codec_read(codec
, 0x21, 0,
14023 AC_VERB_GET_PIN_SENSE
, 0)
14024 & AC_PINSENSE_PRESENCE
;
14025 bits
= present
? HDA_AMP_MUTE
: 0;
14026 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14027 HDA_AMP_MUTE
, bits
);
14030 static void alc663_m51va_mic_automute(struct hda_codec
*codec
)
14032 unsigned int present
;
14034 present
= snd_hda_codec_read(codec
, 0x18, 0,
14035 AC_VERB_GET_PIN_SENSE
, 0)
14036 & AC_PINSENSE_PRESENCE
;
14037 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14038 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
14039 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14040 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
14041 snd_hda_codec_write_cache(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14042 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
14043 snd_hda_codec_write_cache(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
14044 0x7000 | (0x09 << 8) | (present
? 0x80 : 0));
14047 static void alc663_m51va_unsol_event(struct hda_codec
*codec
,
14050 switch (res
>> 26) {
14051 case ALC880_HP_EVENT
:
14052 alc663_m51va_speaker_automute(codec
);
14054 case ALC880_MIC_EVENT
:
14055 alc663_m51va_mic_automute(codec
);
14060 static void alc663_m51va_inithook(struct hda_codec
*codec
)
14062 alc663_m51va_speaker_automute(codec
);
14063 alc663_m51va_mic_automute(codec
);
14066 static void alc663_g71v_hp_automute(struct hda_codec
*codec
)
14068 unsigned int present
;
14069 unsigned char bits
;
14071 present
= snd_hda_codec_read(codec
, 0x21, 0,
14072 AC_VERB_GET_PIN_SENSE
, 0)
14073 & AC_PINSENSE_PRESENCE
;
14074 bits
= present
? HDA_AMP_MUTE
: 0;
14075 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
14076 HDA_AMP_MUTE
, bits
);
14077 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14078 HDA_AMP_MUTE
, bits
);
14081 static void alc663_g71v_front_automute(struct hda_codec
*codec
)
14083 unsigned int present
;
14084 unsigned char bits
;
14086 present
= snd_hda_codec_read(codec
, 0x15, 0,
14087 AC_VERB_GET_PIN_SENSE
, 0)
14088 & AC_PINSENSE_PRESENCE
;
14089 bits
= present
? HDA_AMP_MUTE
: 0;
14090 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
14091 HDA_AMP_MUTE
, bits
);
14094 static void alc663_g71v_unsol_event(struct hda_codec
*codec
,
14097 switch (res
>> 26) {
14098 case ALC880_HP_EVENT
:
14099 alc663_g71v_hp_automute(codec
);
14101 case ALC880_FRONT_EVENT
:
14102 alc663_g71v_front_automute(codec
);
14104 case ALC880_MIC_EVENT
:
14105 alc662_eeepc_mic_automute(codec
);
14110 static void alc663_g71v_inithook(struct hda_codec
*codec
)
14112 alc663_g71v_front_automute(codec
);
14113 alc663_g71v_hp_automute(codec
);
14114 alc662_eeepc_mic_automute(codec
);
14117 static void alc663_g50v_unsol_event(struct hda_codec
*codec
,
14120 switch (res
>> 26) {
14121 case ALC880_HP_EVENT
:
14122 alc663_m51va_speaker_automute(codec
);
14124 case ALC880_MIC_EVENT
:
14125 alc662_eeepc_mic_automute(codec
);
14130 static void alc663_g50v_inithook(struct hda_codec
*codec
)
14132 alc663_m51va_speaker_automute(codec
);
14133 alc662_eeepc_mic_automute(codec
);
14136 #ifdef CONFIG_SND_HDA_POWER_SAVE
14137 #define alc662_loopbacks alc880_loopbacks
14141 /* pcm configuration: identiacal with ALC880 */
14142 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
14143 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
14144 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
14145 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
14148 * configuration and preset
14150 static const char *alc662_models
[ALC662_MODEL_LAST
] = {
14151 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
14152 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
14153 [ALC662_3ST_6ch
] = "3stack-6ch",
14154 [ALC662_5ST_DIG
] = "6stack-dig",
14155 [ALC662_LENOVO_101E
] = "lenovo-101e",
14156 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
14157 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
14158 [ALC663_ASUS_M51VA
] = "m51va",
14159 [ALC663_ASUS_G71V
] = "g71v",
14160 [ALC663_ASUS_H13
] = "h13",
14161 [ALC663_ASUS_G50V
] = "g50v",
14162 [ALC662_AUTO
] = "auto",
14165 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
14166 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V
),
14167 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA
),
14168 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V
),
14169 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG
),
14170 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
14171 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
14172 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
14173 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13
),
14174 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13
),
14175 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13
),
14179 static struct alc_config_preset alc662_presets
[] = {
14180 [ALC662_3ST_2ch_DIG
] = {
14181 .mixers
= { alc662_3ST_2ch_mixer
, alc662_capture_mixer
},
14182 .init_verbs
= { alc662_init_verbs
},
14183 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14184 .dac_nids
= alc662_dac_nids
,
14185 .dig_out_nid
= ALC662_DIGOUT_NID
,
14186 .dig_in_nid
= ALC662_DIGIN_NID
,
14187 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14188 .channel_mode
= alc662_3ST_2ch_modes
,
14189 .input_mux
= &alc662_capture_source
,
14191 [ALC662_3ST_6ch_DIG
] = {
14192 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
14193 alc662_capture_mixer
},
14194 .init_verbs
= { alc662_init_verbs
},
14195 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14196 .dac_nids
= alc662_dac_nids
,
14197 .dig_out_nid
= ALC662_DIGOUT_NID
,
14198 .dig_in_nid
= ALC662_DIGIN_NID
,
14199 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
14200 .channel_mode
= alc662_3ST_6ch_modes
,
14202 .input_mux
= &alc662_capture_source
,
14204 [ALC662_3ST_6ch
] = {
14205 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
14206 alc662_capture_mixer
},
14207 .init_verbs
= { alc662_init_verbs
},
14208 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14209 .dac_nids
= alc662_dac_nids
,
14210 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
14211 .channel_mode
= alc662_3ST_6ch_modes
,
14213 .input_mux
= &alc662_capture_source
,
14215 [ALC662_5ST_DIG
] = {
14216 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
,
14217 alc662_capture_mixer
},
14218 .init_verbs
= { alc662_init_verbs
},
14219 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14220 .dac_nids
= alc662_dac_nids
,
14221 .dig_out_nid
= ALC662_DIGOUT_NID
,
14222 .dig_in_nid
= ALC662_DIGIN_NID
,
14223 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
14224 .channel_mode
= alc662_5stack_modes
,
14225 .input_mux
= &alc662_capture_source
,
14227 [ALC662_LENOVO_101E
] = {
14228 .mixers
= { alc662_lenovo_101e_mixer
, alc662_capture_mixer
},
14229 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
14230 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14231 .dac_nids
= alc662_dac_nids
,
14232 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14233 .channel_mode
= alc662_3ST_2ch_modes
,
14234 .input_mux
= &alc662_lenovo_101e_capture_source
,
14235 .unsol_event
= alc662_lenovo_101e_unsol_event
,
14236 .init_hook
= alc662_lenovo_101e_all_automute
,
14238 [ALC662_ASUS_EEEPC_P701
] = {
14239 .mixers
= { alc662_eeepc_p701_mixer
, alc662_capture_mixer
},
14240 .init_verbs
= { alc662_init_verbs
,
14241 alc662_eeepc_sue_init_verbs
},
14242 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14243 .dac_nids
= alc662_dac_nids
,
14244 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14245 .channel_mode
= alc662_3ST_2ch_modes
,
14246 .input_mux
= &alc662_eeepc_capture_source
,
14247 .unsol_event
= alc662_eeepc_unsol_event
,
14248 .init_hook
= alc662_eeepc_inithook
,
14250 [ALC662_ASUS_EEEPC_EP20
] = {
14251 .mixers
= { alc662_eeepc_ep20_mixer
, alc662_capture_mixer
,
14252 alc662_chmode_mixer
},
14253 .init_verbs
= { alc662_init_verbs
,
14254 alc662_eeepc_ep20_sue_init_verbs
},
14255 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14256 .dac_nids
= alc662_dac_nids
,
14257 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
14258 .channel_mode
= alc662_3ST_6ch_modes
,
14259 .input_mux
= &alc662_lenovo_101e_capture_source
,
14260 .unsol_event
= alc662_eeepc_ep20_unsol_event
,
14261 .init_hook
= alc662_eeepc_ep20_inithook
,
14263 [ALC663_ASUS_M51VA
] = {
14264 .mixers
= { alc663_m51va_mixer
, alc662_capture_mixer
},
14265 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
14266 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14267 .dac_nids
= alc662_dac_nids
,
14268 .dig_out_nid
= ALC662_DIGOUT_NID
,
14269 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14270 .channel_mode
= alc662_3ST_2ch_modes
,
14271 .input_mux
= &alc663_m51va_capture_source
,
14272 .unsol_event
= alc663_m51va_unsol_event
,
14273 .init_hook
= alc663_m51va_inithook
,
14275 [ALC663_ASUS_G71V
] = {
14276 .mixers
= { alc663_g71v_mixer
, alc662_capture_mixer
},
14277 .init_verbs
= { alc662_init_verbs
, alc663_g71v_init_verbs
},
14278 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14279 .dac_nids
= alc662_dac_nids
,
14280 .dig_out_nid
= ALC662_DIGOUT_NID
,
14281 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14282 .channel_mode
= alc662_3ST_2ch_modes
,
14283 .input_mux
= &alc662_eeepc_capture_source
,
14284 .unsol_event
= alc663_g71v_unsol_event
,
14285 .init_hook
= alc663_g71v_inithook
,
14287 [ALC663_ASUS_H13
] = {
14288 .mixers
= { alc663_m51va_mixer
, alc662_capture_mixer
},
14289 .init_verbs
= { alc662_init_verbs
, alc663_m51va_init_verbs
},
14290 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14291 .dac_nids
= alc662_dac_nids
,
14292 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
14293 .channel_mode
= alc662_3ST_2ch_modes
,
14294 .input_mux
= &alc663_m51va_capture_source
,
14295 .unsol_event
= alc663_m51va_unsol_event
,
14296 .init_hook
= alc663_m51va_inithook
,
14298 [ALC663_ASUS_G50V
] = {
14299 .mixers
= { alc663_g50v_mixer
, alc662_capture_mixer
},
14300 .init_verbs
= { alc662_init_verbs
, alc663_g50v_init_verbs
},
14301 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
14302 .dac_nids
= alc662_dac_nids
,
14303 .dig_out_nid
= ALC662_DIGOUT_NID
,
14304 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
14305 .channel_mode
= alc662_3ST_6ch_modes
,
14306 .input_mux
= &alc663_capture_source
,
14307 .unsol_event
= alc663_g50v_unsol_event
,
14308 .init_hook
= alc663_g50v_inithook
,
14314 * BIOS auto configuration
14317 /* add playback controls from the parsed DAC table */
14318 static int alc662_auto_create_multi_out_ctls(struct alc_spec
*spec
,
14319 const struct auto_pin_cfg
*cfg
)
14322 static const char *chname
[4] = {
14323 "Front", "Surround", NULL
/*CLFE*/, "Side"
14328 for (i
= 0; i
< cfg
->line_outs
; i
++) {
14329 if (!spec
->multiout
.dac_nids
[i
])
14331 nid
= alc880_idx_to_dac(i
);
14334 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
14335 "Center Playback Volume",
14336 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
14340 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
14341 "LFE Playback Volume",
14342 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
14346 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14347 "Center Playback Switch",
14348 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
14352 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
14353 "LFE Playback Switch",
14354 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
14359 sprintf(name
, "%s Playback Volume", chname
[i
]);
14360 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
14361 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
14365 sprintf(name
, "%s Playback Switch", chname
[i
]);
14366 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
14367 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
14376 /* add playback controls for speaker and HP outputs */
14377 static int alc662_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
14387 if (alc880_is_fixed_pin(pin
)) {
14388 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
14389 /* printk("DAC nid=%x\n",nid); */
14390 /* specify the DAC as the extra output */
14391 if (!spec
->multiout
.hp_nid
)
14392 spec
->multiout
.hp_nid
= nid
;
14394 spec
->multiout
.extra_out_nid
[0] = nid
;
14395 /* control HP volume/switch on the output mixer amp */
14396 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
14397 sprintf(name
, "%s Playback Volume", pfx
);
14398 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
14399 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
14402 sprintf(name
, "%s Playback Switch", pfx
);
14403 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
14404 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
14407 } else if (alc880_is_multi_pin(pin
)) {
14408 /* set manual connection */
14409 /* we have only a switch on HP-out PIN */
14410 sprintf(name
, "%s Playback Switch", pfx
);
14411 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
14412 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
14419 /* create playback/capture controls for input pins */
14420 static int alc662_auto_create_analog_input_ctls(struct alc_spec
*spec
,
14421 const struct auto_pin_cfg
*cfg
)
14423 struct hda_input_mux
*imux
= &spec
->private_imux
;
14426 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
14427 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
14428 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
14429 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
14430 auto_pin_cfg_labels
[i
],
14434 imux
->items
[imux
->num_items
].label
=
14435 auto_pin_cfg_labels
[i
];
14436 imux
->items
[imux
->num_items
].index
=
14437 alc880_input_pin_idx(cfg
->input_pins
[i
]);
14444 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
14445 hda_nid_t nid
, int pin_type
,
14448 alc_set_pin_output(codec
, nid
, pin_type
);
14449 /* need the manual connection? */
14450 if (alc880_is_multi_pin(nid
)) {
14451 struct alc_spec
*spec
= codec
->spec
;
14452 int idx
= alc880_multi_pin_idx(nid
);
14453 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
14454 AC_VERB_SET_CONNECT_SEL
,
14455 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
14459 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
14461 struct alc_spec
*spec
= codec
->spec
;
14464 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
14465 for (i
= 0; i
<= HDA_SIDE
; i
++) {
14466 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
14467 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
14469 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
14474 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
14476 struct alc_spec
*spec
= codec
->spec
;
14479 pin
= spec
->autocfg
.hp_pins
[0];
14480 if (pin
) /* connect to front */
14482 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
14483 pin
= spec
->autocfg
.speaker_pins
[0];
14485 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
14488 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
14489 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
14491 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
14493 struct alc_spec
*spec
= codec
->spec
;
14496 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
14497 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
14498 if (alc662_is_input_pin(nid
)) {
14499 snd_hda_codec_write(codec
, nid
, 0,
14500 AC_VERB_SET_PIN_WIDGET_CONTROL
,
14501 (i
<= AUTO_PIN_FRONT_MIC
?
14502 PIN_VREF80
: PIN_IN
));
14503 if (nid
!= ALC662_PIN_CD_NID
)
14504 snd_hda_codec_write(codec
, nid
, 0,
14505 AC_VERB_SET_AMP_GAIN_MUTE
,
14511 static int alc662_parse_auto_config(struct hda_codec
*codec
)
14513 struct alc_spec
*spec
= codec
->spec
;
14515 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
14517 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
14521 if (!spec
->autocfg
.line_outs
)
14522 return 0; /* can't find valid BIOS pin config */
14524 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
14527 err
= alc662_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
14530 err
= alc662_auto_create_extra_out(spec
,
14531 spec
->autocfg
.speaker_pins
[0],
14535 err
= alc662_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
14539 err
= alc662_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
14543 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
14545 if (spec
->autocfg
.dig_out_pin
)
14546 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
14548 if (spec
->kctl_alloc
)
14549 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
14551 spec
->num_mux_defs
= 1;
14552 spec
->input_mux
= &spec
->private_imux
;
14554 spec
->init_verbs
[spec
->num_init_verbs
++] = alc662_auto_init_verbs
;
14555 spec
->mixers
[spec
->num_mixers
] = alc662_capture_mixer
;
14556 spec
->num_mixers
++;
14560 /* additional initialization for auto-configuration model */
14561 static void alc662_auto_init(struct hda_codec
*codec
)
14563 struct alc_spec
*spec
= codec
->spec
;
14564 alc662_auto_init_multi_out(codec
);
14565 alc662_auto_init_hp_out(codec
);
14566 alc662_auto_init_analog_input(codec
);
14567 if (spec
->unsol_event
)
14568 alc_sku_automute(codec
);
14571 static int patch_alc662(struct hda_codec
*codec
)
14573 struct alc_spec
*spec
;
14574 int err
, board_config
;
14576 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
14580 codec
->spec
= spec
;
14582 alc_fix_pll_init(codec
, 0x20, 0x04, 15);
14584 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
14587 if (board_config
< 0) {
14588 printk(KERN_INFO
"hda_codec: Unknown model for ALC662, "
14589 "trying auto-probe from BIOS...\n");
14590 board_config
= ALC662_AUTO
;
14593 if (board_config
== ALC662_AUTO
) {
14594 /* automatic parse from the BIOS config */
14595 err
= alc662_parse_auto_config(codec
);
14601 "hda_codec: Cannot set up configuration "
14602 "from BIOS. Using base mode...\n");
14603 board_config
= ALC662_3ST_2ch_DIG
;
14607 if (board_config
!= ALC662_AUTO
)
14608 setup_preset(spec
, &alc662_presets
[board_config
]);
14610 if (codec
->vendor_id
== 0x10ec0663) {
14611 spec
->stream_name_analog
= "ALC663 Analog";
14612 spec
->stream_name_digital
= "ALC663 Digital";
14614 spec
->stream_name_analog
= "ALC662 Analog";
14615 spec
->stream_name_digital
= "ALC662 Digital";
14618 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
14619 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
14621 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
14622 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
14624 spec
->adc_nids
= alc662_adc_nids
;
14625 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
14626 spec
->capsrc_nids
= alc662_capsrc_nids
;
14628 spec
->vmaster_nid
= 0x02;
14630 codec
->patch_ops
= alc_patch_ops
;
14631 if (board_config
== ALC662_AUTO
)
14632 spec
->init_hook
= alc662_auto_init
;
14633 #ifdef CONFIG_SND_HDA_POWER_SAVE
14634 if (!spec
->loopback
.amplist
)
14635 spec
->loopback
.amplist
= alc662_loopbacks
;
14644 struct hda_codec_preset snd_hda_preset_realtek
[] = {
14645 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
14646 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
14647 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
14648 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
14649 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
14650 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
14651 .patch
= patch_alc861
},
14652 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
14653 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
14654 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
14655 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
14656 .patch
= patch_alc883
},
14657 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
14658 .patch
= patch_alc662
},
14659 { .id
= 0x10ec0663, .name
= "ALC663", .patch
= patch_alc662
},
14660 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
14661 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
14662 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
14663 { .id
= 0x10ec0885, .rev
= 0x100103, .name
= "ALC889A",
14664 .patch
= patch_alc882
}, /* should be patch_alc883() in future */
14665 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
14666 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
14667 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc883
},
14668 {} /* terminator */