2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <sound/driver.h>
27 #include <linux/init.h>
28 #include <linux/delay.h>
29 #include <linux/slab.h>
30 #include <linux/pci.h>
31 #include <sound/core.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
63 #ifdef CONFIG_SND_DEBUG
67 ALC880_MODEL_LAST
/* last tag */
79 #ifdef CONFIG_SND_DEBUG
83 ALC260_MODEL_LAST
/* last tag */
93 ALC262_HP_BPC_D7000_WL
,
94 ALC262_HP_BPC_D7000_WF
,
100 ALC262_MODEL_LAST
/* last tag */
109 ALC268_MODEL_LAST
/* last tag */
126 /* ALC861-VD models */
147 ALC662_ASUS_EEEPC_P701
,
175 ALC883_TARGA_2ch_DIG
,
181 ALC883_LENOVO_101E_2ch
,
182 ALC883_LENOVO_NB0763
,
183 ALC888_LENOVO_MS7195_DIG
,
192 #define GPIO_MASK 0x03
195 /* codec parameterization */
196 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
197 unsigned int num_mixers
;
199 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
203 unsigned int num_init_verbs
;
205 char *stream_name_analog
; /* analog PCM stream */
206 struct hda_pcm_stream
*stream_analog_playback
;
207 struct hda_pcm_stream
*stream_analog_capture
;
209 char *stream_name_digital
; /* digital PCM stream */
210 struct hda_pcm_stream
*stream_digital_playback
;
211 struct hda_pcm_stream
*stream_digital_capture
;
214 struct hda_multi_out multiout
; /* playback set-up
215 * max_channels, dacs must be set
216 * dig_out_nid and hp_nid are optional
220 unsigned int num_adc_nids
;
222 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
225 unsigned int num_mux_defs
;
226 const struct hda_input_mux
*input_mux
;
227 unsigned int cur_mux
[3];
230 const struct hda_channel_mode
*channel_mode
;
231 int num_channel_mode
;
234 /* PCM information */
235 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
237 /* dynamic controls, init_verbs and input_mux */
238 struct auto_pin_cfg autocfg
;
239 unsigned int num_kctl_alloc
, num_kctl_used
;
240 struct snd_kcontrol_new
*kctl_alloc
;
241 struct hda_input_mux private_imux
;
242 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
245 void (*init_hook
)(struct hda_codec
*codec
);
246 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
248 /* for pin sensing */
249 unsigned int sense_updated
: 1;
250 unsigned int jack_present
: 1;
252 #ifdef CONFIG_SND_HDA_POWER_SAVE
253 struct hda_loopback_check loopback
;
258 * configuration template - to be copied to the spec instance
260 struct alc_config_preset
{
261 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
264 const struct hda_verb
*init_verbs
[5];
265 unsigned int num_dacs
;
267 hda_nid_t dig_out_nid
; /* optional */
268 hda_nid_t hp_nid
; /* optional */
269 unsigned int num_adc_nids
;
271 hda_nid_t dig_in_nid
;
272 unsigned int num_channel_mode
;
273 const struct hda_channel_mode
*channel_mode
;
275 unsigned int num_mux_defs
;
276 const struct hda_input_mux
*input_mux
;
277 void (*unsol_event
)(struct hda_codec
*, unsigned int);
278 void (*init_hook
)(struct hda_codec
*);
279 #ifdef CONFIG_SND_HDA_POWER_SAVE
280 struct hda_amp_list
*loopbacks
;
288 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
289 struct snd_ctl_elem_info
*uinfo
)
291 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
292 struct alc_spec
*spec
= codec
->spec
;
293 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
294 if (mux_idx
>= spec
->num_mux_defs
)
296 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
299 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
300 struct snd_ctl_elem_value
*ucontrol
)
302 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
303 struct alc_spec
*spec
= codec
->spec
;
304 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
306 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
310 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
311 struct snd_ctl_elem_value
*ucontrol
)
313 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
314 struct alc_spec
*spec
= codec
->spec
;
315 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
316 unsigned int mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
317 return snd_hda_input_mux_put(codec
, &spec
->input_mux
[mux_idx
], ucontrol
,
318 spec
->adc_nids
[adc_idx
],
319 &spec
->cur_mux
[adc_idx
]);
324 * channel mode setting
326 static int alc_ch_mode_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 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
332 spec
->num_channel_mode
);
335 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
336 struct snd_ctl_elem_value
*ucontrol
)
338 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
339 struct alc_spec
*spec
= codec
->spec
;
340 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
341 spec
->num_channel_mode
,
342 spec
->multiout
.max_channels
);
345 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
346 struct snd_ctl_elem_value
*ucontrol
)
348 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
349 struct alc_spec
*spec
= codec
->spec
;
350 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
351 spec
->num_channel_mode
,
352 &spec
->multiout
.max_channels
);
353 if (err
>= 0 && spec
->need_dac_fix
)
354 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
359 * Control the mode of pin widget settings via the mixer. "pc" is used
360 * instead of "%" to avoid consequences of accidently treating the % as
361 * being part of a format specifier. Maximum allowed length of a value is
362 * 63 characters plus NULL terminator.
364 * Note: some retasking pin complexes seem to ignore requests for input
365 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
366 * are requested. Therefore order this list so that this behaviour will not
367 * cause problems when mixer clients move through the enum sequentially.
368 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
371 static char *alc_pin_mode_names
[] = {
372 "Mic 50pc bias", "Mic 80pc bias",
373 "Line in", "Line out", "Headphone out",
375 static unsigned char alc_pin_mode_values
[] = {
376 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
378 /* The control can present all 5 options, or it can limit the options based
379 * in the pin being assumed to be exclusively an input or an output pin. In
380 * addition, "input" pins may or may not process the mic bias option
381 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
382 * accept requests for bias as of chip versions up to March 2006) and/or
383 * wiring in the computer.
385 #define ALC_PIN_DIR_IN 0x00
386 #define ALC_PIN_DIR_OUT 0x01
387 #define ALC_PIN_DIR_INOUT 0x02
388 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
389 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
391 /* Info about the pin modes supported by the different pin direction modes.
392 * For each direction the minimum and maximum values are given.
394 static signed char alc_pin_mode_dir_info
[5][2] = {
395 { 0, 2 }, /* ALC_PIN_DIR_IN */
396 { 3, 4 }, /* ALC_PIN_DIR_OUT */
397 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
398 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
399 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
401 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
402 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
403 #define alc_pin_mode_n_items(_dir) \
404 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
406 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
407 struct snd_ctl_elem_info
*uinfo
)
409 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
410 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
412 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
414 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
416 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
417 item_num
= alc_pin_mode_min(dir
);
418 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
422 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
423 struct snd_ctl_elem_value
*ucontrol
)
426 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
427 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
428 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
429 long *valp
= ucontrol
->value
.integer
.value
;
430 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
431 AC_VERB_GET_PIN_WIDGET_CONTROL
,
434 /* Find enumerated value for current pinctl setting */
435 i
= alc_pin_mode_min(dir
);
436 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
438 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
442 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
443 struct snd_ctl_elem_value
*ucontrol
)
446 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
447 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
448 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
449 long val
= *ucontrol
->value
.integer
.value
;
450 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
451 AC_VERB_GET_PIN_WIDGET_CONTROL
,
454 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
455 val
= alc_pin_mode_min(dir
);
457 change
= pinctl
!= alc_pin_mode_values
[val
];
459 /* Set pin mode to that requested */
460 snd_hda_codec_write_cache(codec
, nid
, 0,
461 AC_VERB_SET_PIN_WIDGET_CONTROL
,
462 alc_pin_mode_values
[val
]);
464 /* Also enable the retasking pin's input/output as required
465 * for the requested pin mode. Enum values of 2 or less are
468 * Dynamically switching the input/output buffers probably
469 * reduces noise slightly (particularly on input) so we'll
470 * do it. However, having both input and output buffers
471 * enabled simultaneously doesn't seem to be problematic if
472 * this turns out to be necessary in the future.
475 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
476 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
477 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
480 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
481 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
482 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
489 #define ALC_PIN_MODE(xname, nid, dir) \
490 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
491 .info = alc_pin_mode_info, \
492 .get = alc_pin_mode_get, \
493 .put = alc_pin_mode_put, \
494 .private_value = nid | (dir<<16) }
496 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
497 * together using a mask with more than one bit set. This control is
498 * currently used only by the ALC260 test model. At this stage they are not
499 * needed for any "production" models.
501 #ifdef CONFIG_SND_DEBUG
502 #define alc_gpio_data_info snd_ctl_boolean_mono_info
504 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
505 struct snd_ctl_elem_value
*ucontrol
)
507 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
508 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
509 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
510 long *valp
= ucontrol
->value
.integer
.value
;
511 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
512 AC_VERB_GET_GPIO_DATA
, 0x00);
514 *valp
= (val
& mask
) != 0;
517 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
518 struct snd_ctl_elem_value
*ucontrol
)
521 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
522 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
523 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
524 long val
= *ucontrol
->value
.integer
.value
;
525 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
526 AC_VERB_GET_GPIO_DATA
,
529 /* Set/unset the masked GPIO bit(s) as needed */
530 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
535 snd_hda_codec_write_cache(codec
, nid
, 0,
536 AC_VERB_SET_GPIO_DATA
, gpio_data
);
540 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
541 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
542 .info = alc_gpio_data_info, \
543 .get = alc_gpio_data_get, \
544 .put = alc_gpio_data_put, \
545 .private_value = nid | (mask<<16) }
546 #endif /* CONFIG_SND_DEBUG */
548 /* A switch control to allow the enabling of the digital IO pins on the
549 * ALC260. This is incredibly simplistic; the intention of this control is
550 * to provide something in the test model allowing digital outputs to be
551 * identified if present. If models are found which can utilise these
552 * outputs a more complete mixer control can be devised for those models if
555 #ifdef CONFIG_SND_DEBUG
556 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
558 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
559 struct snd_ctl_elem_value
*ucontrol
)
561 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
562 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
563 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
564 long *valp
= ucontrol
->value
.integer
.value
;
565 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
566 AC_VERB_GET_DIGI_CONVERT
, 0x00);
568 *valp
= (val
& mask
) != 0;
571 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
572 struct snd_ctl_elem_value
*ucontrol
)
575 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
576 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
577 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
578 long val
= *ucontrol
->value
.integer
.value
;
579 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
580 AC_VERB_GET_DIGI_CONVERT
,
583 /* Set/unset the masked control bit(s) as needed */
584 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
589 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
594 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
595 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
596 .info = alc_spdif_ctrl_info, \
597 .get = alc_spdif_ctrl_get, \
598 .put = alc_spdif_ctrl_put, \
599 .private_value = nid | (mask<<16) }
600 #endif /* CONFIG_SND_DEBUG */
603 * set up from the preset table
605 static void setup_preset(struct alc_spec
*spec
,
606 const struct alc_config_preset
*preset
)
610 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
611 spec
->mixers
[spec
->num_mixers
++] = preset
->mixers
[i
];
612 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
614 spec
->init_verbs
[spec
->num_init_verbs
++] =
615 preset
->init_verbs
[i
];
617 spec
->channel_mode
= preset
->channel_mode
;
618 spec
->num_channel_mode
= preset
->num_channel_mode
;
619 spec
->need_dac_fix
= preset
->need_dac_fix
;
621 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
623 spec
->multiout
.num_dacs
= preset
->num_dacs
;
624 spec
->multiout
.dac_nids
= preset
->dac_nids
;
625 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
626 spec
->multiout
.hp_nid
= preset
->hp_nid
;
628 spec
->num_mux_defs
= preset
->num_mux_defs
;
629 if (!spec
->num_mux_defs
)
630 spec
->num_mux_defs
= 1;
631 spec
->input_mux
= preset
->input_mux
;
633 spec
->num_adc_nids
= preset
->num_adc_nids
;
634 spec
->adc_nids
= preset
->adc_nids
;
635 spec
->dig_in_nid
= preset
->dig_in_nid
;
637 spec
->unsol_event
= preset
->unsol_event
;
638 spec
->init_hook
= preset
->init_hook
;
639 #ifdef CONFIG_SND_HDA_POWER_SAVE
640 spec
->loopback
.amplist
= preset
->loopbacks
;
644 /* Enable GPIO mask and set output */
645 static struct hda_verb alc_gpio1_init_verbs
[] = {
646 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
647 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
648 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
652 static struct hda_verb alc_gpio2_init_verbs
[] = {
653 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
654 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
655 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
659 static struct hda_verb alc_gpio3_init_verbs
[] = {
660 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
661 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
662 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
666 static void alc_sku_automute(struct hda_codec
*codec
)
668 struct alc_spec
*spec
= codec
->spec
;
670 unsigned int present
;
671 unsigned int hp_nid
= spec
->autocfg
.hp_pins
[0];
672 unsigned int sp_nid
= spec
->autocfg
.speaker_pins
[0];
674 /* need to execute and sync at first */
675 snd_hda_codec_read(codec
, hp_nid
, 0, AC_VERB_SET_PIN_SENSE
, 0);
676 present
= snd_hda_codec_read(codec
, hp_nid
, 0,
677 AC_VERB_GET_PIN_SENSE
, 0);
678 spec
->jack_present
= (present
& 0x80000000) != 0;
679 if (spec
->jack_present
) {
680 /* mute internal speaker */
681 snd_hda_codec_amp_stereo(codec
, sp_nid
, HDA_OUTPUT
, 0,
682 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
684 /* unmute internal speaker if necessary */
685 mute
= snd_hda_codec_amp_read(codec
, hp_nid
, 0, HDA_OUTPUT
, 0);
686 snd_hda_codec_amp_stereo(codec
, sp_nid
, HDA_OUTPUT
, 0,
691 /* unsolicited event for HP jack sensing */
692 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
694 if (codec
->vendor_id
== 0x10ec0880)
698 if (res
!= ALC880_HP_EVENT
)
701 alc_sku_automute(codec
);
704 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
705 * 31 ~ 16 : Manufacture ID
707 * 7 ~ 0 : Assembly ID
708 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
710 static void alc_subsystem_id(struct hda_codec
*codec
,
711 unsigned int porta
, unsigned int porte
,
714 unsigned int ass
, tmp
, i
;
716 struct alc_spec
*spec
= codec
->spec
;
718 ass
= codec
->subsystem_id
& 0xffff;
719 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
723 * 31~30 : port conetcivity
726 * 19~16 : Check sum (15:1)
731 if (codec
->vendor_id
== 0x10ec0260)
733 ass
= snd_hda_codec_read(codec
, nid
, 0,
734 AC_VERB_GET_CONFIG_DEFAULT
, 0);
735 if (!(ass
& 1) && !(ass
& 0x100000))
737 if ((ass
>> 30) != 1) /* no physical connection */
742 for (i
= 1; i
< 16; i
++) {
746 if (((ass
>> 16) & 0xf) != tmp
)
752 * 2 : 0 --> Desktop, 1 --> Laptop
753 * 3~5 : External Amplifier control
756 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
759 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
762 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
765 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
767 case 5: /* set EAPD output high */
768 switch (codec
->vendor_id
) {
770 snd_hda_codec_write(codec
, 0x0f, 0,
771 AC_VERB_SET_EAPD_BTLENABLE
, 2);
772 snd_hda_codec_write(codec
, 0x10, 0,
773 AC_VERB_SET_EAPD_BTLENABLE
, 2);
781 snd_hda_codec_write(codec
, 0x14, 0,
782 AC_VERB_SET_EAPD_BTLENABLE
, 2);
783 snd_hda_codec_write(codec
, 0x15, 0,
784 AC_VERB_SET_EAPD_BTLENABLE
, 2);
787 switch (codec
->vendor_id
) {
789 snd_hda_codec_write(codec
, 0x1a, 0,
790 AC_VERB_SET_COEF_INDEX
, 7);
791 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
792 AC_VERB_GET_PROC_COEF
, 0);
793 snd_hda_codec_write(codec
, 0x1a, 0,
794 AC_VERB_SET_COEF_INDEX
, 7);
795 snd_hda_codec_write(codec
, 0x1a, 0,
796 AC_VERB_SET_PROC_COEF
,
805 snd_hda_codec_write(codec
, 0x20, 0,
806 AC_VERB_SET_COEF_INDEX
, 7);
807 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
808 AC_VERB_GET_PROC_COEF
, 0);
809 snd_hda_codec_write(codec
, 0x20, 0,
810 AC_VERB_SET_COEF_INDEX
, 7);
811 snd_hda_codec_write(codec
, 0x20, 0,
812 AC_VERB_SET_PROC_COEF
,
817 snd_hda_codec_write(codec
, 0x20, 0,
818 AC_VERB_SET_COEF_INDEX
, 7);
819 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
820 AC_VERB_GET_PROC_COEF
, 0);
821 snd_hda_codec_write(codec
, 0x20, 0,
822 AC_VERB_SET_COEF_INDEX
, 7);
823 snd_hda_codec_write(codec
, 0x20, 0,
824 AC_VERB_SET_PROC_COEF
,
832 /* is laptop and enable the function "Mute internal speaker
833 * when the external headphone out jack is plugged"
835 if (!(ass
& 0x4) || !(ass
& 0x8000))
838 * 10~8 : Jack location
839 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
841 * 15 : 1 --> enable the function "Mute internal speaker
842 * when the external headphone out jack is plugged"
844 if (!spec
->autocfg
.speaker_pins
[0]) {
845 if (spec
->multiout
.dac_nids
[0])
846 spec
->autocfg
.speaker_pins
[0] =
847 spec
->multiout
.dac_nids
[0];
852 if (!spec
->autocfg
.hp_pins
[0]) {
853 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
855 spec
->autocfg
.hp_pins
[0] = porta
;
857 spec
->autocfg
.hp_pins
[0] = porte
;
859 spec
->autocfg
.hp_pins
[0] = portd
;
864 snd_hda_codec_write(codec
, spec
->autocfg
.hp_pins
[0], 0,
865 AC_VERB_SET_UNSOLICITED_ENABLE
,
866 AC_USRSP_EN
| ALC880_HP_EVENT
);
867 spec
->unsol_event
= alc_sku_unsol_event
;
868 spec
->init_hook
= alc_sku_automute
;
872 * Fix-up pin default configurations
880 static void alc_fix_pincfg(struct hda_codec
*codec
,
881 const struct snd_pci_quirk
*quirk
,
882 const struct alc_pincfg
**pinfix
)
884 const struct alc_pincfg
*cfg
;
886 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
890 cfg
= pinfix
[quirk
->value
];
891 for (; cfg
->nid
; cfg
++) {
894 for (i
= 0; i
< 4; i
++) {
895 snd_hda_codec_write(codec
, cfg
->nid
, 0,
896 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
+ i
,
904 * ALC880 3-stack model
906 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
907 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
908 * F-Mic = 0x1b, HP = 0x19
911 static hda_nid_t alc880_dac_nids
[4] = {
912 /* front, rear, clfe, rear_surr */
913 0x02, 0x05, 0x04, 0x03
916 static hda_nid_t alc880_adc_nids
[3] = {
921 /* The datasheet says the node 0x07 is connected from inputs,
922 * but it shows zero connection in the real implementation on some devices.
923 * Note: this is a 915GAV bug, fixed on 915GLV
925 static hda_nid_t alc880_adc_nids_alt
[2] = {
930 #define ALC880_DIGOUT_NID 0x06
931 #define ALC880_DIGIN_NID 0x0a
933 static struct hda_input_mux alc880_capture_source
= {
937 { "Front Mic", 0x3 },
943 /* channel source setting (2/6 channel selection for 3-stack) */
945 static struct hda_verb alc880_threestack_ch2_init
[] = {
946 /* set line-in to input, mute it */
947 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
948 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
949 /* set mic-in to input vref 80%, mute it */
950 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
951 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
956 static struct hda_verb alc880_threestack_ch6_init
[] = {
957 /* set line-in to output, unmute it */
958 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
959 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
960 /* set mic-in to output, unmute it */
961 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
962 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
966 static struct hda_channel_mode alc880_threestack_modes
[2] = {
967 { 2, alc880_threestack_ch2_init
},
968 { 6, alc880_threestack_ch6_init
},
971 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
972 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
973 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
974 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
975 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
976 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
977 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
978 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
979 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
980 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
981 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
982 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
983 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
984 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
985 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
986 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
987 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
988 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
989 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
990 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
992 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
993 .name
= "Channel Mode",
994 .info
= alc_ch_mode_info
,
995 .get
= alc_ch_mode_get
,
996 .put
= alc_ch_mode_put
,
1001 /* capture mixer elements */
1002 static struct snd_kcontrol_new alc880_capture_mixer
[] = {
1003 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
1004 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
1005 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
1006 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
1007 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
1008 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
1010 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1011 /* The multiple "Capture Source" controls confuse alsamixer
1012 * So call somewhat different..
1013 * FIXME: the controls appear in the "playback" view!
1015 /* .name = "Capture Source", */
1016 .name
= "Input Source",
1018 .info
= alc_mux_enum_info
,
1019 .get
= alc_mux_enum_get
,
1020 .put
= alc_mux_enum_put
,
1025 /* capture mixer elements (in case NID 0x07 not available) */
1026 static struct snd_kcontrol_new alc880_capture_alt_mixer
[] = {
1027 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1028 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1029 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
1030 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
1032 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1033 /* The multiple "Capture Source" controls confuse alsamixer
1034 * So call somewhat different..
1035 * FIXME: the controls appear in the "playback" view!
1037 /* .name = "Capture Source", */
1038 .name
= "Input Source",
1040 .info
= alc_mux_enum_info
,
1041 .get
= alc_mux_enum_get
,
1042 .put
= alc_mux_enum_put
,
1050 * ALC880 5-stack model
1052 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1054 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1055 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1058 /* additional mixers to alc880_three_stack_mixer */
1059 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
1060 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1061 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
1065 /* channel source setting (6/8 channel selection for 5-stack) */
1067 static struct hda_verb alc880_fivestack_ch6_init
[] = {
1068 /* set line-in to input, mute it */
1069 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1070 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1075 static struct hda_verb alc880_fivestack_ch8_init
[] = {
1076 /* set line-in to output, unmute it */
1077 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1078 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1082 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
1083 { 6, alc880_fivestack_ch6_init
},
1084 { 8, alc880_fivestack_ch8_init
},
1089 * ALC880 6-stack model
1091 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1092 * Side = 0x05 (0x0f)
1093 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1094 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1097 static hda_nid_t alc880_6st_dac_nids
[4] = {
1098 /* front, rear, clfe, rear_surr */
1099 0x02, 0x03, 0x04, 0x05
1102 static struct hda_input_mux alc880_6stack_capture_source
= {
1106 { "Front Mic", 0x1 },
1112 /* fixed 8-channels */
1113 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
1117 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
1118 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1119 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1120 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1121 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1122 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1123 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1124 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1125 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1126 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1127 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1128 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1129 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1130 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1131 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1134 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1135 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1136 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1137 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1139 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1140 .name
= "Channel Mode",
1141 .info
= alc_ch_mode_info
,
1142 .get
= alc_ch_mode_get
,
1143 .put
= alc_ch_mode_put
,
1152 * W810 has rear IO for:
1155 * Center/LFE (DAC 04)
1158 * The system also has a pair of internal speakers, and a headphone jack.
1159 * These are both connected to Line2 on the codec, hence to DAC 02.
1161 * There is a variable resistor to control the speaker or headphone
1162 * volume. This is a hardware-only device without a software API.
1164 * Plugging headphones in will disable the internal speakers. This is
1165 * implemented in hardware, not via the driver using jack sense. In
1166 * a similar fashion, plugging into the rear socket marked "front" will
1167 * disable both the speakers and headphones.
1169 * For input, there's a microphone jack, and an "audio in" jack.
1170 * These may not do anything useful with this driver yet, because I
1171 * haven't setup any initialization verbs for these yet...
1174 static hda_nid_t alc880_w810_dac_nids
[3] = {
1175 /* front, rear/surround, clfe */
1179 /* fixed 6 channels */
1180 static struct hda_channel_mode alc880_w810_modes
[1] = {
1184 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1185 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
1186 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1187 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1188 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1189 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1190 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1191 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1192 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1193 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1194 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1202 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1203 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1207 static hda_nid_t alc880_z71v_dac_nids
[1] = {
1210 #define ALC880_Z71V_HP_DAC 0x03
1212 /* fixed 2 channels */
1213 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
1217 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
1218 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1219 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1220 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1221 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
1222 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1223 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1224 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1225 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1232 * ALC880 F1734 model
1234 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1235 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1238 static hda_nid_t alc880_f1734_dac_nids
[1] = {
1241 #define ALC880_F1734_HP_DAC 0x02
1243 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
1244 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1245 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1246 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1247 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1248 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1249 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1260 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1261 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1262 * Mic = 0x18, Line = 0x1a
1265 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1266 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1268 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
1269 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1270 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1271 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1272 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1273 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1274 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1275 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1276 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1277 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1278 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1279 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1280 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1281 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1282 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1284 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1285 .name
= "Channel Mode",
1286 .info
= alc_ch_mode_info
,
1287 .get
= alc_ch_mode_get
,
1288 .put
= alc_ch_mode_put
,
1295 * ALC880 ASUS W1V model
1297 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1298 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1299 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1302 /* additional mixers to alc880_asus_mixer */
1303 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
1304 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
1305 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
1309 /* additional mixers to alc880_asus_mixer */
1310 static struct snd_kcontrol_new alc880_pcbeep_mixer
[] = {
1311 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1312 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1317 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
1318 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1319 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1320 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
1321 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
1322 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
1323 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
1324 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
1325 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1326 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1328 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1329 /* The multiple "Capture Source" controls confuse alsamixer
1330 * So call somewhat different..
1331 * FIXME: the controls appear in the "playback" view!
1333 /* .name = "Capture Source", */
1334 .name
= "Input Source",
1336 .info
= alc_mux_enum_info
,
1337 .get
= alc_mux_enum_get
,
1338 .put
= alc_mux_enum_put
,
1344 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
1345 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1346 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT
),
1347 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1348 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1349 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1350 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1351 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1352 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1353 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1354 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1355 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1356 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1357 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1358 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1359 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1360 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1361 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1362 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1364 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1365 .name
= "Channel Mode",
1366 .info
= alc_ch_mode_info
,
1367 .get
= alc_ch_mode_get
,
1368 .put
= alc_ch_mode_put
,
1373 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
1374 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1375 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1376 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1377 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1378 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1379 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1380 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1381 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1382 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1383 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1387 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
1388 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1389 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT
),
1390 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1391 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1392 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1393 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1398 * build control elements
1400 static int alc_build_controls(struct hda_codec
*codec
)
1402 struct alc_spec
*spec
= codec
->spec
;
1406 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1407 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1412 if (spec
->multiout
.dig_out_nid
) {
1413 err
= snd_hda_create_spdif_out_ctls(codec
,
1414 spec
->multiout
.dig_out_nid
);
1418 if (spec
->dig_in_nid
) {
1419 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1428 * initialize the codec volumes, etc
1432 * generic initialization of ADC, input mixers and output mixers
1434 static struct hda_verb alc880_volume_init_verbs
[] = {
1436 * Unmute ADC0-2 and set the default input to mic-in
1438 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
1439 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1440 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
1441 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1442 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
1443 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1445 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1447 * Note: PASD motherboards uses the Line In 2 as the input for front
1450 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1453 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
1454 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
1455 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
1456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
1457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
1460 * Set up output mixers (0x0c - 0x0f)
1462 /* set vol=0 to output mixers */
1463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1465 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1466 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1467 /* set up input amps for analog loopback */
1468 /* Amp Indices: DAC = 0, mixer = 1 */
1469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1470 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1471 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1472 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1473 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1474 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1475 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1476 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1482 * 3-stack pin configuration:
1483 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1485 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
1487 * preset connection lists of input pins
1488 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1490 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
1491 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1492 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
1495 * Set pin mode and muting
1497 /* set front pin widgets 0x14 for output */
1498 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1499 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1500 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1501 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1502 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1503 /* Mic2 (as headphone out) for HP output */
1504 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1505 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1506 /* Line In pin widget for input */
1507 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1508 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1509 /* Line2 (as front mic) pin widget for input and vref at 80% */
1510 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1511 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1512 /* CD pin widget for input */
1513 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1519 * 5-stack pin configuration:
1520 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1521 * line-in/side = 0x1a, f-mic = 0x1b
1523 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
1525 * preset connection lists of input pins
1526 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1528 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1529 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
1532 * Set pin mode and muting
1534 /* set pin widgets 0x14-0x17 for output */
1535 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1536 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1537 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1538 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1539 /* unmute pins for output (no gain on this amp) */
1540 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1541 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1542 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1543 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1545 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1546 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1547 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1548 /* Mic2 (as headphone out) for HP output */
1549 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1550 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1551 /* Line In pin widget for input */
1552 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1553 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1554 /* Line2 (as front mic) pin widget for input and vref at 80% */
1555 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1556 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1557 /* CD pin widget for input */
1558 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1564 * W810 pin configuration:
1565 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1567 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
1568 /* hphone/speaker input selector: front DAC */
1569 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
1571 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1572 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1573 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1574 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1575 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1576 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1578 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1579 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1585 * Z71V pin configuration:
1586 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1588 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
1589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1590 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1591 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1592 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1594 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1595 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1596 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1597 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1603 * 6-stack pin configuration:
1604 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1605 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1607 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
1608 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1610 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1611 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1612 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1613 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1614 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1615 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1616 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1617 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1619 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1620 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1621 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1622 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1623 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1624 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1625 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1626 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1627 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1633 * Uniwill pin configuration:
1634 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1637 static struct hda_verb alc880_uniwill_init_verbs
[] = {
1638 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1640 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1641 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1643 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1644 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1645 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1646 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1647 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1648 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1649 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1650 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1651 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1652 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1653 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1655 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1656 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1657 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1658 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1659 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1660 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1661 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1662 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1663 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1665 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1666 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
1673 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1675 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
1676 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1678 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1679 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1680 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1681 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1682 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1683 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1684 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1685 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1686 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1687 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1688 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1689 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1691 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1692 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1693 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1694 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1695 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1696 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1698 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1699 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
1704 static struct hda_verb alc880_beep_init_verbs
[] = {
1705 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
1709 /* toggle speaker-output according to the hp-jack state */
1710 static void alc880_uniwill_hp_automute(struct hda_codec
*codec
)
1712 unsigned int present
;
1715 present
= snd_hda_codec_read(codec
, 0x14, 0,
1716 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1717 bits
= present
? HDA_AMP_MUTE
: 0;
1718 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
1719 HDA_AMP_MUTE
, bits
);
1720 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
1721 HDA_AMP_MUTE
, bits
);
1724 /* auto-toggle front mic */
1725 static void alc880_uniwill_mic_automute(struct hda_codec
*codec
)
1727 unsigned int present
;
1730 present
= snd_hda_codec_read(codec
, 0x18, 0,
1731 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1732 bits
= present
? HDA_AMP_MUTE
: 0;
1733 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
1736 static void alc880_uniwill_automute(struct hda_codec
*codec
)
1738 alc880_uniwill_hp_automute(codec
);
1739 alc880_uniwill_mic_automute(codec
);
1742 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
1745 /* Looks like the unsol event is incompatible with the standard
1746 * definition. 4bit tag is placed at 28 bit!
1748 switch (res
>> 28) {
1749 case ALC880_HP_EVENT
:
1750 alc880_uniwill_hp_automute(codec
);
1752 case ALC880_MIC_EVENT
:
1753 alc880_uniwill_mic_automute(codec
);
1758 static void alc880_uniwill_p53_hp_automute(struct hda_codec
*codec
)
1760 unsigned int present
;
1763 present
= snd_hda_codec_read(codec
, 0x14, 0,
1764 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1765 bits
= present
? HDA_AMP_MUTE
: 0;
1766 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_INPUT
, 0, HDA_AMP_MUTE
, bits
);
1769 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
1771 unsigned int present
;
1773 present
= snd_hda_codec_read(codec
, 0x21, 0,
1774 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
1775 present
&= HDA_AMP_VOLMASK
;
1776 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
1777 HDA_AMP_VOLMASK
, present
);
1778 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
1779 HDA_AMP_VOLMASK
, present
);
1782 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
1785 /* Looks like the unsol event is incompatible with the standard
1786 * definition. 4bit tag is placed at 28 bit!
1788 if ((res
>> 28) == ALC880_HP_EVENT
)
1789 alc880_uniwill_p53_hp_automute(codec
);
1790 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
1791 alc880_uniwill_p53_dcvol_automute(codec
);
1796 * F1734 pin configuration:
1797 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1799 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
1800 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1801 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1802 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
1803 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1805 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1806 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1807 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1808 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1810 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1811 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1812 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1813 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1814 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1815 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1816 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1817 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1818 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1825 * ASUS pin configuration:
1826 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1828 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
1829 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1830 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1831 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
1832 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1834 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1835 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1836 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1837 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1838 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1839 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1840 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1841 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1843 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1844 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1845 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1846 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1847 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1848 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1849 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1850 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1851 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1856 /* Enable GPIO mask and set output */
1857 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1858 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1860 /* Clevo m520g init */
1861 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
1862 /* headphone output */
1863 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
1865 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1866 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1868 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1869 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1871 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1872 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1873 /* Mic1 (rear panel) */
1874 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1875 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1876 /* Mic2 (front panel) */
1877 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1878 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1880 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1881 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1882 /* change to EAPD mode */
1883 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1884 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
1889 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
1890 /* change to EAPD mode */
1891 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1892 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
1894 /* Headphone output */
1895 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1897 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1898 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
1900 /* Line In pin widget for input */
1901 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1902 /* CD pin widget for input */
1903 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1904 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1905 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1907 /* change to EAPD mode */
1908 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1909 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
1915 * LG m1 express dual
1918 * Rear Line-In/Out (blue): 0x14
1919 * Build-in Mic-In: 0x15
1921 * HP-Out (green): 0x1b
1922 * Mic-In/Out (red): 0x19
1926 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
1927 static hda_nid_t alc880_lg_dac_nids
[3] = {
1931 /* seems analog CD is not working */
1932 static struct hda_input_mux alc880_lg_capture_source
= {
1937 { "Internal Mic", 0x6 },
1941 /* 2,4,6 channel modes */
1942 static struct hda_verb alc880_lg_ch2_init
[] = {
1943 /* set line-in and mic-in to input */
1944 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1945 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1949 static struct hda_verb alc880_lg_ch4_init
[] = {
1950 /* set line-in to out and mic-in to input */
1951 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1952 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1956 static struct hda_verb alc880_lg_ch6_init
[] = {
1957 /* set line-in and mic-in to output */
1958 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1959 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1963 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
1964 { 2, alc880_lg_ch2_init
},
1965 { 4, alc880_lg_ch4_init
},
1966 { 6, alc880_lg_ch6_init
},
1969 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
1970 /* FIXME: it's not really "master" but front channels */
1971 HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1972 HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT
),
1973 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1974 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
1975 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
1976 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
1977 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
1978 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
1979 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1980 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1981 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
1982 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
1983 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
1984 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
1986 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1987 .name
= "Channel Mode",
1988 .info
= alc_ch_mode_info
,
1989 .get
= alc_ch_mode_get
,
1990 .put
= alc_ch_mode_put
,
1995 static struct hda_verb alc880_lg_init_verbs
[] = {
1996 /* set capture source to mic-in */
1997 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1998 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1999 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2000 /* mute all amp mixer inputs */
2001 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
2002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2003 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2004 /* line-in to input */
2005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2008 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2009 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2011 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2012 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2013 /* mic-in to input */
2014 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2015 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2016 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2018 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
2019 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2020 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2022 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2026 /* toggle speaker-output according to the hp-jack state */
2027 static void alc880_lg_automute(struct hda_codec
*codec
)
2029 unsigned int present
;
2032 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2033 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2034 bits
= present
? HDA_AMP_MUTE
: 0;
2035 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
2036 HDA_AMP_MUTE
, bits
);
2039 static void alc880_lg_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2041 /* Looks like the unsol event is incompatible with the standard
2042 * definition. 4bit tag is placed at 28 bit!
2044 if ((res
>> 28) == 0x01)
2045 alc880_lg_automute(codec
);
2054 * Built-in Mic-In: 0x19
2060 static struct hda_input_mux alc880_lg_lw_capture_source
= {
2064 { "Internal Mic", 0x1 },
2069 #define alc880_lg_lw_modes alc880_threestack_modes
2071 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
2072 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2073 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2074 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2075 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2076 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2077 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2078 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2079 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2080 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2081 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2082 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2083 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2084 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
2085 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
2087 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2088 .name
= "Channel Mode",
2089 .info
= alc_ch_mode_info
,
2090 .get
= alc_ch_mode_get
,
2091 .put
= alc_ch_mode_put
,
2096 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
2097 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2098 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2099 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2101 /* set capture source to mic-in */
2102 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2103 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2104 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2105 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2107 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2108 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2110 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2111 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2112 /* mic-in to input */
2113 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2114 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2116 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2117 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2119 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2123 /* toggle speaker-output according to the hp-jack state */
2124 static void alc880_lg_lw_automute(struct hda_codec
*codec
)
2126 unsigned int present
;
2129 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2130 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2131 bits
= present
? HDA_AMP_MUTE
: 0;
2132 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
2133 HDA_AMP_MUTE
, bits
);
2136 static void alc880_lg_lw_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2138 /* Looks like the unsol event is incompatible with the standard
2139 * definition. 4bit tag is placed at 28 bit!
2141 if ((res
>> 28) == 0x01)
2142 alc880_lg_lw_automute(codec
);
2145 #ifdef CONFIG_SND_HDA_POWER_SAVE
2146 static struct hda_amp_list alc880_loopbacks
[] = {
2147 { 0x0b, HDA_INPUT
, 0 },
2148 { 0x0b, HDA_INPUT
, 1 },
2149 { 0x0b, HDA_INPUT
, 2 },
2150 { 0x0b, HDA_INPUT
, 3 },
2151 { 0x0b, HDA_INPUT
, 4 },
2155 static struct hda_amp_list alc880_lg_loopbacks
[] = {
2156 { 0x0b, HDA_INPUT
, 1 },
2157 { 0x0b, HDA_INPUT
, 6 },
2158 { 0x0b, HDA_INPUT
, 7 },
2167 static int alc_init(struct hda_codec
*codec
)
2169 struct alc_spec
*spec
= codec
->spec
;
2172 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
2173 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
2175 if (spec
->init_hook
)
2176 spec
->init_hook(codec
);
2181 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2183 struct alc_spec
*spec
= codec
->spec
;
2185 if (spec
->unsol_event
)
2186 spec
->unsol_event(codec
, res
);
2189 #ifdef CONFIG_SND_HDA_POWER_SAVE
2190 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
2192 struct alc_spec
*spec
= codec
->spec
;
2193 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
2198 * Analog playback callbacks
2200 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2201 struct hda_codec
*codec
,
2202 struct snd_pcm_substream
*substream
)
2204 struct alc_spec
*spec
= codec
->spec
;
2205 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
);
2208 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2209 struct hda_codec
*codec
,
2210 unsigned int stream_tag
,
2211 unsigned int format
,
2212 struct snd_pcm_substream
*substream
)
2214 struct alc_spec
*spec
= codec
->spec
;
2215 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
2216 stream_tag
, format
, substream
);
2219 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2220 struct hda_codec
*codec
,
2221 struct snd_pcm_substream
*substream
)
2223 struct alc_spec
*spec
= codec
->spec
;
2224 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2230 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2231 struct hda_codec
*codec
,
2232 struct snd_pcm_substream
*substream
)
2234 struct alc_spec
*spec
= codec
->spec
;
2235 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2238 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2239 struct hda_codec
*codec
,
2240 unsigned int stream_tag
,
2241 unsigned int format
,
2242 struct snd_pcm_substream
*substream
)
2244 struct alc_spec
*spec
= codec
->spec
;
2245 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2246 stream_tag
, format
, substream
);
2249 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2250 struct hda_codec
*codec
,
2251 struct snd_pcm_substream
*substream
)
2253 struct alc_spec
*spec
= codec
->spec
;
2254 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2260 static int alc880_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2261 struct hda_codec
*codec
,
2262 unsigned int stream_tag
,
2263 unsigned int format
,
2264 struct snd_pcm_substream
*substream
)
2266 struct alc_spec
*spec
= codec
->spec
;
2268 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
2269 stream_tag
, 0, format
);
2273 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2274 struct hda_codec
*codec
,
2275 struct snd_pcm_substream
*substream
)
2277 struct alc_spec
*spec
= codec
->spec
;
2279 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
2287 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
2291 /* NID is set in alc_build_pcms */
2293 .open
= alc880_playback_pcm_open
,
2294 .prepare
= alc880_playback_pcm_prepare
,
2295 .cleanup
= alc880_playback_pcm_cleanup
2299 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
2303 /* NID is set in alc_build_pcms */
2305 .prepare
= alc880_capture_pcm_prepare
,
2306 .cleanup
= alc880_capture_pcm_cleanup
2310 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
2314 /* NID is set in alc_build_pcms */
2316 .open
= alc880_dig_playback_pcm_open
,
2317 .close
= alc880_dig_playback_pcm_close
,
2318 .prepare
= alc880_dig_playback_pcm_prepare
2322 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
2326 /* NID is set in alc_build_pcms */
2329 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2330 static struct hda_pcm_stream alc_pcm_null_playback
= {
2336 static int alc_build_pcms(struct hda_codec
*codec
)
2338 struct alc_spec
*spec
= codec
->spec
;
2339 struct hda_pcm
*info
= spec
->pcm_rec
;
2342 codec
->num_pcms
= 1;
2343 codec
->pcm_info
= info
;
2345 info
->name
= spec
->stream_name_analog
;
2346 if (spec
->stream_analog_playback
) {
2347 snd_assert(spec
->multiout
.dac_nids
, return -EINVAL
);
2348 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
2349 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
2351 if (spec
->stream_analog_capture
) {
2352 snd_assert(spec
->adc_nids
, return -EINVAL
);
2353 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
2354 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
2357 if (spec
->channel_mode
) {
2358 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
2359 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
2360 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
2361 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
2366 /* SPDIF for stream index #1 */
2367 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2368 codec
->num_pcms
= 2;
2369 info
= spec
->pcm_rec
+ 1;
2370 info
->name
= spec
->stream_name_digital
;
2371 if (spec
->multiout
.dig_out_nid
&&
2372 spec
->stream_digital_playback
) {
2373 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
2374 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2376 if (spec
->dig_in_nid
&&
2377 spec
->stream_digital_capture
) {
2378 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
2379 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2383 /* If the use of more than one ADC is requested for the current
2384 * model, configure a second analog capture-only PCM.
2386 /* Additional Analaog capture for index #2 */
2387 if (spec
->num_adc_nids
> 1 && spec
->stream_analog_capture
&&
2389 codec
->num_pcms
= 3;
2390 info
= spec
->pcm_rec
+ 2;
2391 info
->name
= spec
->stream_name_analog
;
2392 /* No playback stream for second PCM */
2393 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = alc_pcm_null_playback
;
2394 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
2395 if (spec
->stream_analog_capture
) {
2396 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
2397 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[1];
2404 static void alc_free(struct hda_codec
*codec
)
2406 struct alc_spec
*spec
= codec
->spec
;
2412 if (spec
->kctl_alloc
) {
2413 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
2414 kfree(spec
->kctl_alloc
[i
].name
);
2415 kfree(spec
->kctl_alloc
);
2422 static struct hda_codec_ops alc_patch_ops
= {
2423 .build_controls
= alc_build_controls
,
2424 .build_pcms
= alc_build_pcms
,
2427 .unsol_event
= alc_unsol_event
,
2428 #ifdef CONFIG_SND_HDA_POWER_SAVE
2429 .check_power_status
= alc_check_power_status
,
2435 * Test configuration for debugging
2437 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2440 #ifdef CONFIG_SND_DEBUG
2441 static hda_nid_t alc880_test_dac_nids
[4] = {
2442 0x02, 0x03, 0x04, 0x05
2445 static struct hda_input_mux alc880_test_capture_source
= {
2454 { "Surround", 0x6 },
2458 static struct hda_channel_mode alc880_test_modes
[4] = {
2465 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
2466 struct snd_ctl_elem_info
*uinfo
)
2468 static char *texts
[] = {
2469 "N/A", "Line Out", "HP Out",
2470 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2472 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2474 uinfo
->value
.enumerated
.items
= 8;
2475 if (uinfo
->value
.enumerated
.item
>= 8)
2476 uinfo
->value
.enumerated
.item
= 7;
2477 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2481 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
2482 struct snd_ctl_elem_value
*ucontrol
)
2484 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2485 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2486 unsigned int pin_ctl
, item
= 0;
2488 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2489 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2490 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
2491 if (pin_ctl
& AC_PINCTL_HP_EN
)
2495 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
2496 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
2497 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
2498 case AC_PINCTL_VREF_50
: item
= 4; break;
2499 case AC_PINCTL_VREF_GRD
: item
= 5; break;
2500 case AC_PINCTL_VREF_80
: item
= 6; break;
2501 case AC_PINCTL_VREF_100
: item
= 7; break;
2504 ucontrol
->value
.enumerated
.item
[0] = item
;
2508 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
2509 struct snd_ctl_elem_value
*ucontrol
)
2511 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2512 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2513 static unsigned int ctls
[] = {
2514 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
2515 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
2516 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
2517 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
2518 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
2519 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
2521 unsigned int old_ctl
, new_ctl
;
2523 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2524 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2525 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
2526 if (old_ctl
!= new_ctl
) {
2528 snd_hda_codec_write_cache(codec
, nid
, 0,
2529 AC_VERB_SET_PIN_WIDGET_CONTROL
,
2531 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
2533 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
2540 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
2541 struct snd_ctl_elem_info
*uinfo
)
2543 static char *texts
[] = {
2544 "Front", "Surround", "CLFE", "Side"
2546 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2548 uinfo
->value
.enumerated
.items
= 4;
2549 if (uinfo
->value
.enumerated
.item
>= 4)
2550 uinfo
->value
.enumerated
.item
= 3;
2551 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2555 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
2556 struct snd_ctl_elem_value
*ucontrol
)
2558 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2559 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2562 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
2563 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
2567 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
2568 struct snd_ctl_elem_value
*ucontrol
)
2570 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2571 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2574 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
2575 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
2576 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
2577 snd_hda_codec_write_cache(codec
, nid
, 0,
2578 AC_VERB_SET_CONNECT_SEL
, sel
);
2584 #define PIN_CTL_TEST(xname,nid) { \
2585 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2587 .info = alc_test_pin_ctl_info, \
2588 .get = alc_test_pin_ctl_get, \
2589 .put = alc_test_pin_ctl_put, \
2590 .private_value = nid \
2593 #define PIN_SRC_TEST(xname,nid) { \
2594 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2596 .info = alc_test_pin_src_info, \
2597 .get = alc_test_pin_src_get, \
2598 .put = alc_test_pin_src_put, \
2599 .private_value = nid \
2602 static struct snd_kcontrol_new alc880_test_mixer
[] = {
2603 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2604 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2605 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
2606 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2607 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2608 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2609 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
2610 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2611 PIN_CTL_TEST("Front Pin Mode", 0x14),
2612 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2613 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2614 PIN_CTL_TEST("Side Pin Mode", 0x17),
2615 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2616 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2617 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2618 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2619 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2620 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2621 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2622 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2623 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2624 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2625 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2626 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2627 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
2628 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
2629 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2630 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2631 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
2632 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
2634 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2635 .name
= "Channel Mode",
2636 .info
= alc_ch_mode_info
,
2637 .get
= alc_ch_mode_get
,
2638 .put
= alc_ch_mode_put
,
2643 static struct hda_verb alc880_test_init_verbs
[] = {
2644 /* Unmute inputs of 0x0c - 0x0f */
2645 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2646 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2647 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2648 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2649 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2650 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2651 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2652 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2653 /* Vol output for 0x0c-0x0f */
2654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2655 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2656 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2657 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2658 /* Set output pins 0x14-0x17 */
2659 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2660 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2661 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2662 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2663 /* Unmute output pins 0x14-0x17 */
2664 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2665 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2666 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2667 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2668 /* Set input pins 0x18-0x1c */
2669 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2670 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2671 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2672 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2673 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2674 /* Mute input pins 0x18-0x1b */
2675 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2676 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2677 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2678 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2680 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2681 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2682 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2683 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2684 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2685 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2686 /* Analog input/passthru */
2687 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2689 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
2690 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
2691 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
2699 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
2700 [ALC880_3ST
] = "3stack",
2701 [ALC880_TCL_S700
] = "tcl",
2702 [ALC880_3ST_DIG
] = "3stack-digout",
2703 [ALC880_CLEVO
] = "clevo",
2704 [ALC880_5ST
] = "5stack",
2705 [ALC880_5ST_DIG
] = "5stack-digout",
2706 [ALC880_W810
] = "w810",
2707 [ALC880_Z71V
] = "z71v",
2708 [ALC880_6ST
] = "6stack",
2709 [ALC880_6ST_DIG
] = "6stack-digout",
2710 [ALC880_ASUS
] = "asus",
2711 [ALC880_ASUS_W1V
] = "asus-w1v",
2712 [ALC880_ASUS_DIG
] = "asus-dig",
2713 [ALC880_ASUS_DIG2
] = "asus-dig2",
2714 [ALC880_UNIWILL_DIG
] = "uniwill",
2715 [ALC880_UNIWILL_P53
] = "uniwill-p53",
2716 [ALC880_FUJITSU
] = "fujitsu",
2717 [ALC880_F1734
] = "F1734",
2719 [ALC880_LG_LW
] = "lg-lw",
2720 #ifdef CONFIG_SND_DEBUG
2721 [ALC880_TEST
] = "test",
2723 [ALC880_AUTO
] = "auto",
2726 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
2727 /* Broken BIOS configuration */
2728 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
),
2729 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
2731 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
2732 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
2733 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
2734 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
2735 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
2736 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
2737 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
2738 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
2739 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
2741 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
2742 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
2744 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
2745 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
2746 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
2747 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
2748 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
2749 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
2750 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
2751 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2752 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
2753 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
2754 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS
),
2755 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
2756 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
2757 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
2758 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS
),
2760 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
2761 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
2762 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
2763 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
2764 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
2765 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
2766 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
2767 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
2768 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
2769 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
2770 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
2771 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
2772 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
2773 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
2774 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
2775 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
2776 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
2777 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
2779 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
2780 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
2781 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
2782 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
2784 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
2785 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL
),
2786 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
2787 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
2789 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
2790 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
2791 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
2792 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
2794 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
2795 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
2796 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
2797 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
2798 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
2799 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
2800 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
2801 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
2802 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
2803 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
2804 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST
),
2810 * ALC880 codec presets
2812 static struct alc_config_preset alc880_presets
[] = {
2814 .mixers
= { alc880_three_stack_mixer
},
2815 .init_verbs
= { alc880_volume_init_verbs
,
2816 alc880_pin_3stack_init_verbs
},
2817 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2818 .dac_nids
= alc880_dac_nids
,
2819 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2820 .channel_mode
= alc880_threestack_modes
,
2822 .input_mux
= &alc880_capture_source
,
2824 [ALC880_3ST_DIG
] = {
2825 .mixers
= { alc880_three_stack_mixer
},
2826 .init_verbs
= { alc880_volume_init_verbs
,
2827 alc880_pin_3stack_init_verbs
},
2828 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2829 .dac_nids
= alc880_dac_nids
,
2830 .dig_out_nid
= ALC880_DIGOUT_NID
,
2831 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2832 .channel_mode
= alc880_threestack_modes
,
2834 .input_mux
= &alc880_capture_source
,
2836 [ALC880_TCL_S700
] = {
2837 .mixers
= { alc880_tcl_s700_mixer
},
2838 .init_verbs
= { alc880_volume_init_verbs
,
2839 alc880_pin_tcl_S700_init_verbs
,
2840 alc880_gpio2_init_verbs
},
2841 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2842 .dac_nids
= alc880_dac_nids
,
2844 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2845 .channel_mode
= alc880_2_jack_modes
,
2846 .input_mux
= &alc880_capture_source
,
2849 .mixers
= { alc880_three_stack_mixer
,
2850 alc880_five_stack_mixer
},
2851 .init_verbs
= { alc880_volume_init_verbs
,
2852 alc880_pin_5stack_init_verbs
},
2853 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2854 .dac_nids
= alc880_dac_nids
,
2855 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
2856 .channel_mode
= alc880_fivestack_modes
,
2857 .input_mux
= &alc880_capture_source
,
2859 [ALC880_5ST_DIG
] = {
2860 .mixers
= { alc880_three_stack_mixer
,
2861 alc880_five_stack_mixer
},
2862 .init_verbs
= { alc880_volume_init_verbs
,
2863 alc880_pin_5stack_init_verbs
},
2864 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2865 .dac_nids
= alc880_dac_nids
,
2866 .dig_out_nid
= ALC880_DIGOUT_NID
,
2867 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
2868 .channel_mode
= alc880_fivestack_modes
,
2869 .input_mux
= &alc880_capture_source
,
2872 .mixers
= { alc880_six_stack_mixer
},
2873 .init_verbs
= { alc880_volume_init_verbs
,
2874 alc880_pin_6stack_init_verbs
},
2875 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
2876 .dac_nids
= alc880_6st_dac_nids
,
2877 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
2878 .channel_mode
= alc880_sixstack_modes
,
2879 .input_mux
= &alc880_6stack_capture_source
,
2881 [ALC880_6ST_DIG
] = {
2882 .mixers
= { alc880_six_stack_mixer
},
2883 .init_verbs
= { alc880_volume_init_verbs
,
2884 alc880_pin_6stack_init_verbs
},
2885 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
2886 .dac_nids
= alc880_6st_dac_nids
,
2887 .dig_out_nid
= ALC880_DIGOUT_NID
,
2888 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
2889 .channel_mode
= alc880_sixstack_modes
,
2890 .input_mux
= &alc880_6stack_capture_source
,
2893 .mixers
= { alc880_w810_base_mixer
},
2894 .init_verbs
= { alc880_volume_init_verbs
,
2895 alc880_pin_w810_init_verbs
,
2896 alc880_gpio2_init_verbs
},
2897 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
2898 .dac_nids
= alc880_w810_dac_nids
,
2899 .dig_out_nid
= ALC880_DIGOUT_NID
,
2900 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
2901 .channel_mode
= alc880_w810_modes
,
2902 .input_mux
= &alc880_capture_source
,
2905 .mixers
= { alc880_z71v_mixer
},
2906 .init_verbs
= { alc880_volume_init_verbs
,
2907 alc880_pin_z71v_init_verbs
},
2908 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
2909 .dac_nids
= alc880_z71v_dac_nids
,
2910 .dig_out_nid
= ALC880_DIGOUT_NID
,
2912 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2913 .channel_mode
= alc880_2_jack_modes
,
2914 .input_mux
= &alc880_capture_source
,
2917 .mixers
= { alc880_f1734_mixer
},
2918 .init_verbs
= { alc880_volume_init_verbs
,
2919 alc880_pin_f1734_init_verbs
},
2920 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
2921 .dac_nids
= alc880_f1734_dac_nids
,
2923 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2924 .channel_mode
= alc880_2_jack_modes
,
2925 .input_mux
= &alc880_capture_source
,
2928 .mixers
= { alc880_asus_mixer
},
2929 .init_verbs
= { alc880_volume_init_verbs
,
2930 alc880_pin_asus_init_verbs
,
2931 alc880_gpio1_init_verbs
},
2932 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2933 .dac_nids
= alc880_asus_dac_nids
,
2934 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2935 .channel_mode
= alc880_asus_modes
,
2937 .input_mux
= &alc880_capture_source
,
2939 [ALC880_ASUS_DIG
] = {
2940 .mixers
= { alc880_asus_mixer
},
2941 .init_verbs
= { alc880_volume_init_verbs
,
2942 alc880_pin_asus_init_verbs
,
2943 alc880_gpio1_init_verbs
},
2944 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2945 .dac_nids
= alc880_asus_dac_nids
,
2946 .dig_out_nid
= ALC880_DIGOUT_NID
,
2947 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2948 .channel_mode
= alc880_asus_modes
,
2950 .input_mux
= &alc880_capture_source
,
2952 [ALC880_ASUS_DIG2
] = {
2953 .mixers
= { alc880_asus_mixer
},
2954 .init_verbs
= { alc880_volume_init_verbs
,
2955 alc880_pin_asus_init_verbs
,
2956 alc880_gpio2_init_verbs
}, /* use GPIO2 */
2957 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2958 .dac_nids
= alc880_asus_dac_nids
,
2959 .dig_out_nid
= ALC880_DIGOUT_NID
,
2960 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2961 .channel_mode
= alc880_asus_modes
,
2963 .input_mux
= &alc880_capture_source
,
2965 [ALC880_ASUS_W1V
] = {
2966 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
2967 .init_verbs
= { alc880_volume_init_verbs
,
2968 alc880_pin_asus_init_verbs
,
2969 alc880_gpio1_init_verbs
},
2970 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2971 .dac_nids
= alc880_asus_dac_nids
,
2972 .dig_out_nid
= ALC880_DIGOUT_NID
,
2973 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2974 .channel_mode
= alc880_asus_modes
,
2976 .input_mux
= &alc880_capture_source
,
2978 [ALC880_UNIWILL_DIG
] = {
2979 .mixers
= { alc880_asus_mixer
, alc880_pcbeep_mixer
},
2980 .init_verbs
= { alc880_volume_init_verbs
,
2981 alc880_pin_asus_init_verbs
},
2982 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2983 .dac_nids
= alc880_asus_dac_nids
,
2984 .dig_out_nid
= ALC880_DIGOUT_NID
,
2985 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2986 .channel_mode
= alc880_asus_modes
,
2988 .input_mux
= &alc880_capture_source
,
2990 [ALC880_UNIWILL
] = {
2991 .mixers
= { alc880_uniwill_mixer
},
2992 .init_verbs
= { alc880_volume_init_verbs
,
2993 alc880_uniwill_init_verbs
},
2994 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2995 .dac_nids
= alc880_asus_dac_nids
,
2996 .dig_out_nid
= ALC880_DIGOUT_NID
,
2997 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2998 .channel_mode
= alc880_threestack_modes
,
3000 .input_mux
= &alc880_capture_source
,
3001 .unsol_event
= alc880_uniwill_unsol_event
,
3002 .init_hook
= alc880_uniwill_automute
,
3004 [ALC880_UNIWILL_P53
] = {
3005 .mixers
= { alc880_uniwill_p53_mixer
},
3006 .init_verbs
= { alc880_volume_init_verbs
,
3007 alc880_uniwill_p53_init_verbs
},
3008 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3009 .dac_nids
= alc880_asus_dac_nids
,
3010 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3011 .channel_mode
= alc880_threestack_modes
,
3012 .input_mux
= &alc880_capture_source
,
3013 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3014 .init_hook
= alc880_uniwill_p53_hp_automute
,
3016 [ALC880_FUJITSU
] = {
3017 .mixers
= { alc880_fujitsu_mixer
,
3018 alc880_pcbeep_mixer
, },
3019 .init_verbs
= { alc880_volume_init_verbs
,
3020 alc880_uniwill_p53_init_verbs
,
3021 alc880_beep_init_verbs
},
3022 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3023 .dac_nids
= alc880_dac_nids
,
3024 .dig_out_nid
= ALC880_DIGOUT_NID
,
3025 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3026 .channel_mode
= alc880_2_jack_modes
,
3027 .input_mux
= &alc880_capture_source
,
3028 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3029 .init_hook
= alc880_uniwill_p53_hp_automute
,
3032 .mixers
= { alc880_three_stack_mixer
},
3033 .init_verbs
= { alc880_volume_init_verbs
,
3034 alc880_pin_clevo_init_verbs
},
3035 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3036 .dac_nids
= alc880_dac_nids
,
3038 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3039 .channel_mode
= alc880_threestack_modes
,
3041 .input_mux
= &alc880_capture_source
,
3044 .mixers
= { alc880_lg_mixer
},
3045 .init_verbs
= { alc880_volume_init_verbs
,
3046 alc880_lg_init_verbs
},
3047 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
3048 .dac_nids
= alc880_lg_dac_nids
,
3049 .dig_out_nid
= ALC880_DIGOUT_NID
,
3050 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
3051 .channel_mode
= alc880_lg_ch_modes
,
3053 .input_mux
= &alc880_lg_capture_source
,
3054 .unsol_event
= alc880_lg_unsol_event
,
3055 .init_hook
= alc880_lg_automute
,
3056 #ifdef CONFIG_SND_HDA_POWER_SAVE
3057 .loopbacks
= alc880_lg_loopbacks
,
3061 .mixers
= { alc880_lg_lw_mixer
},
3062 .init_verbs
= { alc880_volume_init_verbs
,
3063 alc880_lg_lw_init_verbs
},
3064 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3065 .dac_nids
= alc880_dac_nids
,
3066 .dig_out_nid
= ALC880_DIGOUT_NID
,
3067 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
3068 .channel_mode
= alc880_lg_lw_modes
,
3069 .input_mux
= &alc880_lg_lw_capture_source
,
3070 .unsol_event
= alc880_lg_lw_unsol_event
,
3071 .init_hook
= alc880_lg_lw_automute
,
3073 #ifdef CONFIG_SND_DEBUG
3075 .mixers
= { alc880_test_mixer
},
3076 .init_verbs
= { alc880_test_init_verbs
},
3077 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
3078 .dac_nids
= alc880_test_dac_nids
,
3079 .dig_out_nid
= ALC880_DIGOUT_NID
,
3080 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
3081 .channel_mode
= alc880_test_modes
,
3082 .input_mux
= &alc880_test_capture_source
,
3088 * Automatic parse of I/O pins from the BIOS configuration
3091 #define NUM_CONTROL_ALLOC 32
3092 #define NUM_VERB_ALLOC 32
3096 ALC_CTL_WIDGET_MUTE
,
3099 static struct snd_kcontrol_new alc880_control_templates
[] = {
3100 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
3101 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
3102 HDA_BIND_MUTE(NULL
, 0, 0, 0),
3105 /* add dynamic controls */
3106 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
3109 struct snd_kcontrol_new
*knew
;
3111 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
3112 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
3114 /* array + terminator */
3115 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
);
3118 if (spec
->kctl_alloc
) {
3119 memcpy(knew
, spec
->kctl_alloc
,
3120 sizeof(*knew
) * spec
->num_kctl_alloc
);
3121 kfree(spec
->kctl_alloc
);
3123 spec
->kctl_alloc
= knew
;
3124 spec
->num_kctl_alloc
= num
;
3127 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
3128 *knew
= alc880_control_templates
[type
];
3129 knew
->name
= kstrdup(name
, GFP_KERNEL
);
3132 knew
->private_value
= val
;
3133 spec
->num_kctl_used
++;
3137 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3138 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3139 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3140 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3141 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3142 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3143 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3144 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3145 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3146 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3147 #define ALC880_PIN_CD_NID 0x1c
3149 /* fill in the dac_nids table from the parsed pin configuration */
3150 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
3151 const struct auto_pin_cfg
*cfg
)
3157 memset(assigned
, 0, sizeof(assigned
));
3158 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
3160 /* check the pins hardwired to audio widget */
3161 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3162 nid
= cfg
->line_out_pins
[i
];
3163 if (alc880_is_fixed_pin(nid
)) {
3164 int idx
= alc880_fixed_pin_idx(nid
);
3165 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
3169 /* left pins can be connect to any audio widget */
3170 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3171 nid
= cfg
->line_out_pins
[i
];
3172 if (alc880_is_fixed_pin(nid
))
3174 /* search for an empty channel */
3175 for (j
= 0; j
< cfg
->line_outs
; j
++) {
3177 spec
->multiout
.dac_nids
[i
] =
3178 alc880_idx_to_dac(j
);
3184 spec
->multiout
.num_dacs
= cfg
->line_outs
;
3188 /* add playback controls from the parsed DAC table */
3189 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
3190 const struct auto_pin_cfg
*cfg
)
3193 static const char *chname
[4] = {
3194 "Front", "Surround", NULL
/*CLFE*/, "Side"
3199 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3200 if (!spec
->multiout
.dac_nids
[i
])
3202 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
3205 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3206 "Center Playback Volume",
3207 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
3211 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3212 "LFE Playback Volume",
3213 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
3217 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3218 "Center Playback Switch",
3219 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
3223 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3224 "LFE Playback Switch",
3225 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
3230 sprintf(name
, "%s Playback Volume", chname
[i
]);
3231 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3232 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
3236 sprintf(name
, "%s Playback Switch", chname
[i
]);
3237 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3238 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
3247 /* add playback controls for speaker and HP outputs */
3248 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
3258 if (alc880_is_fixed_pin(pin
)) {
3259 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
3260 /* specify the DAC as the extra output */
3261 if (!spec
->multiout
.hp_nid
)
3262 spec
->multiout
.hp_nid
= nid
;
3264 spec
->multiout
.extra_out_nid
[0] = nid
;
3265 /* control HP volume/switch on the output mixer amp */
3266 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
3267 sprintf(name
, "%s Playback Volume", pfx
);
3268 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3269 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
3272 sprintf(name
, "%s Playback Switch", pfx
);
3273 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3274 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
3277 } else if (alc880_is_multi_pin(pin
)) {
3278 /* set manual connection */
3279 /* we have only a switch on HP-out PIN */
3280 sprintf(name
, "%s Playback Switch", pfx
);
3281 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3282 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
3289 /* create input playback/capture controls for the given pin */
3290 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
3291 const char *ctlname
,
3292 int idx
, hda_nid_t mix_nid
)
3297 sprintf(name
, "%s Playback Volume", ctlname
);
3298 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3299 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3302 sprintf(name
, "%s Playback Switch", ctlname
);
3303 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3304 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3310 /* create playback/capture controls for input pins */
3311 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
3312 const struct auto_pin_cfg
*cfg
)
3314 struct hda_input_mux
*imux
= &spec
->private_imux
;
3317 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3318 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
3319 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
3320 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
3321 auto_pin_cfg_labels
[i
],
3325 imux
->items
[imux
->num_items
].label
=
3326 auto_pin_cfg_labels
[i
];
3327 imux
->items
[imux
->num_items
].index
=
3328 alc880_input_pin_idx(cfg
->input_pins
[i
]);
3335 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
3336 hda_nid_t nid
, int pin_type
,
3340 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
3342 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
3344 /* need the manual connection? */
3345 if (alc880_is_multi_pin(nid
)) {
3346 struct alc_spec
*spec
= codec
->spec
;
3347 int idx
= alc880_multi_pin_idx(nid
);
3348 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
3349 AC_VERB_SET_CONNECT_SEL
,
3350 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
3354 static int get_pin_type(int line_out_type
)
3356 if (line_out_type
== AUTO_PIN_HP_OUT
)
3362 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
3364 struct alc_spec
*spec
= codec
->spec
;
3367 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
3368 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
3369 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
3370 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
3371 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
3375 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
3377 struct alc_spec
*spec
= codec
->spec
;
3380 pin
= spec
->autocfg
.speaker_pins
[0];
3381 if (pin
) /* connect to front */
3382 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
3383 pin
= spec
->autocfg
.hp_pins
[0];
3384 if (pin
) /* connect to front */
3385 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
3388 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
3390 struct alc_spec
*spec
= codec
->spec
;
3393 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3394 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
3395 if (alc880_is_input_pin(nid
)) {
3396 snd_hda_codec_write(codec
, nid
, 0,
3397 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3398 i
<= AUTO_PIN_FRONT_MIC
?
3399 PIN_VREF80
: PIN_IN
);
3400 if (nid
!= ALC880_PIN_CD_NID
)
3401 snd_hda_codec_write(codec
, nid
, 0,
3402 AC_VERB_SET_AMP_GAIN_MUTE
,
3408 /* parse the BIOS configuration and set up the alc_spec */
3409 /* return 1 if successful, 0 if the proper config is not found,
3410 * or a negative error code
3412 static int alc880_parse_auto_config(struct hda_codec
*codec
)
3414 struct alc_spec
*spec
= codec
->spec
;
3416 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
3418 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
3422 if (!spec
->autocfg
.line_outs
)
3423 return 0; /* can't find valid BIOS pin config */
3425 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
3428 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
3431 err
= alc880_auto_create_extra_out(spec
,
3432 spec
->autocfg
.speaker_pins
[0],
3436 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
3440 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
3444 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
3446 if (spec
->autocfg
.dig_out_pin
)
3447 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
3448 if (spec
->autocfg
.dig_in_pin
)
3449 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
3451 if (spec
->kctl_alloc
)
3452 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3454 spec
->init_verbs
[spec
->num_init_verbs
++] = alc880_volume_init_verbs
;
3456 spec
->num_mux_defs
= 1;
3457 spec
->input_mux
= &spec
->private_imux
;
3462 /* additional initialization for auto-configuration model */
3463 static void alc880_auto_init(struct hda_codec
*codec
)
3465 alc880_auto_init_multi_out(codec
);
3466 alc880_auto_init_extra_out(codec
);
3467 alc880_auto_init_analog_input(codec
);
3471 * OK, here we have finally the patch for ALC880
3474 static int patch_alc880(struct hda_codec
*codec
)
3476 struct alc_spec
*spec
;
3480 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3486 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
3489 if (board_config
< 0) {
3490 printk(KERN_INFO
"hda_codec: Unknown model for ALC880, "
3491 "trying auto-probe from BIOS...\n");
3492 board_config
= ALC880_AUTO
;
3495 if (board_config
== ALC880_AUTO
) {
3496 /* automatic parse from the BIOS config */
3497 err
= alc880_parse_auto_config(codec
);
3503 "hda_codec: Cannot set up configuration "
3504 "from BIOS. Using 3-stack mode...\n");
3505 board_config
= ALC880_3ST
;
3509 if (board_config
!= ALC880_AUTO
)
3510 setup_preset(spec
, &alc880_presets
[board_config
]);
3512 spec
->stream_name_analog
= "ALC880 Analog";
3513 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
3514 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
3516 spec
->stream_name_digital
= "ALC880 Digital";
3517 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
3518 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
3520 if (!spec
->adc_nids
&& spec
->input_mux
) {
3521 /* check whether NID 0x07 is valid */
3522 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
3524 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
3525 if (wcap
!= AC_WID_AUD_IN
) {
3526 spec
->adc_nids
= alc880_adc_nids_alt
;
3527 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
3528 spec
->mixers
[spec
->num_mixers
] =
3529 alc880_capture_alt_mixer
;
3532 spec
->adc_nids
= alc880_adc_nids
;
3533 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
3534 spec
->mixers
[spec
->num_mixers
] = alc880_capture_mixer
;
3539 codec
->patch_ops
= alc_patch_ops
;
3540 if (board_config
== ALC880_AUTO
)
3541 spec
->init_hook
= alc880_auto_init
;
3542 #ifdef CONFIG_SND_HDA_POWER_SAVE
3543 if (!spec
->loopback
.amplist
)
3544 spec
->loopback
.amplist
= alc880_loopbacks
;
3555 static hda_nid_t alc260_dac_nids
[1] = {
3560 static hda_nid_t alc260_adc_nids
[1] = {
3565 static hda_nid_t alc260_adc_nids_alt
[1] = {
3570 static hda_nid_t alc260_hp_adc_nids
[2] = {
3575 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3576 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3578 static hda_nid_t alc260_dual_adc_nids
[2] = {
3583 #define ALC260_DIGOUT_NID 0x03
3584 #define ALC260_DIGIN_NID 0x06
3586 static struct hda_input_mux alc260_capture_source
= {
3590 { "Front Mic", 0x1 },
3596 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3597 * headphone jack and the internal CD lines since these are the only pins at
3598 * which audio can appear. For flexibility, also allow the option of
3599 * recording the mixer output on the second ADC (ADC0 doesn't have a
3600 * connection to the mixer output).
3602 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
3606 { "Mic/Line", 0x0 },
3608 { "Headphone", 0x2 },
3614 { "Mic/Line", 0x0 },
3616 { "Headphone", 0x2 },
3623 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3624 * the Fujitsu S702x, but jacks are marked differently.
3626 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
3633 { "Headphone", 0x5 },
3642 { "Headphone", 0x6 },
3648 * This is just place-holder, so there's something for alc_build_pcms to look
3649 * at when it calculates the maximum number of channels. ALC260 has no mixer
3650 * element which allows changing the channel mode, so the verb list is
3653 static struct hda_channel_mode alc260_modes
[1] = {
3658 /* Mixer combinations
3660 * basic: base_output + input + pc_beep + capture
3661 * HP: base_output + input + capture_alt
3662 * HP_3013: hp_3013 + input + capture
3663 * fujitsu: fujitsu + capture
3664 * acer: acer + capture
3667 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
3668 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3669 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
3670 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3671 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
3672 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3673 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
3677 static struct snd_kcontrol_new alc260_input_mixer
[] = {
3678 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3679 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3680 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3681 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3683 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3684 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
3685 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
3689 static struct snd_kcontrol_new alc260_pc_beep_mixer
[] = {
3690 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT
),
3691 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT
),
3695 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
3696 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3697 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
3698 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
3699 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
3700 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3701 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
3702 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3703 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
3707 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3708 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3710 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
3711 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3712 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
3713 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3714 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3715 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3716 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
3717 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
3718 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3719 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3720 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3721 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3722 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
3726 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3727 * versions of the ALC260 don't act on requests to enable mic bias from NID
3728 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3729 * datasheet doesn't mention this restriction. At this stage it's not clear
3730 * whether this behaviour is intentional or is a hardware bug in chip
3731 * revisions available in early 2006. Therefore for now allow the
3732 * "Headphone Jack Mode" control to span all choices, but if it turns out
3733 * that the lack of mic bias for this NID is intentional we could change the
3734 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3736 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3737 * don't appear to make the mic bias available from the "line" jack, even
3738 * though the NID used for this jack (0x14) can supply it. The theory is
3739 * that perhaps Acer have included blocking capacitors between the ALC260
3740 * and the output jack. If this turns out to be the case for all such
3741 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3742 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3744 * The C20x Tablet series have a mono internal speaker which is controlled
3745 * via the chip's Mono sum widget and pin complex, so include the necessary
3746 * controls for such models. On models without a "mono speaker" the control
3747 * won't do anything.
3749 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
3750 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3751 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
3752 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
3753 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3755 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3757 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3758 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3760 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3761 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3762 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3763 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3764 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3765 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3766 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3770 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
3771 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
3773 static struct snd_kcontrol_new alc260_will_mixer
[] = {
3774 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3775 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
3776 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3777 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3778 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3779 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3780 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3781 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3782 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3783 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3784 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3785 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3789 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
3790 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
3792 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
3793 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3794 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
3795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3796 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3797 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3798 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
3799 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
3800 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3801 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3802 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3806 /* capture mixer elements */
3807 static struct snd_kcontrol_new alc260_capture_mixer
[] = {
3808 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT
),
3809 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT
),
3810 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT
),
3811 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT
),
3813 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3814 /* The multiple "Capture Source" controls confuse alsamixer
3815 * So call somewhat different..
3816 * FIXME: the controls appear in the "playback" view!
3818 /* .name = "Capture Source", */
3819 .name
= "Input Source",
3821 .info
= alc_mux_enum_info
,
3822 .get
= alc_mux_enum_get
,
3823 .put
= alc_mux_enum_put
,
3828 static struct snd_kcontrol_new alc260_capture_alt_mixer
[] = {
3829 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT
),
3830 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT
),
3832 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3833 /* The multiple "Capture Source" controls confuse alsamixer
3834 * So call somewhat different..
3835 * FIXME: the controls appear in the "playback" view!
3837 /* .name = "Capture Source", */
3838 .name
= "Input Source",
3840 .info
= alc_mux_enum_info
,
3841 .get
= alc_mux_enum_get
,
3842 .put
= alc_mux_enum_put
,
3848 * initialization verbs
3850 static struct hda_verb alc260_init_verbs
[] = {
3851 /* Line In pin widget for input */
3852 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3853 /* CD pin widget for input */
3854 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3855 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3856 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3857 /* Mic2 (front panel) pin widget for input and vref at 80% */
3858 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3859 /* LINE-2 is used for line-out in rear */
3860 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3861 /* select line-out */
3862 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
3864 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3866 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3868 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3869 /* mute capture amp left and right */
3870 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3871 /* set connection select to line in (default select for this ADC) */
3872 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3873 /* mute capture amp left and right */
3874 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3875 /* set connection select to line in (default select for this ADC) */
3876 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
3877 /* set vol=0 Line-Out mixer amp left and right */
3878 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3879 /* unmute pin widget amp left and right (no gain on this amp) */
3880 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3881 /* set vol=0 HP mixer amp left and right */
3882 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3883 /* unmute pin widget amp left and right (no gain on this amp) */
3884 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3885 /* set vol=0 Mono mixer amp left and right */
3886 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3887 /* unmute pin widget amp left and right (no gain on this amp) */
3888 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3889 /* unmute LINE-2 out pin */
3890 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3891 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3894 /* mute analog inputs */
3895 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3896 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3897 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3898 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3899 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3900 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3901 /* mute Front out path */
3902 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3903 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3904 /* mute Headphone out path */
3905 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3906 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3907 /* mute Mono out path */
3908 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3909 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3913 #if 0 /* should be identical with alc260_init_verbs? */
3914 static struct hda_verb alc260_hp_init_verbs
[] = {
3915 /* Headphone and output */
3916 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
3918 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3919 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3920 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3921 /* Mic2 (front panel) pin widget for input and vref at 80% */
3922 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3923 /* Line In pin widget for input */
3924 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3925 /* Line-2 pin widget for output */
3926 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3927 /* CD pin widget for input */
3928 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3929 /* unmute amp left and right */
3930 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
3931 /* set connection select to line in (default select for this ADC) */
3932 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3933 /* unmute Line-Out mixer amp left and right (volume = 0) */
3934 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3935 /* mute pin widget amp left and right (no gain on this amp) */
3936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3937 /* unmute HP mixer amp left and right (volume = 0) */
3938 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3939 /* mute pin widget amp left and right (no gain on this amp) */
3940 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3941 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3944 /* mute analog inputs */
3945 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3946 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3947 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3948 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3949 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3950 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3951 /* Unmute Front out path */
3952 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3953 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3954 /* Unmute Headphone out path */
3955 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3956 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3957 /* Unmute Mono out path */
3958 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3959 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3964 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
3965 /* Line out and output */
3966 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3968 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3969 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3970 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3971 /* Mic2 (front panel) pin widget for input and vref at 80% */
3972 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3973 /* Line In pin widget for input */
3974 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3975 /* Headphone pin widget for output */
3976 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
3977 /* CD pin widget for input */
3978 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3979 /* unmute amp left and right */
3980 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
3981 /* set connection select to line in (default select for this ADC) */
3982 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3983 /* unmute Line-Out mixer amp left and right (volume = 0) */
3984 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3985 /* mute pin widget amp left and right (no gain on this amp) */
3986 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3987 /* unmute HP mixer amp left and right (volume = 0) */
3988 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3989 /* mute pin widget amp left and right (no gain on this amp) */
3990 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3991 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3994 /* mute analog inputs */
3995 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3996 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3997 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3998 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3999 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4000 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4001 /* Unmute Front out path */
4002 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4003 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4004 /* Unmute Headphone out path */
4005 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4006 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4007 /* Unmute Mono out path */
4008 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4009 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4013 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4014 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4015 * audio = 0x16, internal speaker = 0x10.
4017 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
4018 /* Disable all GPIOs */
4019 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
4020 /* Internal speaker is connected to headphone pin */
4021 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4022 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4023 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4024 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4025 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4026 /* Ensure all other unused pins are disabled and muted. */
4027 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4028 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4029 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4030 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4031 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4032 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4033 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4034 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4036 /* Disable digital (SPDIF) pins */
4037 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4038 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4040 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4041 * when acting as an output.
4043 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4045 /* Start with output sum widgets muted and their output gains at min */
4046 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4047 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4048 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4049 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4050 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4051 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4052 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4053 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4054 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4056 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4057 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4058 /* Unmute Line1 pin widget output buffer since it starts as an output.
4059 * If the pin mode is changed by the user the pin mode control will
4060 * take care of enabling the pin's input/output buffers as needed.
4061 * Therefore there's no need to enable the input buffer at this
4064 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4065 /* Unmute input buffer of pin widget used for Line-in (no equiv
4068 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4070 /* Mute capture amp left and right */
4071 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4072 /* Set ADC connection select to match default mixer setting - line
4075 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4077 /* Do the same for the second ADC: mute capture input amp and
4078 * set ADC connection to line in (on mic1 pin)
4080 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4081 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4083 /* Mute all inputs to mixer widget (even unconnected ones) */
4084 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4085 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4086 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4087 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4088 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4089 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4090 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4091 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4096 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4097 * similar laptops (adapted from Fujitsu init verbs).
4099 static struct hda_verb alc260_acer_init_verbs
[] = {
4100 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4101 * the headphone jack. Turn this on and rely on the standard mute
4102 * methods whenever the user wants to turn these outputs off.
4104 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4105 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4106 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
4107 /* Internal speaker/Headphone jack is connected to Line-out pin */
4108 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4109 /* Internal microphone/Mic jack is connected to Mic1 pin */
4110 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
4111 /* Line In jack is connected to Line1 pin */
4112 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4113 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4114 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4115 /* Ensure all other unused pins are disabled and muted. */
4116 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4117 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4118 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4119 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4120 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4121 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4122 /* Disable digital (SPDIF) pins */
4123 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4124 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4126 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4127 * bus when acting as outputs.
4129 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4130 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4132 /* Start with output sum widgets muted and their output gains at min */
4133 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4134 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4135 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4136 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4137 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4138 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4139 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4140 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4141 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4143 /* Unmute Line-out pin widget amp left and right
4144 * (no equiv mixer ctrl)
4146 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4147 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4148 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4149 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4150 * inputs. If the pin mode is changed by the user the pin mode control
4151 * will take care of enabling the pin's input/output buffers as needed.
4152 * Therefore there's no need to enable the input buffer at this
4155 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4156 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4158 /* Mute capture amp left and right */
4159 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4160 /* Set ADC connection select to match default mixer setting - mic
4163 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4165 /* Do similar with the second ADC: mute capture input amp and
4166 * set ADC connection to mic to match ALSA's default state.
4168 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4169 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4171 /* Mute all inputs to mixer widget (even unconnected ones) */
4172 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4173 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4174 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4175 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4176 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4177 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4178 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4179 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4184 static struct hda_verb alc260_will_verbs
[] = {
4185 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4186 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
4187 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
4188 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4189 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4190 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
4194 static struct hda_verb alc260_replacer_672v_verbs
[] = {
4195 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4196 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4197 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
4199 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4200 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4201 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4203 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4207 /* toggle speaker-output according to the hp-jack state */
4208 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
4210 unsigned int present
;
4212 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4213 present
= snd_hda_codec_read(codec
, 0x0f, 0,
4214 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
4216 snd_hda_codec_write_cache(codec
, 0x01, 0,
4217 AC_VERB_SET_GPIO_DATA
, 1);
4218 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4219 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4222 snd_hda_codec_write_cache(codec
, 0x01, 0,
4223 AC_VERB_SET_GPIO_DATA
, 0);
4224 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4225 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4230 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
4233 if ((res
>> 26) == ALC880_HP_EVENT
)
4234 alc260_replacer_672v_automute(codec
);
4237 /* Test configuration for debugging, modelled after the ALC880 test
4240 #ifdef CONFIG_SND_DEBUG
4241 static hda_nid_t alc260_test_dac_nids
[1] = {
4244 static hda_nid_t alc260_test_adc_nids
[2] = {
4247 /* For testing the ALC260, each input MUX needs its own definition since
4248 * the signal assignments are different. This assumes that the first ADC
4251 static struct hda_input_mux alc260_test_capture_sources
[2] = {
4255 { "MIC1 pin", 0x0 },
4256 { "MIC2 pin", 0x1 },
4257 { "LINE1 pin", 0x2 },
4258 { "LINE2 pin", 0x3 },
4260 { "LINE-OUT pin", 0x5 },
4261 { "HP-OUT pin", 0x6 },
4267 { "MIC1 pin", 0x0 },
4268 { "MIC2 pin", 0x1 },
4269 { "LINE1 pin", 0x2 },
4270 { "LINE2 pin", 0x3 },
4273 { "LINE-OUT pin", 0x6 },
4274 { "HP-OUT pin", 0x7 },
4278 static struct snd_kcontrol_new alc260_test_mixer
[] = {
4279 /* Output driver widgets */
4280 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4281 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4282 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4283 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
4284 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4285 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
4287 /* Modes for retasking pin widgets
4288 * Note: the ALC260 doesn't seem to act on requests to enable mic
4289 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4290 * mention this restriction. At this stage it's not clear whether
4291 * this behaviour is intentional or is a hardware bug in chip
4292 * revisions available at least up until early 2006. Therefore for
4293 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4294 * choices, but if it turns out that the lack of mic bias for these
4295 * NIDs is intentional we could change their modes from
4296 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4298 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
4299 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
4300 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
4301 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
4302 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
4303 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
4305 /* Loopback mixer controls */
4306 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
4307 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
4308 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
4309 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
4310 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
4311 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
4312 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
4313 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
4314 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4315 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4316 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4317 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4318 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
4319 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
4320 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
4321 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
4323 /* Controls for GPIO pins, assuming they are configured as outputs */
4324 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4325 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4326 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4327 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4329 /* Switches to allow the digital IO pins to be enabled. The datasheet
4330 * is ambigious as to which NID is which; testing on laptops which
4331 * make this output available should provide clarification.
4333 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4334 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4338 static struct hda_verb alc260_test_init_verbs
[] = {
4339 /* Enable all GPIOs as outputs with an initial value of 0 */
4340 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
4341 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4342 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
4344 /* Enable retasking pins as output, initially without power amp */
4345 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4346 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4347 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4349 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4350 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4352 /* Disable digital (SPDIF) pins initially, but users can enable
4353 * them via a mixer switch. In the case of SPDIF-out, this initverb
4354 * payload also sets the generation to 0, output to be in "consumer"
4355 * PCM format, copyright asserted, no pre-emphasis and no validity
4358 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4359 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4361 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4362 * OUT1 sum bus when acting as an output.
4364 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4365 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
4366 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4367 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
4369 /* Start with output sum widgets muted and their output gains at min */
4370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4371 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4372 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4373 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4374 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4375 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4376 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4377 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4378 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4380 /* Unmute retasking pin widget output buffers since the default
4381 * state appears to be output. As the pin mode is changed by the
4382 * user the pin mode control will take care of enabling the pin's
4383 * input/output buffers as needed.
4385 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4386 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4387 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4388 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4389 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4390 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4391 /* Also unmute the mono-out pin widget */
4392 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4394 /* Mute capture amp left and right */
4395 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4396 /* Set ADC connection select to match default mixer setting (mic1
4399 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4401 /* Do the same for the second ADC: mute capture input amp and
4402 * set ADC connection to mic1 pin
4404 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4405 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4407 /* Mute all inputs to mixer widget (even unconnected ones) */
4408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4410 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4412 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4413 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4414 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4415 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4421 static struct hda_pcm_stream alc260_pcm_analog_playback
= {
4427 static struct hda_pcm_stream alc260_pcm_analog_capture
= {
4433 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4434 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4437 * for BIOS auto-configuration
4440 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
4444 unsigned long vol_val
, sw_val
;
4448 if (nid
>= 0x0f && nid
< 0x11) {
4449 nid_vol
= nid
- 0x7;
4450 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
4451 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4452 } else if (nid
== 0x11) {
4453 nid_vol
= nid
- 0x7;
4454 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
4455 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
4456 } else if (nid
>= 0x12 && nid
<= 0x15) {
4458 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
4459 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4463 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
4464 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
);
4467 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
4468 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
);
4474 /* add playback controls from the parsed DAC table */
4475 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
4476 const struct auto_pin_cfg
*cfg
)
4481 spec
->multiout
.num_dacs
= 1;
4482 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
4483 spec
->multiout
.dac_nids
[0] = 0x02;
4485 nid
= cfg
->line_out_pins
[0];
4487 err
= alc260_add_playback_controls(spec
, nid
, "Front");
4492 nid
= cfg
->speaker_pins
[0];
4494 err
= alc260_add_playback_controls(spec
, nid
, "Speaker");
4499 nid
= cfg
->hp_pins
[0];
4501 err
= alc260_add_playback_controls(spec
, nid
, "Headphone");
4508 /* create playback/capture controls for input pins */
4509 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
4510 const struct auto_pin_cfg
*cfg
)
4512 struct hda_input_mux
*imux
= &spec
->private_imux
;
4515 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4516 if (cfg
->input_pins
[i
] >= 0x12) {
4517 idx
= cfg
->input_pins
[i
] - 0x12;
4518 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4519 auto_pin_cfg_labels
[i
], idx
,
4523 imux
->items
[imux
->num_items
].label
=
4524 auto_pin_cfg_labels
[i
];
4525 imux
->items
[imux
->num_items
].index
= idx
;
4528 if (cfg
->input_pins
[i
] >= 0x0f && cfg
->input_pins
[i
] <= 0x10){
4529 idx
= cfg
->input_pins
[i
] - 0x09;
4530 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4531 auto_pin_cfg_labels
[i
], idx
,
4535 imux
->items
[imux
->num_items
].label
=
4536 auto_pin_cfg_labels
[i
];
4537 imux
->items
[imux
->num_items
].index
= idx
;
4544 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
4545 hda_nid_t nid
, int pin_type
,
4549 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4551 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4553 /* need the manual connection? */
4555 int idx
= nid
- 0x12;
4556 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
4557 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
4561 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
4563 struct alc_spec
*spec
= codec
->spec
;
4566 alc_subsystem_id(codec
, 0x10, 0x15, 0x0f);
4567 nid
= spec
->autocfg
.line_out_pins
[0];
4569 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
4570 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
4573 nid
= spec
->autocfg
.speaker_pins
[0];
4575 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
4577 nid
= spec
->autocfg
.hp_pins
[0];
4579 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
4582 #define ALC260_PIN_CD_NID 0x16
4583 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
4585 struct alc_spec
*spec
= codec
->spec
;
4588 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4589 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
4591 snd_hda_codec_write(codec
, nid
, 0,
4592 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4593 i
<= AUTO_PIN_FRONT_MIC
?
4594 PIN_VREF80
: PIN_IN
);
4595 if (nid
!= ALC260_PIN_CD_NID
)
4596 snd_hda_codec_write(codec
, nid
, 0,
4597 AC_VERB_SET_AMP_GAIN_MUTE
,
4604 * generic initialization of ADC, input mixers and output mixers
4606 static struct hda_verb alc260_volume_init_verbs
[] = {
4608 * Unmute ADC0-1 and set the default input to mic-in
4610 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4611 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4612 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4613 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4615 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4617 * Note: PASD motherboards uses the Line In 2 as the input for
4618 * front panel mic (mic 2)
4620 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4621 /* mute analog inputs */
4622 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4623 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4624 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4625 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4626 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4629 * Set up output mixers (0x08 - 0x0a)
4631 /* set vol=0 to output mixers */
4632 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4633 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4634 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4635 /* set up input amps for analog loopback */
4636 /* Amp Indices: DAC = 0, mixer = 1 */
4637 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4638 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4639 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4640 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4641 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4642 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4647 static int alc260_parse_auto_config(struct hda_codec
*codec
)
4649 struct alc_spec
*spec
= codec
->spec
;
4652 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
4654 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
4658 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
4661 if (!spec
->kctl_alloc
)
4662 return 0; /* can't find valid BIOS pin config */
4663 err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
4667 spec
->multiout
.max_channels
= 2;
4669 if (spec
->autocfg
.dig_out_pin
)
4670 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
4671 if (spec
->kctl_alloc
)
4672 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
4674 spec
->init_verbs
[spec
->num_init_verbs
++] = alc260_volume_init_verbs
;
4676 spec
->num_mux_defs
= 1;
4677 spec
->input_mux
= &spec
->private_imux
;
4679 /* check whether NID 0x04 is valid */
4680 wcap
= get_wcaps(codec
, 0x04);
4681 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
4682 if (wcap
!= AC_WID_AUD_IN
) {
4683 spec
->adc_nids
= alc260_adc_nids_alt
;
4684 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
4685 spec
->mixers
[spec
->num_mixers
] = alc260_capture_alt_mixer
;
4687 spec
->adc_nids
= alc260_adc_nids
;
4688 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
4689 spec
->mixers
[spec
->num_mixers
] = alc260_capture_mixer
;
4696 /* additional initialization for auto-configuration model */
4697 static void alc260_auto_init(struct hda_codec
*codec
)
4699 alc260_auto_init_multi_out(codec
);
4700 alc260_auto_init_analog_input(codec
);
4703 #ifdef CONFIG_SND_HDA_POWER_SAVE
4704 static struct hda_amp_list alc260_loopbacks
[] = {
4705 { 0x07, HDA_INPUT
, 0 },
4706 { 0x07, HDA_INPUT
, 1 },
4707 { 0x07, HDA_INPUT
, 2 },
4708 { 0x07, HDA_INPUT
, 3 },
4709 { 0x07, HDA_INPUT
, 4 },
4715 * ALC260 configurations
4717 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
4718 [ALC260_BASIC
] = "basic",
4720 [ALC260_HP_3013
] = "hp-3013",
4721 [ALC260_FUJITSU_S702X
] = "fujitsu",
4722 [ALC260_ACER
] = "acer",
4723 [ALC260_WILL
] = "will",
4724 [ALC260_REPLACER_672V
] = "replacer",
4725 #ifdef CONFIG_SND_DEBUG
4726 [ALC260_TEST
] = "test",
4728 [ALC260_AUTO
] = "auto",
4731 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
4732 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
4733 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
4734 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
4735 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013
),
4736 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
4737 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP
),
4738 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013
),
4739 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
4740 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
4741 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
4742 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
4743 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
4744 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
4745 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
4746 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
4747 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
4748 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
4749 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
4753 static struct alc_config_preset alc260_presets
[] = {
4755 .mixers
= { alc260_base_output_mixer
,
4757 alc260_pc_beep_mixer
,
4758 alc260_capture_mixer
},
4759 .init_verbs
= { alc260_init_verbs
},
4760 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4761 .dac_nids
= alc260_dac_nids
,
4762 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
4763 .adc_nids
= alc260_adc_nids
,
4764 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4765 .channel_mode
= alc260_modes
,
4766 .input_mux
= &alc260_capture_source
,
4769 .mixers
= { alc260_base_output_mixer
,
4771 alc260_capture_alt_mixer
},
4772 .init_verbs
= { alc260_init_verbs
},
4773 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4774 .dac_nids
= alc260_dac_nids
,
4775 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
4776 .adc_nids
= alc260_hp_adc_nids
,
4777 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4778 .channel_mode
= alc260_modes
,
4779 .input_mux
= &alc260_capture_source
,
4781 [ALC260_HP_3013
] = {
4782 .mixers
= { alc260_hp_3013_mixer
,
4784 alc260_capture_alt_mixer
},
4785 .init_verbs
= { alc260_hp_3013_init_verbs
},
4786 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4787 .dac_nids
= alc260_dac_nids
,
4788 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
4789 .adc_nids
= alc260_hp_adc_nids
,
4790 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4791 .channel_mode
= alc260_modes
,
4792 .input_mux
= &alc260_capture_source
,
4794 [ALC260_FUJITSU_S702X
] = {
4795 .mixers
= { alc260_fujitsu_mixer
,
4796 alc260_capture_mixer
},
4797 .init_verbs
= { alc260_fujitsu_init_verbs
},
4798 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4799 .dac_nids
= alc260_dac_nids
,
4800 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
4801 .adc_nids
= alc260_dual_adc_nids
,
4802 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4803 .channel_mode
= alc260_modes
,
4804 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
4805 .input_mux
= alc260_fujitsu_capture_sources
,
4808 .mixers
= { alc260_acer_mixer
,
4809 alc260_capture_mixer
},
4810 .init_verbs
= { alc260_acer_init_verbs
},
4811 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4812 .dac_nids
= alc260_dac_nids
,
4813 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
4814 .adc_nids
= alc260_dual_adc_nids
,
4815 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4816 .channel_mode
= alc260_modes
,
4817 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
4818 .input_mux
= alc260_acer_capture_sources
,
4821 .mixers
= { alc260_will_mixer
,
4822 alc260_capture_mixer
},
4823 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
4824 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4825 .dac_nids
= alc260_dac_nids
,
4826 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
4827 .adc_nids
= alc260_adc_nids
,
4828 .dig_out_nid
= ALC260_DIGOUT_NID
,
4829 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4830 .channel_mode
= alc260_modes
,
4831 .input_mux
= &alc260_capture_source
,
4833 [ALC260_REPLACER_672V
] = {
4834 .mixers
= { alc260_replacer_672v_mixer
,
4835 alc260_capture_mixer
},
4836 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
4837 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4838 .dac_nids
= alc260_dac_nids
,
4839 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
4840 .adc_nids
= alc260_adc_nids
,
4841 .dig_out_nid
= ALC260_DIGOUT_NID
,
4842 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4843 .channel_mode
= alc260_modes
,
4844 .input_mux
= &alc260_capture_source
,
4845 .unsol_event
= alc260_replacer_672v_unsol_event
,
4846 .init_hook
= alc260_replacer_672v_automute
,
4848 #ifdef CONFIG_SND_DEBUG
4850 .mixers
= { alc260_test_mixer
,
4851 alc260_capture_mixer
},
4852 .init_verbs
= { alc260_test_init_verbs
},
4853 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
4854 .dac_nids
= alc260_test_dac_nids
,
4855 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
4856 .adc_nids
= alc260_test_adc_nids
,
4857 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4858 .channel_mode
= alc260_modes
,
4859 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
4860 .input_mux
= alc260_test_capture_sources
,
4865 static int patch_alc260(struct hda_codec
*codec
)
4867 struct alc_spec
*spec
;
4868 int err
, board_config
;
4870 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4876 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
4879 if (board_config
< 0) {
4880 snd_printd(KERN_INFO
"hda_codec: Unknown model for ALC260, "
4881 "trying auto-probe from BIOS...\n");
4882 board_config
= ALC260_AUTO
;
4885 if (board_config
== ALC260_AUTO
) {
4886 /* automatic parse from the BIOS config */
4887 err
= alc260_parse_auto_config(codec
);
4893 "hda_codec: Cannot set up configuration "
4894 "from BIOS. Using base mode...\n");
4895 board_config
= ALC260_BASIC
;
4899 if (board_config
!= ALC260_AUTO
)
4900 setup_preset(spec
, &alc260_presets
[board_config
]);
4902 spec
->stream_name_analog
= "ALC260 Analog";
4903 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
4904 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
4906 spec
->stream_name_digital
= "ALC260 Digital";
4907 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
4908 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
4910 codec
->patch_ops
= alc_patch_ops
;
4911 if (board_config
== ALC260_AUTO
)
4912 spec
->init_hook
= alc260_auto_init
;
4913 #ifdef CONFIG_SND_HDA_POWER_SAVE
4914 if (!spec
->loopback
.amplist
)
4915 spec
->loopback
.amplist
= alc260_loopbacks
;
4925 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
4926 * configuration. Each pin widget can choose any input DACs and a mixer.
4927 * Each ADC is connected from a mixer of all inputs. This makes possible
4928 * 6-channel independent captures.
4930 * In addition, an independent DAC for the multi-playback (not used in this
4933 #define ALC882_DIGOUT_NID 0x06
4934 #define ALC882_DIGIN_NID 0x0a
4936 static struct hda_channel_mode alc882_ch_modes
[1] = {
4940 static hda_nid_t alc882_dac_nids
[4] = {
4941 /* front, rear, clfe, rear_surr */
4942 0x02, 0x03, 0x04, 0x05
4945 /* identical with ALC880 */
4946 #define alc882_adc_nids alc880_adc_nids
4947 #define alc882_adc_nids_alt alc880_adc_nids_alt
4950 /* FIXME: should be a matrix-type input source selection */
4952 static struct hda_input_mux alc882_capture_source
= {
4956 { "Front Mic", 0x1 },
4961 #define alc882_mux_enum_info alc_mux_enum_info
4962 #define alc882_mux_enum_get alc_mux_enum_get
4964 static int alc882_mux_enum_put(struct snd_kcontrol
*kcontrol
,
4965 struct snd_ctl_elem_value
*ucontrol
)
4967 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4968 struct alc_spec
*spec
= codec
->spec
;
4969 const struct hda_input_mux
*imux
= spec
->input_mux
;
4970 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
4971 static hda_nid_t capture_mixers
[3] = { 0x24, 0x23, 0x22 };
4972 hda_nid_t nid
= capture_mixers
[adc_idx
];
4973 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
4974 unsigned int i
, idx
;
4976 idx
= ucontrol
->value
.enumerated
.item
[0];
4977 if (idx
>= imux
->num_items
)
4978 idx
= imux
->num_items
- 1;
4979 if (*cur_val
== idx
)
4981 for (i
= 0; i
< imux
->num_items
; i
++) {
4982 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
4983 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
4984 imux
->items
[i
].index
,
4994 static struct hda_verb alc882_3ST_ch2_init
[] = {
4995 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4996 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4997 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4998 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5005 static struct hda_verb alc882_3ST_ch6_init
[] = {
5006 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5007 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5008 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
5009 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5010 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5011 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5015 static struct hda_channel_mode alc882_3ST_6ch_modes
[2] = {
5016 { 2, alc882_3ST_ch2_init
},
5017 { 6, alc882_3ST_ch6_init
},
5023 static struct hda_verb alc882_sixstack_ch6_init
[] = {
5024 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
5025 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5026 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5027 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5034 static struct hda_verb alc882_sixstack_ch8_init
[] = {
5035 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5036 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5037 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5038 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5042 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
5043 { 6, alc882_sixstack_ch6_init
},
5044 { 8, alc882_sixstack_ch8_init
},
5048 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5054 static struct hda_verb alc885_mbp_ch2_init
[] = {
5055 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5056 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5057 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5064 static struct hda_verb alc885_mbp_ch6_init
[] = {
5065 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5066 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5067 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5068 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5069 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5073 static struct hda_channel_mode alc885_mbp_6ch_modes
[2] = {
5074 { 2, alc885_mbp_ch2_init
},
5075 { 6, alc885_mbp_ch6_init
},
5079 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5080 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5082 static struct snd_kcontrol_new alc882_base_mixer
[] = {
5083 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5084 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5085 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5086 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5087 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5088 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5089 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5090 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5091 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
5092 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
5093 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5094 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5095 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5096 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5097 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5098 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5099 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5100 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5101 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5102 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5103 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5104 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5105 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5109 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
5110 HDA_CODEC_VOLUME("Master Volume", 0x0c, 0x00, HDA_OUTPUT
),
5111 HDA_BIND_MUTE ("Master Switch", 0x0c, 0x02, HDA_INPUT
),
5112 HDA_CODEC_MUTE ("Speaker Switch", 0x14, 0x00, HDA_OUTPUT
),
5113 HDA_CODEC_VOLUME("Line Out Volume", 0x0d,0x00, HDA_OUTPUT
),
5114 HDA_CODEC_VOLUME("Line In Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5115 HDA_CODEC_MUTE ("Line In Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
5117 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
5118 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0x00, HDA_INPUT
),
5119 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
5122 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
5123 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5124 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5130 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5132 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5133 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5137 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
5138 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5139 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5140 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5141 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5142 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5143 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5144 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5147 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5148 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5149 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5150 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5154 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5155 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5157 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
5158 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5159 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5161 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
5162 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5163 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5164 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5165 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5166 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
5167 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
5168 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5169 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5170 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5174 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
5175 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5176 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5177 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5178 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5179 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5180 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5181 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5182 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5183 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5184 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5185 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5186 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5190 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
5192 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5193 .name
= "Channel Mode",
5194 .info
= alc_ch_mode_info
,
5195 .get
= alc_ch_mode_get
,
5196 .put
= alc_ch_mode_put
,
5201 static struct hda_verb alc882_init_verbs
[] = {
5202 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5203 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5204 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5205 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5207 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5208 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5209 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5211 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5212 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5213 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5215 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5216 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5217 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5219 /* Front Pin: output 0 (0x0c) */
5220 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5222 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5223 /* Rear Pin: output 1 (0x0d) */
5224 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5225 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5226 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5227 /* CLFE Pin: output 2 (0x0e) */
5228 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5229 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5230 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
5231 /* Side Pin: output 3 (0x0f) */
5232 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5233 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5234 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
5235 /* Mic (rear) pin: input vref at 80% */
5236 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5237 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5238 /* Front Mic pin: input vref at 80% */
5239 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5240 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5241 /* Line In pin: input */
5242 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5243 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5244 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5245 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5246 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5247 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5248 /* CD pin widget for input */
5249 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5251 /* FIXME: use matrix-type input source selection */
5252 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5253 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5254 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5255 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5256 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5257 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5260 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5261 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5262 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5268 /* ADC1: mute amp left and right */
5269 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5270 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5271 /* ADC2: mute amp left and right */
5272 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5273 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5274 /* ADC3: mute amp left and right */
5275 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5276 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5281 static struct hda_verb alc882_eapd_verbs
[] = {
5282 /* change to EAPD mode */
5283 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
5284 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
5289 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
5290 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5291 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
5293 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5294 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5295 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5296 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5300 static struct hda_verb alc882_macpro_init_verbs
[] = {
5301 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5304 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5305 /* Front Pin: output 0 (0x0c) */
5306 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5307 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5308 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5309 /* Front Mic pin: input vref at 80% */
5310 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5311 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5312 /* Speaker: output */
5313 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5314 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5315 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
5316 /* Headphone output (output 0 - 0x0c) */
5317 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5318 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5319 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5321 /* FIXME: use matrix-type input source selection */
5322 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5323 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5326 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5327 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5330 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5331 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5332 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5337 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5338 /* ADC1: mute amp left and right */
5339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5340 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5341 /* ADC2: mute amp left and right */
5342 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5343 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5344 /* ADC3: mute amp left and right */
5345 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5346 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5351 /* Macbook Pro rev3 */
5352 static struct hda_verb alc885_mbp3_init_verbs
[] = {
5353 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5355 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5356 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5358 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5359 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5360 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5361 /* Front Pin: output 0 (0x0c) */
5362 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5363 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5364 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5365 /* HP Pin: output 0 (0x0d) */
5366 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
5367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5368 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5369 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5370 /* Mic (rear) pin: input vref at 80% */
5371 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5372 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5373 /* Front Mic pin: input vref at 80% */
5374 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5376 /* Line In pin: use output 1 when in LineOut mode */
5377 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5378 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5379 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
5381 /* FIXME: use matrix-type input source selection */
5382 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5383 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5389 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5390 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5391 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5392 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5394 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5395 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5397 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5398 /* ADC1: mute amp left and right */
5399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5400 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5401 /* ADC2: mute amp left and right */
5402 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5403 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5404 /* ADC3: mute amp left and right */
5405 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5406 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5411 /* iMac 24 mixer. */
5412 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
5413 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
5414 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
5418 /* iMac 24 init verbs. */
5419 static struct hda_verb alc885_imac24_init_verbs
[] = {
5420 /* Internal speakers: output 0 (0x0c) */
5421 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5422 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5423 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5424 /* Internal speakers: output 0 (0x0c) */
5425 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5426 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5427 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
5428 /* Headphone: output 0 (0x0c) */
5429 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5430 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5431 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5432 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5433 /* Front Mic: input vref at 80% */
5434 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5435 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5439 /* Toggle speaker-output according to the hp-jack state */
5440 static void alc885_imac24_automute(struct hda_codec
*codec
)
5442 unsigned int present
;
5444 present
= snd_hda_codec_read(codec
, 0x14, 0,
5445 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5446 snd_hda_codec_amp_stereo(codec
, 0x18, HDA_OUTPUT
, 0,
5447 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5448 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_OUTPUT
, 0,
5449 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5452 /* Processes unsolicited events. */
5453 static void alc885_imac24_unsol_event(struct hda_codec
*codec
,
5456 /* Headphone insertion or removal. */
5457 if ((res
>> 26) == ALC880_HP_EVENT
)
5458 alc885_imac24_automute(codec
);
5461 static void alc885_mbp3_automute(struct hda_codec
*codec
)
5463 unsigned int present
;
5465 present
= snd_hda_codec_read(codec
, 0x15, 0,
5466 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5467 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
5468 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5469 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
5470 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
5473 static void alc885_mbp3_unsol_event(struct hda_codec
*codec
,
5476 /* Headphone insertion or removal. */
5477 if ((res
>> 26) == ALC880_HP_EVENT
)
5478 alc885_mbp3_automute(codec
);
5482 static struct hda_verb alc882_targa_verbs
[] = {
5483 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5484 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5486 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5487 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5489 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5490 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5491 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5493 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5494 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
5495 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
5496 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
5500 /* toggle speaker-output according to the hp-jack state */
5501 static void alc882_targa_automute(struct hda_codec
*codec
)
5503 unsigned int present
;
5505 present
= snd_hda_codec_read(codec
, 0x14, 0,
5506 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5507 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
5508 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5509 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
5513 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
5515 /* Looks like the unsol event is incompatible with the standard
5516 * definition. 4bit tag is placed at 26 bit!
5518 if (((res
>> 26) == ALC880_HP_EVENT
)) {
5519 alc882_targa_automute(codec
);
5523 static struct hda_verb alc882_asus_a7j_verbs
[] = {
5524 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5525 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5527 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5528 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5529 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5531 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5532 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5533 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5535 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5536 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5537 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5541 static struct hda_verb alc882_asus_a7m_verbs
[] = {
5542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5546 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5547 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5549 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5550 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5551 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5553 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5554 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5555 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5559 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
5561 unsigned int gpiostate
, gpiomask
, gpiodir
;
5563 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5564 AC_VERB_GET_GPIO_DATA
, 0);
5567 gpiostate
|= (1 << pin
);
5569 gpiostate
&= ~(1 << pin
);
5571 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5572 AC_VERB_GET_GPIO_MASK
, 0);
5573 gpiomask
|= (1 << pin
);
5575 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5576 AC_VERB_GET_GPIO_DIRECTION
, 0);
5577 gpiodir
|= (1 << pin
);
5580 snd_hda_codec_write(codec
, codec
->afg
, 0,
5581 AC_VERB_SET_GPIO_MASK
, gpiomask
);
5582 snd_hda_codec_write(codec
, codec
->afg
, 0,
5583 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
5587 snd_hda_codec_write(codec
, codec
->afg
, 0,
5588 AC_VERB_SET_GPIO_DATA
, gpiostate
);
5591 /* set up GPIO at initialization */
5592 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
5594 alc882_gpio_mute(codec
, 0, 0);
5595 alc882_gpio_mute(codec
, 1, 0);
5598 /* set up GPIO and update auto-muting at initialization */
5599 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
5601 alc885_macpro_init_hook(codec
);
5602 alc885_imac24_automute(codec
);
5606 * generic initialization of ADC, input mixers and output mixers
5608 static struct hda_verb alc882_auto_init_verbs
[] = {
5610 * Unmute ADC0-2 and set the default input to mic-in
5612 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5614 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5615 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5616 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5617 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5619 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5621 * Note: PASD motherboards uses the Line In 2 as the input for
5622 * front panel mic (mic 2)
5624 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5629 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5632 * Set up output mixers (0x0c - 0x0f)
5634 /* set vol=0 to output mixers */
5635 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5636 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5637 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5638 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5639 /* set up input amps for analog loopback */
5640 /* Amp Indices: DAC = 0, mixer = 1 */
5641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5644 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5646 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5648 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5649 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5650 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5652 /* FIXME: use matrix-type input source selection */
5653 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5654 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5656 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5662 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5665 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5666 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5668 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5673 /* capture mixer elements */
5674 static struct snd_kcontrol_new alc882_capture_alt_mixer
[] = {
5675 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5676 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5677 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5678 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5680 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5681 /* The multiple "Capture Source" controls confuse alsamixer
5682 * So call somewhat different..
5683 * FIXME: the controls appear in the "playback" view!
5685 /* .name = "Capture Source", */
5686 .name
= "Input Source",
5688 .info
= alc882_mux_enum_info
,
5689 .get
= alc882_mux_enum_get
,
5690 .put
= alc882_mux_enum_put
,
5695 static struct snd_kcontrol_new alc882_capture_mixer
[] = {
5696 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
5697 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
5698 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
5699 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
5700 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
5701 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
5703 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5704 /* The multiple "Capture Source" controls confuse alsamixer
5705 * So call somewhat different..
5706 * FIXME: the controls appear in the "playback" view!
5708 /* .name = "Capture Source", */
5709 .name
= "Input Source",
5711 .info
= alc882_mux_enum_info
,
5712 .get
= alc882_mux_enum_get
,
5713 .put
= alc882_mux_enum_put
,
5718 #ifdef CONFIG_SND_HDA_POWER_SAVE
5719 #define alc882_loopbacks alc880_loopbacks
5722 /* pcm configuration: identiacal with ALC880 */
5723 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5724 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5725 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5726 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5729 * configuration and preset
5731 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
5732 [ALC882_3ST_DIG
] = "3stack-dig",
5733 [ALC882_6ST_DIG
] = "6stack-dig",
5734 [ALC882_ARIMA
] = "arima",
5735 [ALC882_W2JC
] = "w2jc",
5736 [ALC882_TARGA
] = "targa",
5737 [ALC882_ASUS_A7J
] = "asus-a7j",
5738 [ALC882_ASUS_A7M
] = "asus-a7m",
5739 [ALC885_MACPRO
] = "macpro",
5740 [ALC885_MBP3
] = "mbp3",
5741 [ALC885_IMAC24
] = "imac24",
5742 [ALC882_AUTO
] = "auto",
5745 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
5746 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
5747 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
5748 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
5749 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
5750 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA
),
5751 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
5752 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
5753 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
5754 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
5755 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
5756 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
5760 static struct alc_config_preset alc882_presets
[] = {
5761 [ALC882_3ST_DIG
] = {
5762 .mixers
= { alc882_base_mixer
},
5763 .init_verbs
= { alc882_init_verbs
},
5764 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5765 .dac_nids
= alc882_dac_nids
,
5766 .dig_out_nid
= ALC882_DIGOUT_NID
,
5767 .dig_in_nid
= ALC882_DIGIN_NID
,
5768 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
5769 .channel_mode
= alc882_ch_modes
,
5771 .input_mux
= &alc882_capture_source
,
5773 [ALC882_6ST_DIG
] = {
5774 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
5775 .init_verbs
= { alc882_init_verbs
},
5776 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5777 .dac_nids
= alc882_dac_nids
,
5778 .dig_out_nid
= ALC882_DIGOUT_NID
,
5779 .dig_in_nid
= ALC882_DIGIN_NID
,
5780 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
5781 .channel_mode
= alc882_sixstack_modes
,
5782 .input_mux
= &alc882_capture_source
,
5785 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
5786 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
},
5787 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5788 .dac_nids
= alc882_dac_nids
,
5789 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
5790 .channel_mode
= alc882_sixstack_modes
,
5791 .input_mux
= &alc882_capture_source
,
5794 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
5795 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
5796 alc880_gpio1_init_verbs
},
5797 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5798 .dac_nids
= alc882_dac_nids
,
5799 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
5800 .channel_mode
= alc880_threestack_modes
,
5802 .input_mux
= &alc882_capture_source
,
5803 .dig_out_nid
= ALC882_DIGOUT_NID
,
5806 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
5807 .init_verbs
= { alc885_mbp3_init_verbs
,
5808 alc880_gpio1_init_verbs
},
5809 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5810 .dac_nids
= alc882_dac_nids
,
5811 .channel_mode
= alc885_mbp_6ch_modes
,
5812 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_6ch_modes
),
5813 .input_mux
= &alc882_capture_source
,
5814 .dig_out_nid
= ALC882_DIGOUT_NID
,
5815 .dig_in_nid
= ALC882_DIGIN_NID
,
5816 .unsol_event
= alc885_mbp3_unsol_event
,
5817 .init_hook
= alc885_mbp3_automute
,
5820 .mixers
= { alc882_macpro_mixer
},
5821 .init_verbs
= { alc882_macpro_init_verbs
},
5822 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5823 .dac_nids
= alc882_dac_nids
,
5824 .dig_out_nid
= ALC882_DIGOUT_NID
,
5825 .dig_in_nid
= ALC882_DIGIN_NID
,
5826 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
5827 .channel_mode
= alc882_ch_modes
,
5828 .input_mux
= &alc882_capture_source
,
5829 .init_hook
= alc885_macpro_init_hook
,
5832 .mixers
= { alc885_imac24_mixer
},
5833 .init_verbs
= { alc885_imac24_init_verbs
},
5834 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5835 .dac_nids
= alc882_dac_nids
,
5836 .dig_out_nid
= ALC882_DIGOUT_NID
,
5837 .dig_in_nid
= ALC882_DIGIN_NID
,
5838 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
5839 .channel_mode
= alc882_ch_modes
,
5840 .input_mux
= &alc882_capture_source
,
5841 .unsol_event
= alc885_imac24_unsol_event
,
5842 .init_hook
= alc885_imac24_init_hook
,
5845 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
,
5846 alc882_capture_mixer
},
5847 .init_verbs
= { alc882_init_verbs
, alc882_targa_verbs
},
5848 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5849 .dac_nids
= alc882_dac_nids
,
5850 .dig_out_nid
= ALC882_DIGOUT_NID
,
5851 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
5852 .adc_nids
= alc882_adc_nids
,
5853 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
5854 .channel_mode
= alc882_3ST_6ch_modes
,
5856 .input_mux
= &alc882_capture_source
,
5857 .unsol_event
= alc882_targa_unsol_event
,
5858 .init_hook
= alc882_targa_automute
,
5860 [ALC882_ASUS_A7J
] = {
5861 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
,
5862 alc882_capture_mixer
},
5863 .init_verbs
= { alc882_init_verbs
, alc882_asus_a7j_verbs
},
5864 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5865 .dac_nids
= alc882_dac_nids
,
5866 .dig_out_nid
= ALC882_DIGOUT_NID
,
5867 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
5868 .adc_nids
= alc882_adc_nids
,
5869 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
5870 .channel_mode
= alc882_3ST_6ch_modes
,
5872 .input_mux
= &alc882_capture_source
,
5874 [ALC882_ASUS_A7M
] = {
5875 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
5876 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
5877 alc880_gpio1_init_verbs
,
5878 alc882_asus_a7m_verbs
},
5879 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5880 .dac_nids
= alc882_dac_nids
,
5881 .dig_out_nid
= ALC882_DIGOUT_NID
,
5882 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
5883 .channel_mode
= alc880_threestack_modes
,
5885 .input_mux
= &alc882_capture_source
,
5894 PINFIX_ABIT_AW9D_MAX
5897 static struct alc_pincfg alc882_abit_aw9d_pinfix
[] = {
5898 { 0x15, 0x01080104 }, /* side */
5899 { 0x16, 0x01011012 }, /* rear */
5900 { 0x17, 0x01016011 }, /* clfe */
5904 static const struct alc_pincfg
*alc882_pin_fixes
[] = {
5905 [PINFIX_ABIT_AW9D_MAX
] = alc882_abit_aw9d_pinfix
,
5908 static struct snd_pci_quirk alc882_pinfix_tbl
[] = {
5909 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
5914 * BIOS auto configuration
5916 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
5917 hda_nid_t nid
, int pin_type
,
5921 struct alc_spec
*spec
= codec
->spec
;
5924 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
5927 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
5929 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5931 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
5933 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
5937 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
5939 struct alc_spec
*spec
= codec
->spec
;
5942 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
5943 for (i
= 0; i
<= HDA_SIDE
; i
++) {
5944 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
5945 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5947 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
5952 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
5954 struct alc_spec
*spec
= codec
->spec
;
5957 pin
= spec
->autocfg
.hp_pins
[0];
5958 if (pin
) /* connect to front */
5960 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
5963 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
5964 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
5966 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
5968 struct alc_spec
*spec
= codec
->spec
;
5971 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5972 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5973 if (alc882_is_input_pin(nid
)) {
5974 snd_hda_codec_write(codec
, nid
, 0,
5975 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5976 i
<= AUTO_PIN_FRONT_MIC
?
5977 PIN_VREF80
: PIN_IN
);
5978 if (nid
!= ALC882_PIN_CD_NID
)
5979 snd_hda_codec_write(codec
, nid
, 0,
5980 AC_VERB_SET_AMP_GAIN_MUTE
,
5986 /* add mic boosts if needed */
5987 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
5989 struct alc_spec
*spec
= codec
->spec
;
5993 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
5995 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
5997 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6001 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
6003 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6005 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6012 /* almost identical with ALC880 parser... */
6013 static int alc882_parse_auto_config(struct hda_codec
*codec
)
6015 struct alc_spec
*spec
= codec
->spec
;
6016 int err
= alc880_parse_auto_config(codec
);
6021 return 0; /* no config found */
6023 err
= alc_auto_add_mic_boost(codec
);
6027 /* hack - override the init verbs */
6028 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
6030 return 1; /* config found */
6033 /* additional initialization for auto-configuration model */
6034 static void alc882_auto_init(struct hda_codec
*codec
)
6036 alc882_auto_init_multi_out(codec
);
6037 alc882_auto_init_hp_out(codec
);
6038 alc882_auto_init_analog_input(codec
);
6041 static int patch_alc882(struct hda_codec
*codec
)
6043 struct alc_spec
*spec
;
6044 int err
, board_config
;
6046 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6052 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
6056 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
6057 /* Pick up systems that don't supply PCI SSID */
6058 switch (codec
->subsystem_id
) {
6059 case 0x106b0c00: /* Mac Pro */
6060 board_config
= ALC885_MACPRO
;
6062 case 0x106b1000: /* iMac 24 */
6063 board_config
= ALC885_IMAC24
;
6065 case 0x106b2c00: /* Macbook Pro rev3 */
6066 board_config
= ALC885_MBP3
;
6069 printk(KERN_INFO
"hda_codec: Unknown model for ALC882, "
6070 "trying auto-probe from BIOS...\n");
6071 board_config
= ALC882_AUTO
;
6075 alc_fix_pincfg(codec
, alc882_pinfix_tbl
, alc882_pin_fixes
);
6077 if (board_config
== ALC882_AUTO
) {
6078 /* automatic parse from the BIOS config */
6079 err
= alc882_parse_auto_config(codec
);
6085 "hda_codec: Cannot set up configuration "
6086 "from BIOS. Using base mode...\n");
6087 board_config
= ALC882_3ST_DIG
;
6091 if (board_config
!= ALC882_AUTO
)
6092 setup_preset(spec
, &alc882_presets
[board_config
]);
6094 spec
->stream_name_analog
= "ALC882 Analog";
6095 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
6096 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
6098 spec
->stream_name_digital
= "ALC882 Digital";
6099 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
6100 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
6102 if (!spec
->adc_nids
&& spec
->input_mux
) {
6103 /* check whether NID 0x07 is valid */
6104 unsigned int wcap
= get_wcaps(codec
, 0x07);
6106 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
6107 if (wcap
!= AC_WID_AUD_IN
) {
6108 spec
->adc_nids
= alc882_adc_nids_alt
;
6109 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
6110 spec
->mixers
[spec
->num_mixers
] =
6111 alc882_capture_alt_mixer
;
6114 spec
->adc_nids
= alc882_adc_nids
;
6115 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
6116 spec
->mixers
[spec
->num_mixers
] = alc882_capture_mixer
;
6121 codec
->patch_ops
= alc_patch_ops
;
6122 if (board_config
== ALC882_AUTO
)
6123 spec
->init_hook
= alc882_auto_init
;
6124 #ifdef CONFIG_SND_HDA_POWER_SAVE
6125 if (!spec
->loopback
.amplist
)
6126 spec
->loopback
.amplist
= alc882_loopbacks
;
6135 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6136 * configuration. Each pin widget can choose any input DACs and a mixer.
6137 * Each ADC is connected from a mixer of all inputs. This makes possible
6138 * 6-channel independent captures.
6140 * In addition, an independent DAC for the multi-playback (not used in this
6143 #define ALC883_DIGOUT_NID 0x06
6144 #define ALC883_DIGIN_NID 0x0a
6146 static hda_nid_t alc883_dac_nids
[4] = {
6147 /* front, rear, clfe, rear_surr */
6148 0x02, 0x04, 0x03, 0x05
6151 static hda_nid_t alc883_adc_nids
[2] = {
6157 /* FIXME: should be a matrix-type input source selection */
6159 static struct hda_input_mux alc883_capture_source
= {
6163 { "Front Mic", 0x1 },
6169 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
6177 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
6187 #define alc883_mux_enum_info alc_mux_enum_info
6188 #define alc883_mux_enum_get alc_mux_enum_get
6190 static int alc883_mux_enum_put(struct snd_kcontrol
*kcontrol
,
6191 struct snd_ctl_elem_value
*ucontrol
)
6193 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6194 struct alc_spec
*spec
= codec
->spec
;
6195 const struct hda_input_mux
*imux
= spec
->input_mux
;
6196 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
6197 static hda_nid_t capture_mixers
[3] = { 0x24, 0x23, 0x22 };
6198 hda_nid_t nid
= capture_mixers
[adc_idx
];
6199 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
6200 unsigned int i
, idx
;
6202 idx
= ucontrol
->value
.enumerated
.item
[0];
6203 if (idx
>= imux
->num_items
)
6204 idx
= imux
->num_items
- 1;
6205 if (*cur_val
== idx
)
6207 for (i
= 0; i
< imux
->num_items
; i
++) {
6208 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
6209 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
6210 imux
->items
[i
].index
,
6220 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
6227 static struct hda_verb alc883_3ST_ch2_init
[] = {
6228 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6229 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6230 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6231 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6238 static struct hda_verb alc883_3ST_ch4_init
[] = {
6239 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6240 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6241 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6242 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6243 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6250 static struct hda_verb alc883_3ST_ch6_init
[] = {
6251 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6252 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6253 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6254 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6255 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6256 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6260 static struct hda_channel_mode alc883_3ST_6ch_modes
[3] = {
6261 { 2, alc883_3ST_ch2_init
},
6262 { 4, alc883_3ST_ch4_init
},
6263 { 6, alc883_3ST_ch6_init
},
6269 static struct hda_verb alc883_sixstack_ch6_init
[] = {
6270 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6271 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6272 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6273 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6280 static struct hda_verb alc883_sixstack_ch8_init
[] = {
6281 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6282 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6283 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6284 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6288 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
6289 { 6, alc883_sixstack_ch6_init
},
6290 { 8, alc883_sixstack_ch8_init
},
6293 static struct hda_verb alc883_medion_eapd_verbs
[] = {
6294 /* eanable EAPD on medion laptop */
6295 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
6296 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
6300 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6301 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6304 static struct snd_kcontrol_new alc883_base_mixer
[] = {
6305 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6306 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6307 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6308 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6309 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6310 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6311 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6312 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6313 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
6314 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
6315 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6316 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6317 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6318 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6319 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6320 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6321 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6322 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6323 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6324 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6325 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6326 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6327 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6328 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6329 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6330 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6331 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6333 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6334 /* .name = "Capture Source", */
6335 .name
= "Input Source",
6337 .info
= alc883_mux_enum_info
,
6338 .get
= alc883_mux_enum_get
,
6339 .put
= alc883_mux_enum_put
,
6344 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
6345 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6346 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6348 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6349 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6350 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6353 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6354 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6355 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6356 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6357 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6358 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6359 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6360 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6361 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6362 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6363 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6365 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6366 /* .name = "Capture Source", */
6367 .name
= "Input Source",
6369 .info
= alc883_mux_enum_info
,
6370 .get
= alc883_mux_enum_get
,
6371 .put
= alc883_mux_enum_put
,
6376 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
6377 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6378 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6379 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6380 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6381 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6382 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6383 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6384 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6385 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6386 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6387 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6388 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6389 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6390 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6391 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6392 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6393 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6394 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6395 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6396 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6397 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6398 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6399 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6400 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6401 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6403 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6404 /* .name = "Capture Source", */
6405 .name
= "Input Source",
6407 .info
= alc883_mux_enum_info
,
6408 .get
= alc883_mux_enum_get
,
6409 .put
= alc883_mux_enum_put
,
6414 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
6415 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6416 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6417 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6418 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6419 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6420 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6421 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT
),
6422 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
6423 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6424 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6425 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6426 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6427 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6429 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6430 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6431 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6432 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6433 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6434 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6435 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6436 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6437 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6440 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6441 /* .name = "Capture Source", */
6442 .name
= "Input Source",
6444 .info
= alc883_mux_enum_info
,
6445 .get
= alc883_mux_enum_get
,
6446 .put
= alc883_mux_enum_put
,
6451 static struct snd_kcontrol_new alc883_tagra_mixer
[] = {
6452 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6453 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6454 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6455 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6456 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6457 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6458 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6459 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6460 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6461 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6462 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6463 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6464 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6465 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6466 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6467 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6468 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6469 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6470 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6471 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6473 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6474 /* .name = "Capture Source", */
6475 .name
= "Input Source",
6477 .info
= alc883_mux_enum_info
,
6478 .get
= alc883_mux_enum_get
,
6479 .put
= alc883_mux_enum_put
,
6484 static struct snd_kcontrol_new alc883_tagra_2ch_mixer
[] = {
6485 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6486 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6487 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6488 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6489 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6490 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6491 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6492 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6493 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6494 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6495 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6496 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6498 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6499 /* .name = "Capture Source", */
6500 .name
= "Input Source",
6502 .info
= alc883_mux_enum_info
,
6503 .get
= alc883_mux_enum_get
,
6504 .put
= alc883_mux_enum_put
,
6509 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
6510 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6511 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6512 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6513 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT
),
6514 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6515 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6516 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6517 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6518 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6519 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6521 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6522 /* .name = "Capture Source", */
6523 .name
= "Input Source",
6525 .info
= alc883_mux_enum_info
,
6526 .get
= alc883_mux_enum_get
,
6527 .put
= alc883_mux_enum_put
,
6532 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
6533 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6534 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
6535 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6536 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6537 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6538 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6539 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6540 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6541 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6542 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6543 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6544 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6545 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6547 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6548 /* .name = "Capture Source", */
6549 .name
= "Input Source",
6551 .info
= alc883_mux_enum_info
,
6552 .get
= alc883_mux_enum_get
,
6553 .put
= alc883_mux_enum_put
,
6558 static struct snd_kcontrol_new alc883_medion_md2_mixer
[] = {
6559 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6560 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6561 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6562 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6563 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6564 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6565 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6566 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6567 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6568 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6569 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6570 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6571 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6573 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6574 /* .name = "Capture Source", */
6575 .name
= "Input Source",
6577 .info
= alc883_mux_enum_info
,
6578 .get
= alc883_mux_enum_get
,
6579 .put
= alc883_mux_enum_put
,
6584 static struct snd_kcontrol_new alc888_6st_hp_mixer
[] = {
6585 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6586 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6587 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
6588 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
6589 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
6590 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
6591 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
6592 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
6593 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
6594 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
6595 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6596 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6597 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6598 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6599 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6600 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6601 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6602 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6603 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6604 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6605 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6606 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6607 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6608 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6609 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6610 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6611 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6613 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6614 /* .name = "Capture Source", */
6615 .name
= "Input Source",
6617 .info
= alc883_mux_enum_info
,
6618 .get
= alc883_mux_enum_get
,
6619 .put
= alc883_mux_enum_put
,
6624 static struct snd_kcontrol_new alc888_3st_hp_mixer
[] = {
6625 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6626 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6627 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
6628 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
6629 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
6630 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
6631 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
6632 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
6633 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6634 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6635 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6636 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6637 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6639 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6640 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6641 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6642 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6643 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6644 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6645 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6646 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6647 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6648 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6649 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6651 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6652 /* .name = "Capture Source", */
6653 .name
= "Input Source",
6655 .info
= alc883_mux_enum_info
,
6656 .get
= alc883_mux_enum_get
,
6657 .put
= alc883_mux_enum_put
,
6662 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
6663 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6664 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6665 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6666 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6667 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6668 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6669 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6671 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6672 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6673 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6674 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6676 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6677 /* .name = "Capture Source", */
6678 .name
= "Input Source",
6680 .info
= alc883_mux_enum_info
,
6681 .get
= alc883_mux_enum_get
,
6682 .put
= alc883_mux_enum_put
,
6687 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
6689 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6690 .name
= "Channel Mode",
6691 .info
= alc_ch_mode_info
,
6692 .get
= alc_ch_mode_get
,
6693 .put
= alc_ch_mode_put
,
6698 static struct hda_verb alc883_init_verbs
[] = {
6699 /* ADC1: mute amp left and right */
6700 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6701 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6702 /* ADC2: mute amp left and right */
6703 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6704 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6705 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6706 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6707 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6708 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6710 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6711 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6712 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6714 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6715 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6716 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6718 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6719 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6720 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6722 /* mute analog input loopbacks */
6723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6729 /* Front Pin: output 0 (0x0c) */
6730 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6731 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6732 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
6733 /* Rear Pin: output 1 (0x0d) */
6734 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6735 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6736 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6737 /* CLFE Pin: output 2 (0x0e) */
6738 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6739 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6740 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
6741 /* Side Pin: output 3 (0x0f) */
6742 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6743 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6744 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
6745 /* Mic (rear) pin: input vref at 80% */
6746 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6747 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6748 /* Front Mic pin: input vref at 80% */
6749 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6751 /* Line In pin: input */
6752 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6753 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6754 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6756 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6757 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6758 /* CD pin widget for input */
6759 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6761 /* FIXME: use matrix-type input source selection */
6762 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6764 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6765 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6767 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
6769 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6770 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
6776 static struct hda_verb alc883_tagra_verbs
[] = {
6777 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6780 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6781 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6783 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6784 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6785 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6787 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6788 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
6789 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
6790 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
6795 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
6796 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6797 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
6798 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
6802 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
6803 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6805 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6806 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6810 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
6811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6813 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6814 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
6815 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6819 static struct hda_verb alc883_haier_w66_verbs
[] = {
6820 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6821 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6825 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6826 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6827 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6828 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6832 static struct hda_verb alc888_6st_hp_verbs
[] = {
6833 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
6834 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* Rear : output 2 (0x0e) */
6835 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* CLFE : output 1 (0x0d) */
6836 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* Side : output 3 (0x0f) */
6840 static struct hda_verb alc888_3st_hp_verbs
[] = {
6841 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
6842 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
6843 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
6847 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
6848 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6849 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6850 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6851 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6855 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
6856 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6857 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6858 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6859 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6863 static struct hda_channel_mode alc888_3st_hp_modes
[2] = {
6864 { 2, alc888_3st_hp_2ch_init
},
6865 { 6, alc888_3st_hp_6ch_init
},
6868 /* toggle front-jack and RCA according to the hp-jack state */
6869 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
6871 unsigned int present
;
6873 present
= snd_hda_codec_read(codec
, 0x1b, 0,
6874 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6875 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
6876 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6877 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
6878 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6881 /* toggle RCA according to the front-jack state */
6882 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
6884 unsigned int present
;
6886 present
= snd_hda_codec_read(codec
, 0x14, 0,
6887 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6888 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
6889 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6892 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
6895 if ((res
>> 26) == ALC880_HP_EVENT
)
6896 alc888_lenovo_ms7195_front_automute(codec
);
6897 if ((res
>> 26) == ALC880_FRONT_EVENT
)
6898 alc888_lenovo_ms7195_rca_automute(codec
);
6901 static struct hda_verb alc883_medion_md2_verbs
[] = {
6902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6903 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6905 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6907 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6911 /* toggle speaker-output according to the hp-jack state */
6912 static void alc883_medion_md2_automute(struct hda_codec
*codec
)
6914 unsigned int present
;
6916 present
= snd_hda_codec_read(codec
, 0x14, 0,
6917 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6918 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
6919 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6922 static void alc883_medion_md2_unsol_event(struct hda_codec
*codec
,
6925 if ((res
>> 26) == ALC880_HP_EVENT
)
6926 alc883_medion_md2_automute(codec
);
6929 /* toggle speaker-output according to the hp-jack state */
6930 static void alc883_tagra_automute(struct hda_codec
*codec
)
6932 unsigned int present
;
6935 present
= snd_hda_codec_read(codec
, 0x14, 0,
6936 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6937 bits
= present
? HDA_AMP_MUTE
: 0;
6938 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
6939 HDA_AMP_MUTE
, bits
);
6940 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
6944 static void alc883_tagra_unsol_event(struct hda_codec
*codec
, unsigned int res
)
6946 if ((res
>> 26) == ALC880_HP_EVENT
)
6947 alc883_tagra_automute(codec
);
6950 static void alc883_haier_w66_automute(struct hda_codec
*codec
)
6952 unsigned int present
;
6955 present
= snd_hda_codec_read(codec
, 0x1b, 0,
6956 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6957 bits
= present
? 0x80 : 0;
6958 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
6962 static void alc883_haier_w66_unsol_event(struct hda_codec
*codec
,
6965 if ((res
>> 26) == ALC880_HP_EVENT
)
6966 alc883_haier_w66_automute(codec
);
6969 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
6971 unsigned int present
;
6974 present
= snd_hda_codec_read(codec
, 0x14, 0,
6975 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6976 bits
= present
? HDA_AMP_MUTE
: 0;
6977 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
6978 HDA_AMP_MUTE
, bits
);
6981 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
6983 unsigned int present
;
6986 present
= snd_hda_codec_read(codec
, 0x1b, 0,
6987 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6988 bits
= present
? HDA_AMP_MUTE
: 0;
6989 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
6990 HDA_AMP_MUTE
, bits
);
6991 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
6992 HDA_AMP_MUTE
, bits
);
6995 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
6998 if ((res
>> 26) == ALC880_HP_EVENT
)
6999 alc883_lenovo_101e_all_automute(codec
);
7000 if ((res
>> 26) == ALC880_FRONT_EVENT
)
7001 alc883_lenovo_101e_ispeaker_automute(codec
);
7004 /* toggle speaker-output according to the hp-jack state */
7005 static void alc883_acer_aspire_automute(struct hda_codec
*codec
)
7007 unsigned int present
;
7009 present
= snd_hda_codec_read(codec
, 0x14, 0,
7010 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7011 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7012 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7013 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
7014 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7017 static void alc883_acer_aspire_unsol_event(struct hda_codec
*codec
,
7020 if ((res
>> 26) == ALC880_HP_EVENT
)
7021 alc883_acer_aspire_automute(codec
);
7024 static struct hda_verb alc883_acer_eapd_verbs
[] = {
7025 /* HP Pin: output 0 (0x0c) */
7026 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7027 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7028 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7029 /* Front Pin: output 0 (0x0c) */
7030 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7031 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7032 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7033 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
7034 /* eanable EAPD on medion laptop */
7035 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
7036 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
7037 /* enable unsolicited event */
7038 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7043 * generic initialization of ADC, input mixers and output mixers
7045 static struct hda_verb alc883_auto_init_verbs
[] = {
7047 * Unmute ADC0-2 and set the default input to mic-in
7049 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7050 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7051 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7052 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7054 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7056 * Note: PASD motherboards uses the Line In 2 as the input for
7057 * front panel mic (mic 2)
7059 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7060 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7061 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7062 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7067 * Set up output mixers (0x0c - 0x0f)
7069 /* set vol=0 to output mixers */
7070 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7071 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7072 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7073 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7074 /* set up input amps for analog loopback */
7075 /* Amp Indices: DAC = 0, mixer = 1 */
7076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7077 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7078 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7079 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7080 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7083 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7084 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7085 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7087 /* FIXME: use matrix-type input source selection */
7088 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7090 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7091 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7092 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7093 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7094 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7096 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7099 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7100 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7105 /* capture mixer elements */
7106 static struct snd_kcontrol_new alc883_capture_mixer
[] = {
7107 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7108 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7109 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7110 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7112 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7113 /* The multiple "Capture Source" controls confuse alsamixer
7114 * So call somewhat different..
7115 * FIXME: the controls appear in the "playback" view!
7117 /* .name = "Capture Source", */
7118 .name
= "Input Source",
7120 .info
= alc882_mux_enum_info
,
7121 .get
= alc882_mux_enum_get
,
7122 .put
= alc882_mux_enum_put
,
7127 #ifdef CONFIG_SND_HDA_POWER_SAVE
7128 #define alc883_loopbacks alc880_loopbacks
7131 /* pcm configuration: identiacal with ALC880 */
7132 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7133 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7134 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7135 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7138 * configuration and preset
7140 static const char *alc883_models
[ALC883_MODEL_LAST
] = {
7141 [ALC883_3ST_2ch_DIG
] = "3stack-dig",
7142 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
7143 [ALC883_3ST_6ch
] = "3stack-6ch",
7144 [ALC883_6ST_DIG
] = "6stack-dig",
7145 [ALC883_TARGA_DIG
] = "targa-dig",
7146 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
7147 [ALC883_ACER
] = "acer",
7148 [ALC883_ACER_ASPIRE
] = "acer-aspire",
7149 [ALC883_MEDION
] = "medion",
7150 [ALC883_MEDION_MD2
] = "medion-md2",
7151 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
7152 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
7153 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
7154 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
7155 [ALC883_HAIER_W66
] = "haier-w66",
7156 [ALC888_6ST_HP
] = "6stack-hp",
7157 [ALC888_3ST_HP
] = "3stack-hp",
7158 [ALC883_AUTO
] = "auto",
7161 static struct snd_pci_quirk alc883_cfg_tbl
[] = {
7162 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG
),
7163 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
7164 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
7165 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD
),
7166 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG
),
7167 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG
),
7168 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
7169 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
7170 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
7171 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
7172 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
7173 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
7174 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
7175 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
7176 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
7177 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
7178 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
7179 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
7180 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
7181 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
7182 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
7183 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
7184 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
7185 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
7186 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
7187 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
7188 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
7189 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER
),
7190 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
7191 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
7192 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
7193 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch
),
7194 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
7195 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7196 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7197 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP
),
7198 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
7199 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
7200 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2
),
7201 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
7202 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7203 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
7204 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
7208 static struct alc_config_preset alc883_presets
[] = {
7209 [ALC883_3ST_2ch_DIG
] = {
7210 .mixers
= { alc883_3ST_2ch_mixer
},
7211 .init_verbs
= { alc883_init_verbs
},
7212 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7213 .dac_nids
= alc883_dac_nids
,
7214 .dig_out_nid
= ALC883_DIGOUT_NID
,
7215 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7216 .adc_nids
= alc883_adc_nids
,
7217 .dig_in_nid
= ALC883_DIGIN_NID
,
7218 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7219 .channel_mode
= alc883_3ST_2ch_modes
,
7220 .input_mux
= &alc883_capture_source
,
7222 [ALC883_3ST_6ch_DIG
] = {
7223 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
7224 .init_verbs
= { alc883_init_verbs
},
7225 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7226 .dac_nids
= alc883_dac_nids
,
7227 .dig_out_nid
= ALC883_DIGOUT_NID
,
7228 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7229 .adc_nids
= alc883_adc_nids
,
7230 .dig_in_nid
= ALC883_DIGIN_NID
,
7231 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7232 .channel_mode
= alc883_3ST_6ch_modes
,
7234 .input_mux
= &alc883_capture_source
,
7236 [ALC883_3ST_6ch
] = {
7237 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
7238 .init_verbs
= { alc883_init_verbs
},
7239 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7240 .dac_nids
= alc883_dac_nids
,
7241 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7242 .adc_nids
= alc883_adc_nids
,
7243 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7244 .channel_mode
= alc883_3ST_6ch_modes
,
7246 .input_mux
= &alc883_capture_source
,
7248 [ALC883_6ST_DIG
] = {
7249 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
7250 .init_verbs
= { alc883_init_verbs
},
7251 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7252 .dac_nids
= alc883_dac_nids
,
7253 .dig_out_nid
= ALC883_DIGOUT_NID
,
7254 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7255 .adc_nids
= alc883_adc_nids
,
7256 .dig_in_nid
= ALC883_DIGIN_NID
,
7257 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
7258 .channel_mode
= alc883_sixstack_modes
,
7259 .input_mux
= &alc883_capture_source
,
7261 [ALC883_TARGA_DIG
] = {
7262 .mixers
= { alc883_tagra_mixer
, alc883_chmode_mixer
},
7263 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
7264 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7265 .dac_nids
= alc883_dac_nids
,
7266 .dig_out_nid
= ALC883_DIGOUT_NID
,
7267 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7268 .adc_nids
= alc883_adc_nids
,
7269 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7270 .channel_mode
= alc883_3ST_6ch_modes
,
7272 .input_mux
= &alc883_capture_source
,
7273 .unsol_event
= alc883_tagra_unsol_event
,
7274 .init_hook
= alc883_tagra_automute
,
7276 [ALC883_TARGA_2ch_DIG
] = {
7277 .mixers
= { alc883_tagra_2ch_mixer
},
7278 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
7279 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7280 .dac_nids
= alc883_dac_nids
,
7281 .dig_out_nid
= ALC883_DIGOUT_NID
,
7282 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7283 .adc_nids
= alc883_adc_nids
,
7284 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7285 .channel_mode
= alc883_3ST_2ch_modes
,
7286 .input_mux
= &alc883_capture_source
,
7287 .unsol_event
= alc883_tagra_unsol_event
,
7288 .init_hook
= alc883_tagra_automute
,
7291 .mixers
= { alc883_base_mixer
},
7292 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7293 * and the headphone jack. Turn this on and rely on the
7294 * standard mute methods whenever the user wants to turn
7295 * these outputs off.
7297 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
7298 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7299 .dac_nids
= alc883_dac_nids
,
7300 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7301 .adc_nids
= alc883_adc_nids
,
7302 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7303 .channel_mode
= alc883_3ST_2ch_modes
,
7304 .input_mux
= &alc883_capture_source
,
7306 [ALC883_ACER_ASPIRE
] = {
7307 .mixers
= { alc883_acer_aspire_mixer
},
7308 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
7309 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7310 .dac_nids
= alc883_dac_nids
,
7311 .dig_out_nid
= ALC883_DIGOUT_NID
,
7312 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7313 .adc_nids
= alc883_adc_nids
,
7314 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7315 .channel_mode
= alc883_3ST_2ch_modes
,
7316 .input_mux
= &alc883_capture_source
,
7317 .unsol_event
= alc883_acer_aspire_unsol_event
,
7318 .init_hook
= alc883_acer_aspire_automute
,
7321 .mixers
= { alc883_fivestack_mixer
,
7322 alc883_chmode_mixer
},
7323 .init_verbs
= { alc883_init_verbs
,
7324 alc883_medion_eapd_verbs
},
7325 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7326 .dac_nids
= alc883_dac_nids
,
7327 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7328 .adc_nids
= alc883_adc_nids
,
7329 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
7330 .channel_mode
= alc883_sixstack_modes
,
7331 .input_mux
= &alc883_capture_source
,
7333 [ALC883_MEDION_MD2
] = {
7334 .mixers
= { alc883_medion_md2_mixer
},
7335 .init_verbs
= { alc883_init_verbs
, alc883_medion_md2_verbs
},
7336 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7337 .dac_nids
= alc883_dac_nids
,
7338 .dig_out_nid
= ALC883_DIGOUT_NID
,
7339 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7340 .adc_nids
= alc883_adc_nids
,
7341 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7342 .channel_mode
= alc883_3ST_2ch_modes
,
7343 .input_mux
= &alc883_capture_source
,
7344 .unsol_event
= alc883_medion_md2_unsol_event
,
7345 .init_hook
= alc883_medion_md2_automute
,
7347 [ALC883_LAPTOP_EAPD
] = {
7348 .mixers
= { alc883_base_mixer
},
7349 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
7350 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7351 .dac_nids
= alc883_dac_nids
,
7352 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7353 .adc_nids
= alc883_adc_nids
,
7354 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7355 .channel_mode
= alc883_3ST_2ch_modes
,
7356 .input_mux
= &alc883_capture_source
,
7358 [ALC883_LENOVO_101E_2ch
] = {
7359 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
7360 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
7361 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7362 .dac_nids
= alc883_dac_nids
,
7363 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7364 .adc_nids
= alc883_adc_nids
,
7365 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7366 .channel_mode
= alc883_3ST_2ch_modes
,
7367 .input_mux
= &alc883_lenovo_101e_capture_source
,
7368 .unsol_event
= alc883_lenovo_101e_unsol_event
,
7369 .init_hook
= alc883_lenovo_101e_all_automute
,
7371 [ALC883_LENOVO_NB0763
] = {
7372 .mixers
= { alc883_lenovo_nb0763_mixer
},
7373 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
7374 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7375 .dac_nids
= alc883_dac_nids
,
7376 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7377 .adc_nids
= alc883_adc_nids
,
7378 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7379 .channel_mode
= alc883_3ST_2ch_modes
,
7381 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
7382 .unsol_event
= alc883_medion_md2_unsol_event
,
7383 .init_hook
= alc883_medion_md2_automute
,
7385 [ALC888_LENOVO_MS7195_DIG
] = {
7386 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
7387 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
7388 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7389 .dac_nids
= alc883_dac_nids
,
7390 .dig_out_nid
= ALC883_DIGOUT_NID
,
7391 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7392 .adc_nids
= alc883_adc_nids
,
7393 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7394 .channel_mode
= alc883_3ST_6ch_modes
,
7396 .input_mux
= &alc883_capture_source
,
7397 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
7398 .init_hook
= alc888_lenovo_ms7195_front_automute
,
7400 [ALC883_HAIER_W66
] = {
7401 .mixers
= { alc883_tagra_2ch_mixer
},
7402 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
7403 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7404 .dac_nids
= alc883_dac_nids
,
7405 .dig_out_nid
= ALC883_DIGOUT_NID
,
7406 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7407 .adc_nids
= alc883_adc_nids
,
7408 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7409 .channel_mode
= alc883_3ST_2ch_modes
,
7410 .input_mux
= &alc883_capture_source
,
7411 .unsol_event
= alc883_haier_w66_unsol_event
,
7412 .init_hook
= alc883_haier_w66_automute
,
7415 .mixers
= { alc888_6st_hp_mixer
, alc883_chmode_mixer
},
7416 .init_verbs
= { alc883_init_verbs
, alc888_6st_hp_verbs
},
7417 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7418 .dac_nids
= alc883_dac_nids
,
7419 .dig_out_nid
= ALC883_DIGOUT_NID
,
7420 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7421 .adc_nids
= alc883_adc_nids
,
7422 .dig_in_nid
= ALC883_DIGIN_NID
,
7423 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
7424 .channel_mode
= alc883_sixstack_modes
,
7425 .input_mux
= &alc883_capture_source
,
7428 .mixers
= { alc888_3st_hp_mixer
, alc883_chmode_mixer
},
7429 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
7430 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7431 .dac_nids
= alc883_dac_nids
,
7432 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7433 .adc_nids
= alc883_adc_nids
,
7434 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
7435 .channel_mode
= alc888_3st_hp_modes
,
7437 .input_mux
= &alc883_capture_source
,
7443 * BIOS auto configuration
7445 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
7446 hda_nid_t nid
, int pin_type
,
7450 struct alc_spec
*spec
= codec
->spec
;
7453 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
7456 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
7458 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
7460 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
7462 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
7466 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
7468 struct alc_spec
*spec
= codec
->spec
;
7471 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
7472 for (i
= 0; i
<= HDA_SIDE
; i
++) {
7473 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
7474 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
7476 alc883_auto_set_output_and_unmute(codec
, nid
, pin_type
,
7481 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
7483 struct alc_spec
*spec
= codec
->spec
;
7486 pin
= spec
->autocfg
.hp_pins
[0];
7487 if (pin
) /* connect to front */
7489 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
7492 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7493 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7495 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
7497 struct alc_spec
*spec
= codec
->spec
;
7500 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
7501 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
7502 if (alc883_is_input_pin(nid
)) {
7503 snd_hda_codec_write(codec
, nid
, 0,
7504 AC_VERB_SET_PIN_WIDGET_CONTROL
,
7505 (i
<= AUTO_PIN_FRONT_MIC
?
7506 PIN_VREF80
: PIN_IN
));
7507 if (nid
!= ALC883_PIN_CD_NID
)
7508 snd_hda_codec_write(codec
, nid
, 0,
7509 AC_VERB_SET_AMP_GAIN_MUTE
,
7515 /* almost identical with ALC880 parser... */
7516 static int alc883_parse_auto_config(struct hda_codec
*codec
)
7518 struct alc_spec
*spec
= codec
->spec
;
7519 int err
= alc880_parse_auto_config(codec
);
7524 return 0; /* no config found */
7526 err
= alc_auto_add_mic_boost(codec
);
7530 /* hack - override the init verbs */
7531 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
7532 spec
->mixers
[spec
->num_mixers
] = alc883_capture_mixer
;
7535 return 1; /* config found */
7538 /* additional initialization for auto-configuration model */
7539 static void alc883_auto_init(struct hda_codec
*codec
)
7541 alc883_auto_init_multi_out(codec
);
7542 alc883_auto_init_hp_out(codec
);
7543 alc883_auto_init_analog_input(codec
);
7546 static int patch_alc883(struct hda_codec
*codec
)
7548 struct alc_spec
*spec
;
7549 int err
, board_config
;
7551 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
7557 board_config
= snd_hda_check_board_config(codec
, ALC883_MODEL_LAST
,
7560 if (board_config
< 0) {
7561 printk(KERN_INFO
"hda_codec: Unknown model for ALC883, "
7562 "trying auto-probe from BIOS...\n");
7563 board_config
= ALC883_AUTO
;
7566 if (board_config
== ALC883_AUTO
) {
7567 /* automatic parse from the BIOS config */
7568 err
= alc883_parse_auto_config(codec
);
7574 "hda_codec: Cannot set up configuration "
7575 "from BIOS. Using base mode...\n");
7576 board_config
= ALC883_3ST_2ch_DIG
;
7580 if (board_config
!= ALC883_AUTO
)
7581 setup_preset(spec
, &alc883_presets
[board_config
]);
7583 spec
->stream_name_analog
= "ALC883 Analog";
7584 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
7585 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
7587 spec
->stream_name_digital
= "ALC883 Digital";
7588 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
7589 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
7591 if (!spec
->adc_nids
&& spec
->input_mux
) {
7592 spec
->adc_nids
= alc883_adc_nids
;
7593 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
7596 codec
->patch_ops
= alc_patch_ops
;
7597 if (board_config
== ALC883_AUTO
)
7598 spec
->init_hook
= alc883_auto_init
;
7599 #ifdef CONFIG_SND_HDA_POWER_SAVE
7600 if (!spec
->loopback
.amplist
)
7601 spec
->loopback
.amplist
= alc883_loopbacks
;
7611 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
7612 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
7614 #define alc262_dac_nids alc260_dac_nids
7615 #define alc262_adc_nids alc882_adc_nids
7616 #define alc262_adc_nids_alt alc882_adc_nids_alt
7618 #define alc262_modes alc260_modes
7619 #define alc262_capture_source alc882_capture_source
7621 static struct snd_kcontrol_new alc262_base_mixer
[] = {
7622 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7623 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7624 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7625 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7626 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7627 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7629 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7630 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7631 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7632 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7633 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7634 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7635 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7636 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
7637 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7638 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7639 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
7643 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
7644 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7645 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7646 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7647 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7648 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7649 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7651 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7652 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7653 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7654 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7655 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7656 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7657 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7658 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
7659 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7663 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
7664 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7665 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7666 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7667 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7668 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
7670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7671 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7672 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7673 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7674 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7675 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7676 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7677 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7678 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7679 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7680 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7681 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7682 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
7683 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
7687 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
7688 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7689 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7690 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7692 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7693 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
7694 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7695 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7696 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT
),
7697 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7698 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7699 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7700 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7701 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7702 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7706 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
7707 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7708 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7709 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT
),
7713 /* bind hp and internal speaker mute (with plug check) */
7714 static int alc262_sony_master_sw_put(struct snd_kcontrol
*kcontrol
,
7715 struct snd_ctl_elem_value
*ucontrol
)
7717 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
7718 long *valp
= ucontrol
->value
.integer
.value
;
7721 /* change hp mute */
7722 change
= snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
7724 valp
[0] ? 0 : HDA_AMP_MUTE
);
7725 change
|= snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
7727 valp
[1] ? 0 : HDA_AMP_MUTE
);
7729 /* change speaker according to HP jack state */
7730 struct alc_spec
*spec
= codec
->spec
;
7732 if (spec
->jack_present
)
7733 mute
= HDA_AMP_MUTE
;
7735 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0,
7737 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7738 HDA_AMP_MUTE
, mute
);
7743 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
7744 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7746 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7747 .name
= "Master Playback Switch",
7748 .info
= snd_hda_mixer_amp_switch_info
,
7749 .get
= snd_hda_mixer_amp_switch_get
,
7750 .put
= alc262_sony_master_sw_put
,
7751 .private_value
= HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
7753 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7754 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7755 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7756 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7760 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
7761 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7762 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7763 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7764 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7765 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7766 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7767 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7771 #define alc262_capture_mixer alc882_capture_mixer
7772 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
7775 * generic initialization of ADC, input mixers and output mixers
7777 static struct hda_verb alc262_init_verbs
[] = {
7779 * Unmute ADC0-2 and set the default input to mic-in
7781 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
7782 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7783 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7784 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7785 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7786 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7788 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7790 * Note: PASD motherboards uses the Line In 2 as the input for
7791 * front panel mic (mic 2)
7793 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7794 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7795 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7796 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7798 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7801 * Set up output mixers (0x0c - 0x0e)
7803 /* set vol=0 to output mixers */
7804 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7805 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7806 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7807 /* set up input amps for analog loopback */
7808 /* Amp Indices: DAC = 0, mixer = 1 */
7809 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7811 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7812 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7813 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7814 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7816 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
7817 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
7818 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
7819 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
7820 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
7821 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
7823 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
7824 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
7825 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
7826 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
7827 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
7829 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7830 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7832 /* FIXME: use matrix-type input source selection */
7833 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7834 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7835 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
7836 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
7837 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
7838 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
7840 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
7841 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
7842 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
7843 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
7845 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
7846 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
7847 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
7848 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
7853 static struct hda_verb alc262_hippo_unsol_verbs
[] = {
7854 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
7855 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7859 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
7860 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
7861 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7862 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
7864 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
7865 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7869 static struct hda_verb alc262_sony_unsol_verbs
[] = {
7870 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
7871 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7872 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
7874 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
7875 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7878 /* mute/unmute internal speaker according to the hp jack and mute state */
7879 static void alc262_hippo_automute(struct hda_codec
*codec
)
7881 struct alc_spec
*spec
= codec
->spec
;
7883 unsigned int present
;
7885 /* need to execute and sync at first */
7886 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
7887 present
= snd_hda_codec_read(codec
, 0x15, 0,
7888 AC_VERB_GET_PIN_SENSE
, 0);
7889 spec
->jack_present
= (present
& 0x80000000) != 0;
7890 if (spec
->jack_present
) {
7891 /* mute internal speaker */
7892 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7893 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
7895 /* unmute internal speaker if necessary */
7896 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
7897 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7898 HDA_AMP_MUTE
, mute
);
7902 /* unsolicited event for HP jack sensing */
7903 static void alc262_hippo_unsol_event(struct hda_codec
*codec
,
7906 if ((res
>> 26) != ALC880_HP_EVENT
)
7908 alc262_hippo_automute(codec
);
7911 static void alc262_hippo1_automute(struct hda_codec
*codec
)
7914 unsigned int present
;
7916 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
7917 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7918 AC_VERB_GET_PIN_SENSE
, 0);
7919 present
= (present
& 0x80000000) != 0;
7921 /* mute internal speaker */
7922 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7923 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
7925 /* unmute internal speaker if necessary */
7926 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
7927 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7928 HDA_AMP_MUTE
, mute
);
7932 /* unsolicited event for HP jack sensing */
7933 static void alc262_hippo1_unsol_event(struct hda_codec
*codec
,
7936 if ((res
>> 26) != ALC880_HP_EVENT
)
7938 alc262_hippo1_automute(codec
);
7943 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
7946 #define ALC_HP_EVENT 0x37
7948 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
7949 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
7950 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7954 static struct hda_input_mux alc262_fujitsu_capture_source
= {
7963 static struct hda_input_mux alc262_HP_capture_source
= {
7967 { "Front Mic", 0x1 },
7974 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
7978 { "Front Mic", 0x2 },
7984 /* mute/unmute internal speaker according to the hp jack and mute state */
7985 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
7987 struct alc_spec
*spec
= codec
->spec
;
7990 if (force
|| !spec
->sense_updated
) {
7991 unsigned int present
;
7992 /* need to execute and sync at first */
7993 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
7994 present
= snd_hda_codec_read(codec
, 0x14, 0,
7995 AC_VERB_GET_PIN_SENSE
, 0);
7996 spec
->jack_present
= (present
& 0x80000000) != 0;
7997 spec
->sense_updated
= 1;
7999 if (spec
->jack_present
) {
8000 /* mute internal speaker */
8001 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8002 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8004 /* unmute internal speaker if necessary */
8005 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
8006 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8007 HDA_AMP_MUTE
, mute
);
8011 /* unsolicited event for HP jack sensing */
8012 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
8015 if ((res
>> 26) != ALC_HP_EVENT
)
8017 alc262_fujitsu_automute(codec
, 1);
8020 /* bind volumes of both NID 0x0c and 0x0d */
8021 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
8022 .ops
= &snd_hda_bind_vol
,
8024 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
8025 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
8030 /* bind hp and internal speaker mute (with plug check) */
8031 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
8032 struct snd_ctl_elem_value
*ucontrol
)
8034 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8035 long *valp
= ucontrol
->value
.integer
.value
;
8038 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
8040 valp
[0] ? 0 : HDA_AMP_MUTE
);
8041 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
8043 valp
[1] ? 0 : HDA_AMP_MUTE
);
8045 alc262_fujitsu_automute(codec
, 0);
8049 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
8050 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
8052 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8053 .name
= "Master Playback Switch",
8054 .info
= snd_hda_mixer_amp_switch_info
,
8055 .get
= snd_hda_mixer_amp_switch_get
,
8056 .put
= alc262_fujitsu_master_sw_put
,
8057 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
8059 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8060 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8061 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8063 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8064 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8065 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8066 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8070 /* additional init verbs for Benq laptops */
8071 static struct hda_verb alc262_EAPD_verbs
[] = {
8072 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8073 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
8077 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
8078 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8079 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8081 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8082 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
8086 /* Samsung Q1 Ultra Vista model setup */
8087 static struct snd_kcontrol_new alc262_ultra_mixer
[] = {
8088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8089 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8092 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8093 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
8097 static struct hda_verb alc262_ultra_verbs
[] = {
8098 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8099 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8100 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8101 /* Mic is on Node 0x19 */
8102 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8103 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x01},
8104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8105 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
8106 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8107 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x01},
8108 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8112 static struct hda_input_mux alc262_ultra_capture_source
= {
8119 /* mute/unmute internal speaker according to the hp jack and mute state */
8120 static void alc262_ultra_automute(struct hda_codec
*codec
)
8122 struct alc_spec
*spec
= codec
->spec
;
8124 unsigned int present
;
8126 /* need to execute and sync at first */
8127 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
8128 present
= snd_hda_codec_read(codec
, 0x15, 0,
8129 AC_VERB_GET_PIN_SENSE
, 0);
8130 spec
->jack_present
= (present
& 0x80000000) != 0;
8131 if (spec
->jack_present
) {
8132 /* mute internal speaker */
8133 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8134 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8136 /* unmute internal speaker if necessary */
8137 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
8138 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8139 HDA_AMP_MUTE
, mute
);
8143 /* unsolicited event for HP jack sensing */
8144 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
8147 if ((res
>> 26) != ALC880_HP_EVENT
)
8149 alc262_ultra_automute(codec
);
8152 /* add playback controls from the parsed DAC table */
8153 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
8154 const struct auto_pin_cfg
*cfg
)
8159 spec
->multiout
.num_dacs
= 1; /* only use one dac */
8160 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
8161 spec
->multiout
.dac_nids
[0] = 2;
8163 nid
= cfg
->line_out_pins
[0];
8165 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
8166 "Front Playback Volume",
8167 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
));
8170 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8171 "Front Playback Switch",
8172 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
8177 nid
= cfg
->speaker_pins
[0];
8180 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
8181 "Speaker Playback Volume",
8182 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8186 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8187 "Speaker Playback Switch",
8188 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
8193 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8194 "Speaker Playback Switch",
8195 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
8201 nid
= cfg
->hp_pins
[0];
8203 /* spec->multiout.hp_nid = 2; */
8205 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
8206 "Headphone Playback Volume",
8207 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8211 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8212 "Headphone Playback Switch",
8213 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
8218 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8219 "Headphone Playback Switch",
8220 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
8229 /* identical with ALC880 */
8230 #define alc262_auto_create_analog_input_ctls \
8231 alc880_auto_create_analog_input_ctls
8234 * generic initialization of ADC, input mixers and output mixers
8236 static struct hda_verb alc262_volume_init_verbs
[] = {
8238 * Unmute ADC0-2 and set the default input to mic-in
8240 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8241 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8242 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8243 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8244 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8245 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8247 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8249 * Note: PASD motherboards uses the Line In 2 as the input for
8250 * front panel mic (mic 2)
8252 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8255 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8256 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8257 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8260 * Set up output mixers (0x0c - 0x0f)
8262 /* set vol=0 to output mixers */
8263 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8264 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8265 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8267 /* set up input amps for analog loopback */
8268 /* Amp Indices: DAC = 0, mixer = 1 */
8269 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8270 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8271 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8272 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8273 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8274 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8276 /* FIXME: use matrix-type input source selection */
8277 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8278 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8279 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8280 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8281 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8282 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8284 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8285 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8286 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8287 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8289 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8290 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8291 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8292 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8297 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
8299 * Unmute ADC0-2 and set the default input to mic-in
8301 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8302 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8303 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8305 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8306 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8308 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8310 * Note: PASD motherboards uses the Line In 2 as the input for
8311 * front panel mic (mic 2)
8313 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8315 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
8320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
8323 * Set up output mixers (0x0c - 0x0e)
8325 /* set vol=0 to output mixers */
8326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8327 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8330 /* set up input amps for analog loopback */
8331 /* Amp Indices: DAC = 0, mixer = 1 */
8332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8334 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8335 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8336 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8337 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8339 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8340 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8341 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8343 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8344 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8346 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8347 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8349 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8350 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8351 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8352 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8353 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8355 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
8356 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8357 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8358 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
8359 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8360 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8363 /* FIXME: use matrix-type input source selection */
8364 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8365 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
8368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
8369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
8371 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8372 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
8373 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
8374 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
8376 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8377 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
8378 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
8379 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
8384 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
8386 * Unmute ADC0-2 and set the default input to mic-in
8388 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8389 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8390 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8391 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8392 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8393 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8395 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8397 * Note: PASD motherboards uses the Line In 2 as the input for front
8400 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8404 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8405 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8406 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
8407 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
8408 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
8410 * Set up output mixers (0x0c - 0x0e)
8412 /* set vol=0 to output mixers */
8413 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8414 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8415 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8417 /* set up input amps for analog loopback */
8418 /* Amp Indices: DAC = 0, mixer = 1 */
8419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8420 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8421 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8422 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8423 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8424 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8427 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
8428 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
8429 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
8430 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
8431 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
8432 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
8433 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
8435 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8436 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8438 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8439 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8441 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
8442 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8443 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8444 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
8445 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8446 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8448 /* FIXME: use matrix-type input source selection */
8449 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8450 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
8452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
8453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
8454 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
8455 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
8456 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
8459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8461 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
8462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
8463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
8464 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
8467 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
8470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
8471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
8472 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8473 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
8478 #ifdef CONFIG_SND_HDA_POWER_SAVE
8479 #define alc262_loopbacks alc880_loopbacks
8482 /* pcm configuration: identiacal with ALC880 */
8483 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
8484 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
8485 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
8486 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
8489 * BIOS auto configuration
8491 static int alc262_parse_auto_config(struct hda_codec
*codec
)
8493 struct alc_spec
*spec
= codec
->spec
;
8495 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
8497 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
8501 if (!spec
->autocfg
.line_outs
)
8502 return 0; /* can't find valid BIOS pin config */
8503 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
8506 err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
8510 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
8512 if (spec
->autocfg
.dig_out_pin
)
8513 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
8514 if (spec
->autocfg
.dig_in_pin
)
8515 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
8517 if (spec
->kctl_alloc
)
8518 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
8520 spec
->init_verbs
[spec
->num_init_verbs
++] = alc262_volume_init_verbs
;
8521 spec
->num_mux_defs
= 1;
8522 spec
->input_mux
= &spec
->private_imux
;
8524 err
= alc_auto_add_mic_boost(codec
);
8531 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
8532 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
8533 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
8536 /* init callback for auto-configuration model -- overriding the default init */
8537 static void alc262_auto_init(struct hda_codec
*codec
)
8539 alc262_auto_init_multi_out(codec
);
8540 alc262_auto_init_hp_out(codec
);
8541 alc262_auto_init_analog_input(codec
);
8545 * configuration and preset
8547 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
8548 [ALC262_BASIC
] = "basic",
8549 [ALC262_HIPPO
] = "hippo",
8550 [ALC262_HIPPO_1
] = "hippo_1",
8551 [ALC262_FUJITSU
] = "fujitsu",
8552 [ALC262_HP_BPC
] = "hp-bpc",
8553 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
8554 [ALC262_BENQ_ED8
] = "benq",
8555 [ALC262_BENQ_T31
] = "benq-t31",
8556 [ALC262_SONY_ASSAMD
] = "sony-assamd",
8557 [ALC262_ULTRA
] = "ultra",
8558 [ALC262_AUTO
] = "auto",
8561 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
8562 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
8563 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC
),
8564 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
8565 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC
),
8566 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC
),
8567 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
8568 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC
),
8569 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
8570 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC
),
8571 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
8572 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
8573 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
8574 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
8575 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
8576 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
8577 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
8578 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
8579 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
8580 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
8581 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
8582 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
8583 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
8584 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
8585 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD
),
8586 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
8587 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
8588 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA
),
8592 static struct alc_config_preset alc262_presets
[] = {
8594 .mixers
= { alc262_base_mixer
},
8595 .init_verbs
= { alc262_init_verbs
},
8596 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8597 .dac_nids
= alc262_dac_nids
,
8599 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8600 .channel_mode
= alc262_modes
,
8601 .input_mux
= &alc262_capture_source
,
8604 .mixers
= { alc262_base_mixer
},
8605 .init_verbs
= { alc262_init_verbs
, alc262_hippo_unsol_verbs
},
8606 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8607 .dac_nids
= alc262_dac_nids
,
8609 .dig_out_nid
= ALC262_DIGOUT_NID
,
8610 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8611 .channel_mode
= alc262_modes
,
8612 .input_mux
= &alc262_capture_source
,
8613 .unsol_event
= alc262_hippo_unsol_event
,
8614 .init_hook
= alc262_hippo_automute
,
8616 [ALC262_HIPPO_1
] = {
8617 .mixers
= { alc262_hippo1_mixer
},
8618 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
8619 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8620 .dac_nids
= alc262_dac_nids
,
8622 .dig_out_nid
= ALC262_DIGOUT_NID
,
8623 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8624 .channel_mode
= alc262_modes
,
8625 .input_mux
= &alc262_capture_source
,
8626 .unsol_event
= alc262_hippo1_unsol_event
,
8627 .init_hook
= alc262_hippo1_automute
,
8629 [ALC262_FUJITSU
] = {
8630 .mixers
= { alc262_fujitsu_mixer
},
8631 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
8632 alc262_fujitsu_unsol_verbs
},
8633 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8634 .dac_nids
= alc262_dac_nids
,
8636 .dig_out_nid
= ALC262_DIGOUT_NID
,
8637 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8638 .channel_mode
= alc262_modes
,
8639 .input_mux
= &alc262_fujitsu_capture_source
,
8640 .unsol_event
= alc262_fujitsu_unsol_event
,
8643 .mixers
= { alc262_HP_BPC_mixer
},
8644 .init_verbs
= { alc262_HP_BPC_init_verbs
},
8645 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8646 .dac_nids
= alc262_dac_nids
,
8648 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8649 .channel_mode
= alc262_modes
,
8650 .input_mux
= &alc262_HP_capture_source
,
8652 [ALC262_HP_BPC_D7000_WF
] = {
8653 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
8654 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
8655 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8656 .dac_nids
= alc262_dac_nids
,
8658 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8659 .channel_mode
= alc262_modes
,
8660 .input_mux
= &alc262_HP_D7000_capture_source
,
8662 [ALC262_HP_BPC_D7000_WL
] = {
8663 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
8664 alc262_HP_BPC_WildWest_option_mixer
},
8665 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
8666 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8667 .dac_nids
= alc262_dac_nids
,
8669 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8670 .channel_mode
= alc262_modes
,
8671 .input_mux
= &alc262_HP_D7000_capture_source
,
8673 [ALC262_BENQ_ED8
] = {
8674 .mixers
= { alc262_base_mixer
},
8675 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
8676 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8677 .dac_nids
= alc262_dac_nids
,
8679 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8680 .channel_mode
= alc262_modes
,
8681 .input_mux
= &alc262_capture_source
,
8683 [ALC262_SONY_ASSAMD
] = {
8684 .mixers
= { alc262_sony_mixer
},
8685 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
8686 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8687 .dac_nids
= alc262_dac_nids
,
8689 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8690 .channel_mode
= alc262_modes
,
8691 .input_mux
= &alc262_capture_source
,
8692 .unsol_event
= alc262_hippo_unsol_event
,
8693 .init_hook
= alc262_hippo_automute
,
8695 [ALC262_BENQ_T31
] = {
8696 .mixers
= { alc262_benq_t31_mixer
},
8697 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
, alc262_hippo_unsol_verbs
},
8698 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8699 .dac_nids
= alc262_dac_nids
,
8701 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8702 .channel_mode
= alc262_modes
,
8703 .input_mux
= &alc262_capture_source
,
8704 .unsol_event
= alc262_hippo_unsol_event
,
8705 .init_hook
= alc262_hippo_automute
,
8708 .mixers
= { alc262_ultra_mixer
},
8709 .init_verbs
= { alc262_init_verbs
, alc262_ultra_verbs
},
8710 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8711 .dac_nids
= alc262_dac_nids
,
8713 .dig_out_nid
= ALC262_DIGOUT_NID
,
8714 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8715 .channel_mode
= alc262_modes
,
8716 .input_mux
= &alc262_ultra_capture_source
,
8717 .unsol_event
= alc262_ultra_unsol_event
,
8718 .init_hook
= alc262_ultra_automute
,
8722 static int patch_alc262(struct hda_codec
*codec
)
8724 struct alc_spec
*spec
;
8728 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
8734 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
8739 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
8740 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
8741 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
8742 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
8746 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
8750 if (board_config
< 0) {
8751 printk(KERN_INFO
"hda_codec: Unknown model for ALC262, "
8752 "trying auto-probe from BIOS...\n");
8753 board_config
= ALC262_AUTO
;
8756 if (board_config
== ALC262_AUTO
) {
8757 /* automatic parse from the BIOS config */
8758 err
= alc262_parse_auto_config(codec
);
8764 "hda_codec: Cannot set up configuration "
8765 "from BIOS. Using base mode...\n");
8766 board_config
= ALC262_BASIC
;
8770 if (board_config
!= ALC262_AUTO
)
8771 setup_preset(spec
, &alc262_presets
[board_config
]);
8773 spec
->stream_name_analog
= "ALC262 Analog";
8774 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
8775 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
8777 spec
->stream_name_digital
= "ALC262 Digital";
8778 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
8779 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
8781 if (!spec
->adc_nids
&& spec
->input_mux
) {
8782 /* check whether NID 0x07 is valid */
8783 unsigned int wcap
= get_wcaps(codec
, 0x07);
8786 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
8787 if (wcap
!= AC_WID_AUD_IN
) {
8788 spec
->adc_nids
= alc262_adc_nids_alt
;
8789 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids_alt
);
8790 spec
->mixers
[spec
->num_mixers
] =
8791 alc262_capture_alt_mixer
;
8794 spec
->adc_nids
= alc262_adc_nids
;
8795 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids
);
8796 spec
->mixers
[spec
->num_mixers
] = alc262_capture_mixer
;
8801 codec
->patch_ops
= alc_patch_ops
;
8802 if (board_config
== ALC262_AUTO
)
8803 spec
->init_hook
= alc262_auto_init
;
8804 #ifdef CONFIG_SND_HDA_POWER_SAVE
8805 if (!spec
->loopback
.amplist
)
8806 spec
->loopback
.amplist
= alc262_loopbacks
;
8813 * ALC268 channel source setting (2 channel)
8815 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
8816 #define alc268_modes alc260_modes
8818 static hda_nid_t alc268_dac_nids
[2] = {
8823 static hda_nid_t alc268_adc_nids
[2] = {
8828 static hda_nid_t alc268_adc_nids_alt
[1] = {
8833 static struct snd_kcontrol_new alc268_base_mixer
[] = {
8834 /* output mixer control */
8835 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
8836 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8837 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
8838 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8839 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8840 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8841 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
8845 static struct hda_verb alc268_eapd_verbs
[] = {
8846 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8847 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8851 /* Toshiba specific */
8852 #define alc268_toshiba_automute alc262_hippo_automute
8854 static struct hda_verb alc268_toshiba_verbs
[] = {
8855 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8860 /* bind volumes of both NID 0x02 and 0x03 */
8861 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
8862 .ops
= &snd_hda_bind_vol
,
8864 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
8865 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
8870 /* mute/unmute internal speaker according to the hp jack and mute state */
8871 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
8873 struct alc_spec
*spec
= codec
->spec
;
8876 if (force
|| !spec
->sense_updated
) {
8877 unsigned int present
;
8878 present
= snd_hda_codec_read(codec
, 0x14, 0,
8879 AC_VERB_GET_PIN_SENSE
, 0);
8880 spec
->jack_present
= (present
& 0x80000000) != 0;
8881 spec
->sense_updated
= 1;
8883 if (spec
->jack_present
)
8884 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
8885 else /* unmute internal speaker if necessary */
8886 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
8887 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8888 HDA_AMP_MUTE
, mute
);
8892 /* bind hp and internal speaker mute (with plug check) */
8893 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
8894 struct snd_ctl_elem_value
*ucontrol
)
8896 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8897 long *valp
= ucontrol
->value
.integer
.value
;
8900 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
8902 valp
[0] ? 0 : HDA_AMP_MUTE
);
8903 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
8905 valp
[1] ? 0 : HDA_AMP_MUTE
);
8907 alc268_acer_automute(codec
, 0);
8911 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
8912 /* output mixer control */
8913 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
8915 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8916 .name
= "Master Playback Switch",
8917 .info
= snd_hda_mixer_amp_switch_info
,
8918 .get
= snd_hda_mixer_amp_switch_get
,
8919 .put
= alc268_acer_master_sw_put
,
8920 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
8922 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8923 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
8924 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
8928 static struct hda_verb alc268_acer_verbs
[] = {
8929 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8930 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8932 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8936 /* unsolicited event for HP jack sensing */
8937 static void alc268_toshiba_unsol_event(struct hda_codec
*codec
,
8940 if ((res
>> 26) != ALC880_HP_EVENT
)
8942 alc268_toshiba_automute(codec
);
8945 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
8948 if ((res
>> 26) != ALC880_HP_EVENT
)
8950 alc268_acer_automute(codec
, 1);
8953 static void alc268_acer_init_hook(struct hda_codec
*codec
)
8955 alc268_acer_automute(codec
, 1);
8959 * generic initialization of ADC, input mixers and output mixers
8961 static struct hda_verb alc268_base_init_verbs
[] = {
8962 /* Unmute DAC0-1 and set vol = 0 */
8963 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8964 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8965 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8966 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8967 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8968 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8971 * Set up output mixers (0x0c - 0x0e)
8973 /* set vol=0 to output mixers */
8974 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8975 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8976 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8977 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
8979 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8980 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8982 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8983 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8984 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8985 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8986 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8987 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8988 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8989 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8991 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8992 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8993 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8994 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8995 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8996 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8997 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8998 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9000 /* FIXME: use matrix-type input source selection */
9001 /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */
9002 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9004 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9005 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9006 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9007 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9009 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9010 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9011 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9012 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9017 * generic initialization of ADC, input mixers and output mixers
9019 static struct hda_verb alc268_volume_init_verbs
[] = {
9020 /* set output DAC */
9021 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9022 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9023 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9024 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9026 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9027 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9028 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9029 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9030 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9032 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9033 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9034 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9035 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9036 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9038 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9039 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9040 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9041 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9043 /* set PCBEEP vol = 0 */
9044 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, (0xb000 | (0x00 << 8))},
9049 #define alc268_mux_enum_info alc_mux_enum_info
9050 #define alc268_mux_enum_get alc_mux_enum_get
9052 static int alc268_mux_enum_put(struct snd_kcontrol
*kcontrol
,
9053 struct snd_ctl_elem_value
*ucontrol
)
9055 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9056 struct alc_spec
*spec
= codec
->spec
;
9057 const struct hda_input_mux
*imux
= spec
->input_mux
;
9058 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
9059 static hda_nid_t capture_mixers
[3] = { 0x23, 0x24 };
9060 hda_nid_t nid
= capture_mixers
[adc_idx
];
9061 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
9062 unsigned int i
, idx
;
9064 idx
= ucontrol
->value
.enumerated
.item
[0];
9065 if (idx
>= imux
->num_items
)
9066 idx
= imux
->num_items
- 1;
9067 if (*cur_val
== idx
)
9069 for (i
= 0; i
< imux
->num_items
; i
++) {
9070 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
9071 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
9072 imux
->items
[i
].index
,
9074 snd_hda_codec_write_cache(codec
, nid
, 0,
9075 AC_VERB_SET_CONNECT_SEL
,
9082 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
9083 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
9084 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
9086 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9087 /* The multiple "Capture Source" controls confuse alsamixer
9088 * So call somewhat different..
9089 * FIXME: the controls appear in the "playback" view!
9091 /* .name = "Capture Source", */
9092 .name
= "Input Source",
9094 .info
= alc268_mux_enum_info
,
9095 .get
= alc268_mux_enum_get
,
9096 .put
= alc268_mux_enum_put
,
9101 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
9102 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
9103 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
9104 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
9105 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
9107 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9108 /* The multiple "Capture Source" controls confuse alsamixer
9109 * So call somewhat different..
9110 * FIXME: the controls appear in the "playback" view!
9112 /* .name = "Capture Source", */
9113 .name
= "Input Source",
9115 .info
= alc268_mux_enum_info
,
9116 .get
= alc268_mux_enum_get
,
9117 .put
= alc268_mux_enum_put
,
9122 static struct hda_input_mux alc268_capture_source
= {
9126 { "Front Mic", 0x1 },
9132 /* create input playback/capture controls for the given pin */
9133 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
9134 const char *ctlname
, int idx
)
9139 sprintf(name
, "%s Playback Volume", ctlname
);
9141 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
9142 HDA_COMPOSE_AMP_VAL(0x02, 3, idx
,
9146 } else if (nid
== 0x15) {
9147 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
9148 HDA_COMPOSE_AMP_VAL(0x03, 3, idx
,
9154 sprintf(name
, "%s Playback Switch", ctlname
);
9155 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
9156 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
9162 /* add playback controls from the parsed DAC table */
9163 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
9164 const struct auto_pin_cfg
*cfg
)
9169 spec
->multiout
.num_dacs
= 2; /* only use one dac */
9170 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
9171 spec
->multiout
.dac_nids
[0] = 2;
9172 spec
->multiout
.dac_nids
[1] = 3;
9174 nid
= cfg
->line_out_pins
[0];
9176 alc268_new_analog_output(spec
, nid
, "Front", 0);
9178 nid
= cfg
->speaker_pins
[0];
9180 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9181 "Speaker Playback Volume",
9182 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
9186 nid
= cfg
->hp_pins
[0];
9188 alc268_new_analog_output(spec
, nid
, "Headphone", 0);
9190 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
9192 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9193 "Mono Playback Switch",
9194 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_INPUT
));
9201 /* create playback/capture controls for input pins */
9202 static int alc268_auto_create_analog_input_ctls(struct alc_spec
*spec
,
9203 const struct auto_pin_cfg
*cfg
)
9205 struct hda_input_mux
*imux
= &spec
->private_imux
;
9208 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
9209 switch(cfg
->input_pins
[i
]) {
9211 idx1
= 0; /* Mic 1 */
9214 idx1
= 1; /* Mic 2 */
9217 idx1
= 2; /* Line In */
9225 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
9226 imux
->items
[imux
->num_items
].index
= idx1
;
9232 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
9234 struct alc_spec
*spec
= codec
->spec
;
9235 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
9236 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
9237 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
9238 unsigned int dac_vol1
, dac_vol2
;
9241 snd_hda_codec_write(codec
, speaker_nid
, 0,
9242 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
9243 snd_hda_codec_write(codec
, 0x0f, 0,
9244 AC_VERB_SET_AMP_GAIN_MUTE
,
9246 snd_hda_codec_write(codec
, 0x10, 0,
9247 AC_VERB_SET_AMP_GAIN_MUTE
,
9250 snd_hda_codec_write(codec
, 0x0f, 0,
9251 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
9252 snd_hda_codec_write(codec
, 0x10, 0,
9253 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
9256 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
9257 if (line_nid
== 0x14)
9258 dac_vol2
= AMP_OUT_ZERO
;
9259 else if (line_nid
== 0x15)
9260 dac_vol1
= AMP_OUT_ZERO
;
9262 dac_vol2
= AMP_OUT_ZERO
;
9263 else if (hp_nid
== 0x15)
9264 dac_vol1
= AMP_OUT_ZERO
;
9265 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
9266 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
9267 spec
->autocfg
.line_out_pins
[2] != 0x16)
9268 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
9270 snd_hda_codec_write(codec
, 0x02, 0,
9271 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
9272 snd_hda_codec_write(codec
, 0x03, 0,
9273 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
9276 /* pcm configuration: identiacal with ALC880 */
9277 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
9278 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
9279 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
9282 * BIOS auto configuration
9284 static int alc268_parse_auto_config(struct hda_codec
*codec
)
9286 struct alc_spec
*spec
= codec
->spec
;
9288 static hda_nid_t alc268_ignore
[] = { 0 };
9290 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
9294 if (!spec
->autocfg
.line_outs
)
9295 return 0; /* can't find valid BIOS pin config */
9297 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
9300 err
= alc268_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
9304 spec
->multiout
.max_channels
= 2;
9306 /* digital only support output */
9307 if (spec
->autocfg
.dig_out_pin
)
9308 spec
->multiout
.dig_out_nid
= ALC268_DIGOUT_NID
;
9310 if (spec
->kctl_alloc
)
9311 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
9313 spec
->init_verbs
[spec
->num_init_verbs
++] = alc268_volume_init_verbs
;
9314 spec
->num_mux_defs
= 1;
9315 spec
->input_mux
= &spec
->private_imux
;
9317 err
= alc_auto_add_mic_boost(codec
);
9324 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
9325 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
9326 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
9328 /* init callback for auto-configuration model -- overriding the default init */
9329 static void alc268_auto_init(struct hda_codec
*codec
)
9331 alc268_auto_init_multi_out(codec
);
9332 alc268_auto_init_hp_out(codec
);
9333 alc268_auto_init_mono_speaker_out(codec
);
9334 alc268_auto_init_analog_input(codec
);
9338 * configuration and preset
9340 static const char *alc268_models
[ALC268_MODEL_LAST
] = {
9341 [ALC268_3ST
] = "3stack",
9342 [ALC268_TOSHIBA
] = "toshiba",
9343 [ALC268_ACER
] = "acer",
9344 [ALC268_AUTO
] = "auto",
9347 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
9348 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
9349 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA
),
9350 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA
),
9351 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA
),
9352 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
9353 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
9354 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
9358 static struct alc_config_preset alc268_presets
[] = {
9360 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
},
9361 .init_verbs
= { alc268_base_init_verbs
},
9362 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
9363 .dac_nids
= alc268_dac_nids
,
9364 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
9365 .adc_nids
= alc268_adc_nids_alt
,
9367 .dig_out_nid
= ALC268_DIGOUT_NID
,
9368 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
9369 .channel_mode
= alc268_modes
,
9370 .input_mux
= &alc268_capture_source
,
9372 [ALC268_TOSHIBA
] = {
9373 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
},
9374 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
9375 alc268_toshiba_verbs
},
9376 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
9377 .dac_nids
= alc268_dac_nids
,
9378 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
9379 .adc_nids
= alc268_adc_nids_alt
,
9381 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
9382 .channel_mode
= alc268_modes
,
9383 .input_mux
= &alc268_capture_source
,
9384 .unsol_event
= alc268_toshiba_unsol_event
,
9385 .init_hook
= alc268_toshiba_automute
,
9388 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
},
9389 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
9390 alc268_acer_verbs
},
9391 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
9392 .dac_nids
= alc268_dac_nids
,
9393 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
9394 .adc_nids
= alc268_adc_nids_alt
,
9396 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
9397 .channel_mode
= alc268_modes
,
9398 .input_mux
= &alc268_capture_source
,
9399 .unsol_event
= alc268_acer_unsol_event
,
9400 .init_hook
= alc268_acer_init_hook
,
9404 static int patch_alc268(struct hda_codec
*codec
)
9406 struct alc_spec
*spec
;
9410 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
9416 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
9420 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
9421 printk(KERN_INFO
"hda_codec: Unknown model for ALC268, "
9422 "trying auto-probe from BIOS...\n");
9423 board_config
= ALC268_AUTO
;
9426 if (board_config
== ALC268_AUTO
) {
9427 /* automatic parse from the BIOS config */
9428 err
= alc268_parse_auto_config(codec
);
9434 "hda_codec: Cannot set up configuration "
9435 "from BIOS. Using base mode...\n");
9436 board_config
= ALC268_3ST
;
9440 if (board_config
!= ALC268_AUTO
)
9441 setup_preset(spec
, &alc268_presets
[board_config
]);
9443 spec
->stream_name_analog
= "ALC268 Analog";
9444 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
9445 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
9447 spec
->stream_name_digital
= "ALC268 Digital";
9448 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
9450 if (board_config
== ALC268_AUTO
) {
9451 if (!spec
->adc_nids
&& spec
->input_mux
) {
9452 /* check whether NID 0x07 is valid */
9453 unsigned int wcap
= get_wcaps(codec
, 0x07);
9456 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
9457 if (wcap
!= AC_WID_AUD_IN
) {
9458 spec
->adc_nids
= alc268_adc_nids_alt
;
9459 spec
->num_adc_nids
=
9460 ARRAY_SIZE(alc268_adc_nids_alt
);
9461 spec
->mixers
[spec
->num_mixers
] =
9462 alc268_capture_alt_mixer
;
9465 spec
->adc_nids
= alc268_adc_nids
;
9466 spec
->num_adc_nids
=
9467 ARRAY_SIZE(alc268_adc_nids
);
9468 spec
->mixers
[spec
->num_mixers
] =
9469 alc268_capture_mixer
;
9474 codec
->patch_ops
= alc_patch_ops
;
9475 if (board_config
== ALC268_AUTO
)
9476 spec
->init_hook
= alc268_auto_init
;
9482 * ALC861 channel source setting (2/6 channel selection for 3-stack)
9486 * set the path ways for 2 channel output
9487 * need to set the codec line out and mic 1 pin widgets to inputs
9489 static struct hda_verb alc861_threestack_ch2_init
[] = {
9490 /* set pin widget 1Ah (line in) for input */
9491 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9492 /* set pin widget 18h (mic1/2) for input, for mic also enable
9495 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9497 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
9499 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
9500 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
9506 * need to set the codec line out and mic 1 pin widgets to outputs
9508 static struct hda_verb alc861_threestack_ch6_init
[] = {
9509 /* set pin widget 1Ah (line in) for output (Back Surround)*/
9510 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9511 /* set pin widget 18h (mic1) for output (CLFE)*/
9512 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9514 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9515 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9517 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
9519 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
9520 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
9525 static struct hda_channel_mode alc861_threestack_modes
[2] = {
9526 { 2, alc861_threestack_ch2_init
},
9527 { 6, alc861_threestack_ch6_init
},
9529 /* Set mic1 as input and unmute the mixer */
9530 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
9531 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9532 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
9535 /* Set mic1 as output and mute mixer */
9536 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
9537 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9538 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
9542 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
9543 { 2, alc861_uniwill_m31_ch2_init
},
9544 { 4, alc861_uniwill_m31_ch4_init
},
9547 /* Set mic1 and line-in as input and unmute the mixer */
9548 static struct hda_verb alc861_asus_ch2_init
[] = {
9549 /* set pin widget 1Ah (line in) for input */
9550 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9551 /* set pin widget 18h (mic1/2) for input, for mic also enable
9554 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9556 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
9558 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
9559 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
9563 /* Set mic1 nad line-in as output and mute mixer */
9564 static struct hda_verb alc861_asus_ch6_init
[] = {
9565 /* set pin widget 1Ah (line in) for output (Back Surround)*/
9566 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9567 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
9568 /* set pin widget 18h (mic1) for output (CLFE)*/
9569 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9570 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
9571 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9572 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9574 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
9576 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
9577 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
9582 static struct hda_channel_mode alc861_asus_modes
[2] = {
9583 { 2, alc861_asus_ch2_init
},
9584 { 6, alc861_asus_ch6_init
},
9589 static struct snd_kcontrol_new alc861_base_mixer
[] = {
9590 /* output mixer control */
9591 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
9592 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
9593 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
9594 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
9595 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
9597 /*Input mixer control */
9598 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
9599 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
9600 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
9601 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
9602 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
9603 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
9604 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
9605 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
9606 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
9607 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
9609 /* Capture mixer control */
9610 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
9611 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
9613 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9614 .name
= "Capture Source",
9616 .info
= alc_mux_enum_info
,
9617 .get
= alc_mux_enum_get
,
9618 .put
= alc_mux_enum_put
,
9623 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
9624 /* output mixer control */
9625 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
9626 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
9627 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
9628 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
9629 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
9631 /* Input mixer control */
9632 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
9633 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
9634 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
9635 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
9636 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
9637 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
9638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
9639 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
9640 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
9641 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
9643 /* Capture mixer control */
9644 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
9645 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
9647 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9648 .name
= "Capture Source",
9650 .info
= alc_mux_enum_info
,
9651 .get
= alc_mux_enum_get
,
9652 .put
= alc_mux_enum_put
,
9655 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9656 .name
= "Channel Mode",
9657 .info
= alc_ch_mode_info
,
9658 .get
= alc_ch_mode_get
,
9659 .put
= alc_ch_mode_put
,
9660 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
9665 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
9666 /* output mixer control */
9667 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
9668 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
9669 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
9671 /*Capture mixer control */
9672 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
9673 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
9675 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9676 .name
= "Capture Source",
9678 .info
= alc_mux_enum_info
,
9679 .get
= alc_mux_enum_get
,
9680 .put
= alc_mux_enum_put
,
9686 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
9687 /* output mixer control */
9688 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
9689 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
9690 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
9691 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
9692 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
9694 /* Input mixer control */
9695 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
9696 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
9697 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
9698 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
9699 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
9700 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
9701 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
9702 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
9703 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
9704 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
9706 /* Capture mixer control */
9707 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
9708 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
9710 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9711 .name
= "Capture Source",
9713 .info
= alc_mux_enum_info
,
9714 .get
= alc_mux_enum_get
,
9715 .put
= alc_mux_enum_put
,
9718 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9719 .name
= "Channel Mode",
9720 .info
= alc_ch_mode_info
,
9721 .get
= alc_ch_mode_get
,
9722 .put
= alc_ch_mode_put
,
9723 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
9728 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
9729 /* output mixer control */
9730 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
9731 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
9732 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
9733 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
9734 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
9736 /* Input mixer control */
9737 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
9738 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9739 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
9740 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
9741 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
9742 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
9743 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
9744 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
9745 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
9746 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
9748 /* Capture mixer control */
9749 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
9750 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
9752 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9753 .name
= "Capture Source",
9755 .info
= alc_mux_enum_info
,
9756 .get
= alc_mux_enum_get
,
9757 .put
= alc_mux_enum_put
,
9760 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9761 .name
= "Channel Mode",
9762 .info
= alc_ch_mode_info
,
9763 .get
= alc_ch_mode_get
,
9764 .put
= alc_ch_mode_put
,
9765 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
9770 /* additional mixer */
9771 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
9772 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
9773 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
9774 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT
),
9775 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT
),
9780 * generic initialization of ADC, input mixers and output mixers
9782 static struct hda_verb alc861_base_init_verbs
[] = {
9784 * Unmute ADC0 and set the default input to mic-in
9786 /* port-A for surround (rear panel) */
9787 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9788 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9789 /* port-B for mic-in (rear panel) with vref */
9790 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9791 /* port-C for line-in (rear panel) */
9792 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9793 /* port-D for Front */
9794 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9795 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9796 /* port-E for HP out (front panel) */
9797 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
9798 /* route front PCM to HP */
9799 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9800 /* port-F for mic-in (front panel) with vref */
9801 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9802 /* port-G for CLFE (rear panel) */
9803 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9804 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9805 /* port-H for side (rear panel) */
9806 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9807 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9809 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9810 /* route front mic to ADC1*/
9811 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9812 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9814 /* Unmute DAC0~3 & spdif out*/
9815 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9816 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9817 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9818 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9819 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9821 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9822 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9823 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9824 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9825 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9827 /* Unmute Stereo Mixer 15 */
9828 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9829 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9830 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9831 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
9833 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9834 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9835 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9836 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9837 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9838 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9839 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9840 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9841 /* hp used DAC 3 (Front) */
9842 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
9843 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9848 static struct hda_verb alc861_threestack_init_verbs
[] = {
9850 * Unmute ADC0 and set the default input to mic-in
9852 /* port-A for surround (rear panel) */
9853 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
9854 /* port-B for mic-in (rear panel) with vref */
9855 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9856 /* port-C for line-in (rear panel) */
9857 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9858 /* port-D for Front */
9859 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9860 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9861 /* port-E for HP out (front panel) */
9862 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
9863 /* route front PCM to HP */
9864 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9865 /* port-F for mic-in (front panel) with vref */
9866 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9867 /* port-G for CLFE (rear panel) */
9868 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
9869 /* port-H for side (rear panel) */
9870 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
9872 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9873 /* route front mic to ADC1*/
9874 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9875 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9876 /* Unmute DAC0~3 & spdif out*/
9877 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9878 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9879 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9880 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9881 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9883 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9884 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9885 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9886 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9887 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9889 /* Unmute Stereo Mixer 15 */
9890 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9891 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9892 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9893 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
9895 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9896 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9897 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9898 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9899 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9900 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9901 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9902 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9903 /* hp used DAC 3 (Front) */
9904 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
9905 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9909 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
9911 * Unmute ADC0 and set the default input to mic-in
9913 /* port-A for surround (rear panel) */
9914 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
9915 /* port-B for mic-in (rear panel) with vref */
9916 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9917 /* port-C for line-in (rear panel) */
9918 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9919 /* port-D for Front */
9920 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9921 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9922 /* port-E for HP out (front panel) */
9923 /* this has to be set to VREF80 */
9924 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9925 /* route front PCM to HP */
9926 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9927 /* port-F for mic-in (front panel) with vref */
9928 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9929 /* port-G for CLFE (rear panel) */
9930 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
9931 /* port-H for side (rear panel) */
9932 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
9934 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9935 /* route front mic to ADC1*/
9936 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9937 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9938 /* Unmute DAC0~3 & spdif out*/
9939 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9940 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9941 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9942 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9943 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9945 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9946 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9947 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9948 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9949 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9951 /* Unmute Stereo Mixer 15 */
9952 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9953 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9954 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9955 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
9957 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9958 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9959 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9960 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9961 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9962 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9963 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9964 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9965 /* hp used DAC 3 (Front) */
9966 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
9967 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9971 static struct hda_verb alc861_asus_init_verbs
[] = {
9973 * Unmute ADC0 and set the default input to mic-in
9975 /* port-A for surround (rear panel)
9976 * according to codec#0 this is the HP jack
9978 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
9979 /* route front PCM to HP */
9980 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
9981 /* port-B for mic-in (rear panel) with vref */
9982 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9983 /* port-C for line-in (rear panel) */
9984 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9985 /* port-D for Front */
9986 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9987 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9988 /* port-E for HP out (front panel) */
9989 /* this has to be set to VREF80 */
9990 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9991 /* route front PCM to HP */
9992 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9993 /* port-F for mic-in (front panel) with vref */
9994 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9995 /* port-G for CLFE (rear panel) */
9996 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9997 /* port-H for side (rear panel) */
9998 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
10000 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
10001 /* route front mic to ADC1*/
10002 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
10003 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10004 /* Unmute DAC0~3 & spdif out*/
10005 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10006 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10007 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10008 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10009 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10010 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10011 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10012 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10013 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10014 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10016 /* Unmute Stereo Mixer 15 */
10017 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10018 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10019 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
10020 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
10022 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10023 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10024 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10025 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10026 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10027 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10028 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10029 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10030 /* hp used DAC 3 (Front) */
10031 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
10032 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
10036 /* additional init verbs for ASUS laptops */
10037 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
10038 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
10039 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
10044 * generic initialization of ADC, input mixers and output mixers
10046 static struct hda_verb alc861_auto_init_verbs
[] = {
10048 * Unmute ADC0 and set the default input to mic-in
10050 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
10051 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10053 /* Unmute DAC0~3 & spdif out*/
10054 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10055 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10056 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10057 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10058 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10060 /* Unmute Mixer 14 (mic) 1c (Line in)*/
10061 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10062 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10063 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10064 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10066 /* Unmute Stereo Mixer 15 */
10067 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10069 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
10070 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
10072 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10073 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10074 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10075 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10076 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10077 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10078 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10079 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10081 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10082 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10083 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
10084 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
10085 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10086 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10087 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
10088 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
10090 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
10095 static struct hda_verb alc861_toshiba_init_verbs
[] = {
10096 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10101 /* toggle speaker-output according to the hp-jack state */
10102 static void alc861_toshiba_automute(struct hda_codec
*codec
)
10104 unsigned int present
;
10106 present
= snd_hda_codec_read(codec
, 0x0f, 0,
10107 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
10108 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
10109 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
10110 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
10111 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
10114 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
10117 if ((res
>> 26) == ALC880_HP_EVENT
)
10118 alc861_toshiba_automute(codec
);
10121 /* pcm configuration: identiacal with ALC880 */
10122 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
10123 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
10124 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
10125 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
10128 #define ALC861_DIGOUT_NID 0x07
10130 static struct hda_channel_mode alc861_8ch_modes
[1] = {
10134 static hda_nid_t alc861_dac_nids
[4] = {
10135 /* front, surround, clfe, side */
10136 0x03, 0x06, 0x05, 0x04
10139 static hda_nid_t alc660_dac_nids
[3] = {
10140 /* front, clfe, surround */
10144 static hda_nid_t alc861_adc_nids
[1] = {
10149 static struct hda_input_mux alc861_capture_source
= {
10153 { "Front Mic", 0x3 },
10160 /* fill in the dac_nids table from the parsed pin configuration */
10161 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
,
10162 const struct auto_pin_cfg
*cfg
)
10167 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
10168 for (i
= 0; i
< cfg
->line_outs
; i
++) {
10169 nid
= cfg
->line_out_pins
[i
];
10171 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
10173 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
10176 spec
->multiout
.num_dacs
= cfg
->line_outs
;
10180 /* add playback controls from the parsed DAC table */
10181 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
10182 const struct auto_pin_cfg
*cfg
)
10185 static const char *chname
[4] = {
10186 "Front", "Surround", NULL
/*CLFE*/, "Side"
10191 for (i
= 0; i
< cfg
->line_outs
; i
++) {
10192 nid
= spec
->multiout
.dac_nids
[i
];
10197 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
10198 "Center Playback Switch",
10199 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
10203 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
10204 "LFE Playback Switch",
10205 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
10210 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1;
10212 if (nid
== alc861_dac_nids
[idx
])
10214 sprintf(name
, "%s Playback Switch", chname
[idx
]);
10215 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
10216 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
10225 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
10233 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
10235 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10236 "Headphone Playback Switch",
10237 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
10240 spec
->multiout
.hp_nid
= nid
;
10245 /* create playback/capture controls for input pins */
10246 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
,
10247 const struct auto_pin_cfg
*cfg
)
10249 struct hda_input_mux
*imux
= &spec
->private_imux
;
10250 int i
, err
, idx
, idx1
;
10252 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
10253 switch (cfg
->input_pins
[i
]) {
10256 idx
= 2; /* Line In */
10260 idx
= 2; /* Line In */
10264 idx
= 1; /* Mic In */
10268 idx
= 1; /* Mic In */
10278 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
10279 auto_pin_cfg_labels
[i
], idx
, 0x15);
10283 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
10284 imux
->items
[imux
->num_items
].index
= idx1
;
10290 static struct snd_kcontrol_new alc861_capture_mixer
[] = {
10291 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
10292 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
10295 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10296 /* The multiple "Capture Source" controls confuse alsamixer
10297 * So call somewhat different..
10298 *FIXME: the controls appear in the "playback" view!
10300 /* .name = "Capture Source", */
10301 .name
= "Input Source",
10303 .info
= alc_mux_enum_info
,
10304 .get
= alc_mux_enum_get
,
10305 .put
= alc_mux_enum_put
,
10310 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
10312 int pin_type
, int dac_idx
)
10314 /* set as output */
10316 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
10318 snd_hda_codec_write(codec
, dac_idx
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
10323 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
10325 struct alc_spec
*spec
= codec
->spec
;
10328 alc_subsystem_id(codec
, 0x0e, 0x0f, 0x0b);
10329 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
10330 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
10331 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
10333 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
10334 spec
->multiout
.dac_nids
[i
]);
10338 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
10340 struct alc_spec
*spec
= codec
->spec
;
10343 pin
= spec
->autocfg
.hp_pins
[0];
10344 if (pin
) /* connect to front */
10345 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
10346 spec
->multiout
.dac_nids
[0]);
10349 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
10351 struct alc_spec
*spec
= codec
->spec
;
10354 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
10355 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
10356 if (nid
>= 0x0c && nid
<= 0x11) {
10357 snd_hda_codec_write(codec
, nid
, 0,
10358 AC_VERB_SET_PIN_WIDGET_CONTROL
,
10359 i
<= AUTO_PIN_FRONT_MIC
?
10360 PIN_VREF80
: PIN_IN
);
10365 /* parse the BIOS configuration and set up the alc_spec */
10366 /* return 1 if successful, 0 if the proper config is not found,
10367 * or a negative error code
10369 static int alc861_parse_auto_config(struct hda_codec
*codec
)
10371 struct alc_spec
*spec
= codec
->spec
;
10373 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
10375 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10379 if (!spec
->autocfg
.line_outs
)
10380 return 0; /* can't find valid BIOS pin config */
10382 err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
);
10385 err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
10388 err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pins
[0]);
10391 err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
10395 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
10397 if (spec
->autocfg
.dig_out_pin
)
10398 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
10400 if (spec
->kctl_alloc
)
10401 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
10403 spec
->init_verbs
[spec
->num_init_verbs
++] = alc861_auto_init_verbs
;
10405 spec
->num_mux_defs
= 1;
10406 spec
->input_mux
= &spec
->private_imux
;
10408 spec
->adc_nids
= alc861_adc_nids
;
10409 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
10410 spec
->mixers
[spec
->num_mixers
] = alc861_capture_mixer
;
10411 spec
->num_mixers
++;
10416 /* additional initialization for auto-configuration model */
10417 static void alc861_auto_init(struct hda_codec
*codec
)
10419 alc861_auto_init_multi_out(codec
);
10420 alc861_auto_init_hp_out(codec
);
10421 alc861_auto_init_analog_input(codec
);
10424 #ifdef CONFIG_SND_HDA_POWER_SAVE
10425 static struct hda_amp_list alc861_loopbacks
[] = {
10426 { 0x15, HDA_INPUT
, 0 },
10427 { 0x15, HDA_INPUT
, 1 },
10428 { 0x15, HDA_INPUT
, 2 },
10429 { 0x15, HDA_INPUT
, 3 },
10436 * configuration and preset
10438 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
10439 [ALC861_3ST
] = "3stack",
10440 [ALC660_3ST
] = "3stack-660",
10441 [ALC861_3ST_DIG
] = "3stack-dig",
10442 [ALC861_6ST_DIG
] = "6stack-dig",
10443 [ALC861_UNIWILL_M31
] = "uniwill-m31",
10444 [ALC861_TOSHIBA
] = "toshiba",
10445 [ALC861_ASUS
] = "asus",
10446 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
10447 [ALC861_AUTO
] = "auto",
10450 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
10451 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
10452 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
10453 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
10454 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
10455 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
10456 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
10457 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
10458 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
10459 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
10460 * Any other models that need this preset?
10462 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
10463 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
10464 SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31
),
10465 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
10466 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
10467 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
10468 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
10469 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
10473 static struct alc_config_preset alc861_presets
[] = {
10475 .mixers
= { alc861_3ST_mixer
},
10476 .init_verbs
= { alc861_threestack_init_verbs
},
10477 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10478 .dac_nids
= alc861_dac_nids
,
10479 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
10480 .channel_mode
= alc861_threestack_modes
,
10482 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10483 .adc_nids
= alc861_adc_nids
,
10484 .input_mux
= &alc861_capture_source
,
10486 [ALC861_3ST_DIG
] = {
10487 .mixers
= { alc861_base_mixer
},
10488 .init_verbs
= { alc861_threestack_init_verbs
},
10489 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10490 .dac_nids
= alc861_dac_nids
,
10491 .dig_out_nid
= ALC861_DIGOUT_NID
,
10492 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
10493 .channel_mode
= alc861_threestack_modes
,
10495 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10496 .adc_nids
= alc861_adc_nids
,
10497 .input_mux
= &alc861_capture_source
,
10499 [ALC861_6ST_DIG
] = {
10500 .mixers
= { alc861_base_mixer
},
10501 .init_verbs
= { alc861_base_init_verbs
},
10502 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10503 .dac_nids
= alc861_dac_nids
,
10504 .dig_out_nid
= ALC861_DIGOUT_NID
,
10505 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
10506 .channel_mode
= alc861_8ch_modes
,
10507 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10508 .adc_nids
= alc861_adc_nids
,
10509 .input_mux
= &alc861_capture_source
,
10512 .mixers
= { alc861_3ST_mixer
},
10513 .init_verbs
= { alc861_threestack_init_verbs
},
10514 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
10515 .dac_nids
= alc660_dac_nids
,
10516 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
10517 .channel_mode
= alc861_threestack_modes
,
10519 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10520 .adc_nids
= alc861_adc_nids
,
10521 .input_mux
= &alc861_capture_source
,
10523 [ALC861_UNIWILL_M31
] = {
10524 .mixers
= { alc861_uniwill_m31_mixer
},
10525 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
10526 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10527 .dac_nids
= alc861_dac_nids
,
10528 .dig_out_nid
= ALC861_DIGOUT_NID
,
10529 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
10530 .channel_mode
= alc861_uniwill_m31_modes
,
10532 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10533 .adc_nids
= alc861_adc_nids
,
10534 .input_mux
= &alc861_capture_source
,
10536 [ALC861_TOSHIBA
] = {
10537 .mixers
= { alc861_toshiba_mixer
},
10538 .init_verbs
= { alc861_base_init_verbs
,
10539 alc861_toshiba_init_verbs
},
10540 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10541 .dac_nids
= alc861_dac_nids
,
10542 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10543 .channel_mode
= alc883_3ST_2ch_modes
,
10544 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10545 .adc_nids
= alc861_adc_nids
,
10546 .input_mux
= &alc861_capture_source
,
10547 .unsol_event
= alc861_toshiba_unsol_event
,
10548 .init_hook
= alc861_toshiba_automute
,
10551 .mixers
= { alc861_asus_mixer
},
10552 .init_verbs
= { alc861_asus_init_verbs
},
10553 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10554 .dac_nids
= alc861_dac_nids
,
10555 .dig_out_nid
= ALC861_DIGOUT_NID
,
10556 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
10557 .channel_mode
= alc861_asus_modes
,
10560 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10561 .adc_nids
= alc861_adc_nids
,
10562 .input_mux
= &alc861_capture_source
,
10564 [ALC861_ASUS_LAPTOP
] = {
10565 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
10566 .init_verbs
= { alc861_asus_init_verbs
,
10567 alc861_asus_laptop_init_verbs
},
10568 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10569 .dac_nids
= alc861_dac_nids
,
10570 .dig_out_nid
= ALC861_DIGOUT_NID
,
10571 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10572 .channel_mode
= alc883_3ST_2ch_modes
,
10574 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10575 .adc_nids
= alc861_adc_nids
,
10576 .input_mux
= &alc861_capture_source
,
10581 static int patch_alc861(struct hda_codec
*codec
)
10583 struct alc_spec
*spec
;
10587 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
10591 codec
->spec
= spec
;
10593 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
10597 if (board_config
< 0) {
10598 printk(KERN_INFO
"hda_codec: Unknown model for ALC861, "
10599 "trying auto-probe from BIOS...\n");
10600 board_config
= ALC861_AUTO
;
10603 if (board_config
== ALC861_AUTO
) {
10604 /* automatic parse from the BIOS config */
10605 err
= alc861_parse_auto_config(codec
);
10611 "hda_codec: Cannot set up configuration "
10612 "from BIOS. Using base mode...\n");
10613 board_config
= ALC861_3ST_DIG
;
10617 if (board_config
!= ALC861_AUTO
)
10618 setup_preset(spec
, &alc861_presets
[board_config
]);
10620 spec
->stream_name_analog
= "ALC861 Analog";
10621 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
10622 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
10624 spec
->stream_name_digital
= "ALC861 Digital";
10625 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
10626 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
10628 codec
->patch_ops
= alc_patch_ops
;
10629 if (board_config
== ALC861_AUTO
)
10630 spec
->init_hook
= alc861_auto_init
;
10631 #ifdef CONFIG_SND_HDA_POWER_SAVE
10632 if (!spec
->loopback
.amplist
)
10633 spec
->loopback
.amplist
= alc861_loopbacks
;
10640 * ALC861-VD support
10644 * In addition, an independent DAC
10646 #define ALC861VD_DIGOUT_NID 0x06
10648 static hda_nid_t alc861vd_dac_nids
[4] = {
10649 /* front, surr, clfe, side surr */
10650 0x02, 0x03, 0x04, 0x05
10653 /* dac_nids for ALC660vd are in a different order - according to
10654 * Realtek's driver.
10655 * This should probably tesult in a different mixer for 6stack models
10656 * of ALC660vd codecs, but for now there is only 3stack mixer
10657 * - and it is the same as in 861vd.
10658 * adc_nids in ALC660vd are (is) the same as in 861vd
10660 static hda_nid_t alc660vd_dac_nids
[3] = {
10661 /* front, rear, clfe, rear_surr */
10665 static hda_nid_t alc861vd_adc_nids
[1] = {
10671 /* FIXME: should be a matrix-type input source selection */
10672 static struct hda_input_mux alc861vd_capture_source
= {
10676 { "Front Mic", 0x1 },
10682 static struct hda_input_mux alc861vd_dallas_capture_source
= {
10685 { "Front Mic", 0x0 },
10686 { "ATAPI Mic", 0x1 },
10687 { "Line In", 0x5 },
10691 static struct hda_input_mux alc861vd_hp_capture_source
= {
10694 { "Front Mic", 0x0 },
10695 { "ATAPI Mic", 0x1 },
10699 #define alc861vd_mux_enum_info alc_mux_enum_info
10700 #define alc861vd_mux_enum_get alc_mux_enum_get
10702 static int alc861vd_mux_enum_put(struct snd_kcontrol
*kcontrol
,
10703 struct snd_ctl_elem_value
*ucontrol
)
10705 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10706 struct alc_spec
*spec
= codec
->spec
;
10707 const struct hda_input_mux
*imux
= spec
->input_mux
;
10708 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
10709 static hda_nid_t capture_mixers
[1] = { 0x22 };
10710 hda_nid_t nid
= capture_mixers
[adc_idx
];
10711 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
10712 unsigned int i
, idx
;
10714 idx
= ucontrol
->value
.enumerated
.item
[0];
10715 if (idx
>= imux
->num_items
)
10716 idx
= imux
->num_items
- 1;
10717 if (*cur_val
== idx
)
10719 for (i
= 0; i
< imux
->num_items
; i
++) {
10720 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
10721 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
10722 imux
->items
[i
].index
,
10732 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
10739 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
10740 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
10741 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10742 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10743 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10750 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
10751 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10752 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10753 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10754 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10758 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
10759 { 6, alc861vd_6stack_ch6_init
},
10760 { 8, alc861vd_6stack_ch8_init
},
10763 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
10765 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10766 .name
= "Channel Mode",
10767 .info
= alc_ch_mode_info
,
10768 .get
= alc_ch_mode_get
,
10769 .put
= alc_ch_mode_put
,
10774 static struct snd_kcontrol_new alc861vd_capture_mixer
[] = {
10775 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
10776 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
10779 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10780 /* The multiple "Capture Source" controls confuse alsamixer
10781 * So call somewhat different..
10782 *FIXME: the controls appear in the "playback" view!
10784 /* .name = "Capture Source", */
10785 .name
= "Input Source",
10787 .info
= alc861vd_mux_enum_info
,
10788 .get
= alc861vd_mux_enum_get
,
10789 .put
= alc861vd_mux_enum_put
,
10794 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
10795 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
10797 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
10798 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10799 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
10801 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10802 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
10804 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
10806 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
10808 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
10809 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
10811 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
10812 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
10814 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
10816 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10818 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10820 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10821 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10822 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10824 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10825 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10827 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10828 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10830 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
10831 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
10836 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
10837 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10838 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
10840 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
10842 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10844 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10846 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10847 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10848 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10850 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10851 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10853 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10854 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10856 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
10857 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
10862 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
10863 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10864 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
10865 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10867 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
10869 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10870 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10871 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10873 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10874 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10875 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10877 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10878 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10883 /* Pin assignment: Front=0x14, HP = 0x15,
10884 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
10886 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
10887 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10888 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
10889 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10890 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
10891 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10892 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10893 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10894 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10895 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT
),
10896 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT
),
10900 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
10901 * Front Mic=0x18, ATAPI Mic = 0x19,
10903 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
10904 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10905 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
10906 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10907 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
10908 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10909 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10910 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10911 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10917 * generic initialization of ADC, input mixers and output mixers
10919 static struct hda_verb alc861vd_volume_init_verbs
[] = {
10921 * Unmute ADC0 and set the default input to mic-in
10923 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10924 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10926 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
10927 * the analog-loopback mixer widget
10929 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10930 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10936 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
10937 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10939 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
10940 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
10943 * Set up output mixers (0x02 - 0x05)
10945 /* set vol=0 to output mixers */
10946 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10947 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10948 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10949 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10951 /* set up input amps for analog loopback */
10952 /* Amp Indices: DAC = 0, mixer = 1 */
10953 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10955 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10956 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10957 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10958 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10959 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10960 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10966 * 3-stack pin configuration:
10967 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
10969 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
10971 * Set pin mode and muting
10973 /* set front pin widgets 0x14 for output */
10974 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10975 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10976 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
10978 /* Mic (rear) pin: input vref at 80% */
10979 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10980 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10981 /* Front Mic pin: input vref at 80% */
10982 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10983 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10984 /* Line In pin: input */
10985 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10986 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10987 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10988 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10989 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10990 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
10991 /* CD pin widget for input */
10992 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10998 * 6-stack pin configuration:
11000 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
11002 * Set pin mode and muting
11004 /* set front pin widgets 0x14 for output */
11005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11007 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
11009 /* Rear Pin: output 1 (0x0d) */
11010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11011 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11012 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
11013 /* CLFE Pin: output 2 (0x0e) */
11014 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11015 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11016 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
11017 /* Side Pin: output 3 (0x0f) */
11018 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11019 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11020 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
11022 /* Mic (rear) pin: input vref at 80% */
11023 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11024 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11025 /* Front Mic pin: input vref at 80% */
11026 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11027 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11028 /* Line In pin: input */
11029 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11030 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11031 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11032 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11033 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11034 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11035 /* CD pin widget for input */
11036 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11041 static struct hda_verb alc861vd_eapd_verbs
[] = {
11042 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
11046 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
11047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11048 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11049 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
11050 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11051 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11055 /* toggle speaker-output according to the hp-jack state */
11056 static void alc861vd_lenovo_hp_automute(struct hda_codec
*codec
)
11058 unsigned int present
;
11059 unsigned char bits
;
11061 present
= snd_hda_codec_read(codec
, 0x1b, 0,
11062 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11063 bits
= present
? HDA_AMP_MUTE
: 0;
11064 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11065 HDA_AMP_MUTE
, bits
);
11068 static void alc861vd_lenovo_mic_automute(struct hda_codec
*codec
)
11070 unsigned int present
;
11071 unsigned char bits
;
11073 present
= snd_hda_codec_read(codec
, 0x18, 0,
11074 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11075 bits
= present
? HDA_AMP_MUTE
: 0;
11076 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
11077 HDA_AMP_MUTE
, bits
);
11080 static void alc861vd_lenovo_automute(struct hda_codec
*codec
)
11082 alc861vd_lenovo_hp_automute(codec
);
11083 alc861vd_lenovo_mic_automute(codec
);
11086 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
11089 switch (res
>> 26) {
11090 case ALC880_HP_EVENT
:
11091 alc861vd_lenovo_hp_automute(codec
);
11093 case ALC880_MIC_EVENT
:
11094 alc861vd_lenovo_mic_automute(codec
);
11099 static struct hda_verb alc861vd_dallas_verbs
[] = {
11100 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11101 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11102 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11103 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11105 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11106 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11107 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11108 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11109 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11110 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11111 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11112 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11114 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11115 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11116 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11117 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11118 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11119 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11120 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11121 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11123 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
11124 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11125 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
11126 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11127 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11128 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11129 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11130 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11132 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11133 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11134 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11135 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11137 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11138 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11139 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11144 /* toggle speaker-output according to the hp-jack state */
11145 static void alc861vd_dallas_automute(struct hda_codec
*codec
)
11147 unsigned int present
;
11149 present
= snd_hda_codec_read(codec
, 0x15, 0,
11150 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11151 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11152 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
11155 static void alc861vd_dallas_unsol_event(struct hda_codec
*codec
, unsigned int res
)
11157 if ((res
>> 26) == ALC880_HP_EVENT
)
11158 alc861vd_dallas_automute(codec
);
11161 #ifdef CONFIG_SND_HDA_POWER_SAVE
11162 #define alc861vd_loopbacks alc880_loopbacks
11165 /* pcm configuration: identiacal with ALC880 */
11166 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
11167 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
11168 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
11169 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
11172 * configuration and preset
11174 static const char *alc861vd_models
[ALC861VD_MODEL_LAST
] = {
11175 [ALC660VD_3ST
] = "3stack-660",
11176 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
11177 [ALC861VD_3ST
] = "3stack",
11178 [ALC861VD_3ST_DIG
] = "3stack-digout",
11179 [ALC861VD_6ST_DIG
] = "6stack-digout",
11180 [ALC861VD_LENOVO
] = "lenovo",
11181 [ALC861VD_DALLAS
] = "dallas",
11182 [ALC861VD_HP
] = "hp",
11183 [ALC861VD_AUTO
] = "auto",
11186 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
11187 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
11188 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST
),
11189 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
11190 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
11191 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
11193 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
11194 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS
),
11195 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO
),
11196 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO
),
11197 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
11198 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
11199 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
11200 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
11201 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
11205 static struct alc_config_preset alc861vd_presets
[] = {
11207 .mixers
= { alc861vd_3st_mixer
},
11208 .init_verbs
= { alc861vd_volume_init_verbs
,
11209 alc861vd_3stack_init_verbs
},
11210 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
11211 .dac_nids
= alc660vd_dac_nids
,
11212 .num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
),
11213 .adc_nids
= alc861vd_adc_nids
,
11214 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11215 .channel_mode
= alc861vd_3stack_2ch_modes
,
11216 .input_mux
= &alc861vd_capture_source
,
11218 [ALC660VD_3ST_DIG
] = {
11219 .mixers
= { alc861vd_3st_mixer
},
11220 .init_verbs
= { alc861vd_volume_init_verbs
,
11221 alc861vd_3stack_init_verbs
},
11222 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
11223 .dac_nids
= alc660vd_dac_nids
,
11224 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
11225 .num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
),
11226 .adc_nids
= alc861vd_adc_nids
,
11227 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11228 .channel_mode
= alc861vd_3stack_2ch_modes
,
11229 .input_mux
= &alc861vd_capture_source
,
11232 .mixers
= { alc861vd_3st_mixer
},
11233 .init_verbs
= { alc861vd_volume_init_verbs
,
11234 alc861vd_3stack_init_verbs
},
11235 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
11236 .dac_nids
= alc861vd_dac_nids
,
11237 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11238 .channel_mode
= alc861vd_3stack_2ch_modes
,
11239 .input_mux
= &alc861vd_capture_source
,
11241 [ALC861VD_3ST_DIG
] = {
11242 .mixers
= { alc861vd_3st_mixer
},
11243 .init_verbs
= { alc861vd_volume_init_verbs
,
11244 alc861vd_3stack_init_verbs
},
11245 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
11246 .dac_nids
= alc861vd_dac_nids
,
11247 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
11248 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11249 .channel_mode
= alc861vd_3stack_2ch_modes
,
11250 .input_mux
= &alc861vd_capture_source
,
11252 [ALC861VD_6ST_DIG
] = {
11253 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
11254 .init_verbs
= { alc861vd_volume_init_verbs
,
11255 alc861vd_6stack_init_verbs
},
11256 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
11257 .dac_nids
= alc861vd_dac_nids
,
11258 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
11259 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
11260 .channel_mode
= alc861vd_6stack_modes
,
11261 .input_mux
= &alc861vd_capture_source
,
11263 [ALC861VD_LENOVO
] = {
11264 .mixers
= { alc861vd_lenovo_mixer
},
11265 .init_verbs
= { alc861vd_volume_init_verbs
,
11266 alc861vd_3stack_init_verbs
,
11267 alc861vd_eapd_verbs
,
11268 alc861vd_lenovo_unsol_verbs
},
11269 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
11270 .dac_nids
= alc660vd_dac_nids
,
11271 .num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
),
11272 .adc_nids
= alc861vd_adc_nids
,
11273 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11274 .channel_mode
= alc861vd_3stack_2ch_modes
,
11275 .input_mux
= &alc861vd_capture_source
,
11276 .unsol_event
= alc861vd_lenovo_unsol_event
,
11277 .init_hook
= alc861vd_lenovo_automute
,
11279 [ALC861VD_DALLAS
] = {
11280 .mixers
= { alc861vd_dallas_mixer
},
11281 .init_verbs
= { alc861vd_dallas_verbs
},
11282 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
11283 .dac_nids
= alc861vd_dac_nids
,
11284 .num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
),
11285 .adc_nids
= alc861vd_adc_nids
,
11286 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11287 .channel_mode
= alc861vd_3stack_2ch_modes
,
11288 .input_mux
= &alc861vd_dallas_capture_source
,
11289 .unsol_event
= alc861vd_dallas_unsol_event
,
11290 .init_hook
= alc861vd_dallas_automute
,
11293 .mixers
= { alc861vd_hp_mixer
},
11294 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
11295 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
11296 .dac_nids
= alc861vd_dac_nids
,
11297 .num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
),
11298 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
11299 .adc_nids
= alc861vd_adc_nids
,
11300 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11301 .channel_mode
= alc861vd_3stack_2ch_modes
,
11302 .input_mux
= &alc861vd_hp_capture_source
,
11303 .unsol_event
= alc861vd_dallas_unsol_event
,
11304 .init_hook
= alc861vd_dallas_automute
,
11309 * BIOS auto configuration
11311 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
11312 hda_nid_t nid
, int pin_type
, int dac_idx
)
11314 /* set as output */
11315 snd_hda_codec_write(codec
, nid
, 0,
11316 AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
11317 snd_hda_codec_write(codec
, nid
, 0,
11318 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
11321 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
11323 struct alc_spec
*spec
= codec
->spec
;
11326 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
11327 for (i
= 0; i
<= HDA_SIDE
; i
++) {
11328 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
11329 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
11331 alc861vd_auto_set_output_and_unmute(codec
, nid
,
11337 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
11339 struct alc_spec
*spec
= codec
->spec
;
11342 pin
= spec
->autocfg
.hp_pins
[0];
11343 if (pin
) /* connect to front and use dac 0 */
11344 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
11347 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
11348 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
11350 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
11352 struct alc_spec
*spec
= codec
->spec
;
11355 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
11356 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
11357 if (alc861vd_is_input_pin(nid
)) {
11358 snd_hda_codec_write(codec
, nid
, 0,
11359 AC_VERB_SET_PIN_WIDGET_CONTROL
,
11360 i
<= AUTO_PIN_FRONT_MIC
?
11361 PIN_VREF80
: PIN_IN
);
11362 if (nid
!= ALC861VD_PIN_CD_NID
)
11363 snd_hda_codec_write(codec
, nid
, 0,
11364 AC_VERB_SET_AMP_GAIN_MUTE
,
11370 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
11371 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
11373 /* add playback controls from the parsed DAC table */
11374 /* Based on ALC880 version. But ALC861VD has separate,
11375 * different NIDs for mute/unmute switch and volume control */
11376 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
11377 const struct auto_pin_cfg
*cfg
)
11380 static const char *chname
[4] = {"Front", "Surround", "CLFE", "Side"};
11381 hda_nid_t nid_v
, nid_s
;
11384 for (i
= 0; i
< cfg
->line_outs
; i
++) {
11385 if (!spec
->multiout
.dac_nids
[i
])
11387 nid_v
= alc861vd_idx_to_mixer_vol(
11389 spec
->multiout
.dac_nids
[i
]));
11390 nid_s
= alc861vd_idx_to_mixer_switch(
11392 spec
->multiout
.dac_nids
[i
]));
11396 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11397 "Center Playback Volume",
11398 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
11402 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11403 "LFE Playback Volume",
11404 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
11408 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
11409 "Center Playback Switch",
11410 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
11414 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
11415 "LFE Playback Switch",
11416 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
11421 sprintf(name
, "%s Playback Volume", chname
[i
]);
11422 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
11423 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
11427 sprintf(name
, "%s Playback Switch", chname
[i
]);
11428 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
11429 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
11438 /* add playback controls for speaker and HP outputs */
11439 /* Based on ALC880 version. But ALC861VD has separate,
11440 * different NIDs for mute/unmute switch and volume control */
11441 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
11442 hda_nid_t pin
, const char *pfx
)
11444 hda_nid_t nid_v
, nid_s
;
11451 if (alc880_is_fixed_pin(pin
)) {
11452 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
11453 /* specify the DAC as the extra output */
11454 if (!spec
->multiout
.hp_nid
)
11455 spec
->multiout
.hp_nid
= nid_v
;
11457 spec
->multiout
.extra_out_nid
[0] = nid_v
;
11458 /* control HP volume/switch on the output mixer amp */
11459 nid_v
= alc861vd_idx_to_mixer_vol(
11460 alc880_fixed_pin_idx(pin
));
11461 nid_s
= alc861vd_idx_to_mixer_switch(
11462 alc880_fixed_pin_idx(pin
));
11464 sprintf(name
, "%s Playback Volume", pfx
);
11465 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
11466 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
11469 sprintf(name
, "%s Playback Switch", pfx
);
11470 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
11471 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
11474 } else if (alc880_is_multi_pin(pin
)) {
11475 /* set manual connection */
11476 /* we have only a switch on HP-out PIN */
11477 sprintf(name
, "%s Playback Switch", pfx
);
11478 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
11479 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
11486 /* parse the BIOS configuration and set up the alc_spec
11487 * return 1 if successful, 0 if the proper config is not found,
11488 * or a negative error code
11489 * Based on ALC880 version - had to change it to override
11490 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
11491 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
11493 struct alc_spec
*spec
= codec
->spec
;
11495 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
11497 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
11501 if (!spec
->autocfg
.line_outs
)
11502 return 0; /* can't find valid BIOS pin config */
11504 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
11507 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
11510 err
= alc861vd_auto_create_extra_out(spec
,
11511 spec
->autocfg
.speaker_pins
[0],
11515 err
= alc861vd_auto_create_extra_out(spec
,
11516 spec
->autocfg
.hp_pins
[0],
11520 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
11524 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
11526 if (spec
->autocfg
.dig_out_pin
)
11527 spec
->multiout
.dig_out_nid
= ALC861VD_DIGOUT_NID
;
11529 if (spec
->kctl_alloc
)
11530 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
11532 spec
->init_verbs
[spec
->num_init_verbs
++]
11533 = alc861vd_volume_init_verbs
;
11535 spec
->num_mux_defs
= 1;
11536 spec
->input_mux
= &spec
->private_imux
;
11538 err
= alc_auto_add_mic_boost(codec
);
11545 /* additional initialization for auto-configuration model */
11546 static void alc861vd_auto_init(struct hda_codec
*codec
)
11548 alc861vd_auto_init_multi_out(codec
);
11549 alc861vd_auto_init_hp_out(codec
);
11550 alc861vd_auto_init_analog_input(codec
);
11553 static int patch_alc861vd(struct hda_codec
*codec
)
11555 struct alc_spec
*spec
;
11556 int err
, board_config
;
11558 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
11562 codec
->spec
= spec
;
11564 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
11568 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
11569 printk(KERN_INFO
"hda_codec: Unknown model for ALC660VD/"
11570 "ALC861VD, trying auto-probe from BIOS...\n");
11571 board_config
= ALC861VD_AUTO
;
11574 if (board_config
== ALC861VD_AUTO
) {
11575 /* automatic parse from the BIOS config */
11576 err
= alc861vd_parse_auto_config(codec
);
11582 "hda_codec: Cannot set up configuration "
11583 "from BIOS. Using base mode...\n");
11584 board_config
= ALC861VD_3ST
;
11588 if (board_config
!= ALC861VD_AUTO
)
11589 setup_preset(spec
, &alc861vd_presets
[board_config
]);
11591 spec
->stream_name_analog
= "ALC861VD Analog";
11592 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
11593 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
11595 spec
->stream_name_digital
= "ALC861VD Digital";
11596 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
11597 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
11599 spec
->adc_nids
= alc861vd_adc_nids
;
11600 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
11602 spec
->mixers
[spec
->num_mixers
] = alc861vd_capture_mixer
;
11603 spec
->num_mixers
++;
11605 codec
->patch_ops
= alc_patch_ops
;
11607 if (board_config
== ALC861VD_AUTO
)
11608 spec
->init_hook
= alc861vd_auto_init
;
11609 #ifdef CONFIG_SND_HDA_POWER_SAVE
11610 if (!spec
->loopback
.amplist
)
11611 spec
->loopback
.amplist
= alc861vd_loopbacks
;
11620 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11621 * configuration. Each pin widget can choose any input DACs and a mixer.
11622 * Each ADC is connected from a mixer of all inputs. This makes possible
11623 * 6-channel independent captures.
11625 * In addition, an independent DAC for the multi-playback (not used in this
11628 #define ALC662_DIGOUT_NID 0x06
11629 #define ALC662_DIGIN_NID 0x0a
11631 static hda_nid_t alc662_dac_nids
[4] = {
11632 /* front, rear, clfe, rear_surr */
11636 static hda_nid_t alc662_adc_nids
[1] = {
11641 /* FIXME: should be a matrix-type input source selection */
11643 static struct hda_input_mux alc662_capture_source
= {
11647 { "Front Mic", 0x1 },
11653 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
11661 static struct hda_input_mux alc662_eeepc_capture_source
= {
11669 #define alc662_mux_enum_info alc_mux_enum_info
11670 #define alc662_mux_enum_get alc_mux_enum_get
11672 static int alc662_mux_enum_put(struct snd_kcontrol
*kcontrol
,
11673 struct snd_ctl_elem_value
*ucontrol
)
11675 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11676 struct alc_spec
*spec
= codec
->spec
;
11677 const struct hda_input_mux
*imux
= spec
->input_mux
;
11678 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
11679 static hda_nid_t capture_mixers
[2] = { 0x23, 0x22 };
11680 hda_nid_t nid
= capture_mixers
[adc_idx
];
11681 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
11682 unsigned int i
, idx
;
11684 idx
= ucontrol
->value
.enumerated
.item
[0];
11685 if (idx
>= imux
->num_items
)
11686 idx
= imux
->num_items
- 1;
11687 if (*cur_val
== idx
)
11689 for (i
= 0; i
< imux
->num_items
; i
++) {
11690 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
11691 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
11692 imux
->items
[i
].index
,
11701 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
11708 static struct hda_verb alc662_3ST_ch2_init
[] = {
11709 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11710 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11711 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11712 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11719 static struct hda_verb alc662_3ST_ch6_init
[] = {
11720 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11721 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11722 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
11723 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11724 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11725 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
11729 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
11730 { 2, alc662_3ST_ch2_init
},
11731 { 6, alc662_3ST_ch6_init
},
11737 static struct hda_verb alc662_sixstack_ch6_init
[] = {
11738 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11739 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11740 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11747 static struct hda_verb alc662_sixstack_ch8_init
[] = {
11748 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11749 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11750 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11754 static struct hda_channel_mode alc662_5stack_modes
[2] = {
11755 { 2, alc662_sixstack_ch6_init
},
11756 { 6, alc662_sixstack_ch8_init
},
11759 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
11760 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
11763 static struct snd_kcontrol_new alc662_base_mixer
[] = {
11764 /* output mixer control */
11765 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
11766 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT
),
11767 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
11768 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11769 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
11770 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
11771 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT
),
11772 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT
),
11773 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11775 /*Input mixer control */
11776 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
11777 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
11778 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
11779 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
11780 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
11781 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
11782 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
11783 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
11785 /* Capture mixer control */
11786 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
11787 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
11789 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11790 .name
= "Capture Source",
11792 .info
= alc_mux_enum_info
,
11793 .get
= alc_mux_enum_get
,
11794 .put
= alc_mux_enum_put
,
11799 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
11800 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11801 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
11802 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11803 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11804 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11805 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11806 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11807 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11809 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11810 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11811 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
11812 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
11813 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
11814 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
11816 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11817 /* .name = "Capture Source", */
11818 .name
= "Input Source",
11820 .info
= alc662_mux_enum_info
,
11821 .get
= alc662_mux_enum_get
,
11822 .put
= alc662_mux_enum_put
,
11827 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
11828 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11829 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
11830 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
11831 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT
),
11832 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
11833 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
11834 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT
),
11835 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT
),
11836 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11837 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11838 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11839 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11840 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11841 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11842 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11843 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11844 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11845 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
11846 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
11847 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
11848 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
11850 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11851 /* .name = "Capture Source", */
11852 .name
= "Input Source",
11854 .info
= alc662_mux_enum_info
,
11855 .get
= alc662_mux_enum_get
,
11856 .put
= alc662_mux_enum_put
,
11861 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
11862 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11863 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
11864 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
11865 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT
),
11866 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11867 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11868 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11869 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11870 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11871 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
11872 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
11874 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11875 /* .name = "Capture Source", */
11876 .name
= "Input Source",
11878 .info
= alc662_mux_enum_info
,
11879 .get
= alc662_mux_enum_get
,
11880 .put
= alc662_mux_enum_put
,
11885 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
11886 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11888 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11889 HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11891 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT
),
11892 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11893 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11895 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
11896 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11897 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11901 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
11903 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11904 .name
= "Channel Mode",
11905 .info
= alc_ch_mode_info
,
11906 .get
= alc_ch_mode_get
,
11907 .put
= alc_ch_mode_put
,
11912 static struct hda_verb alc662_init_verbs
[] = {
11913 /* ADC: mute amp left and right */
11914 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11915 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11916 /* Front mixer: unmute input/output amp left and right (volume = 0) */
11918 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11919 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11920 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11921 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11922 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11924 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11925 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11926 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11927 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11928 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11929 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11931 /* Front Pin: output 0 (0x0c) */
11932 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11933 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11935 /* Rear Pin: output 1 (0x0d) */
11936 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11937 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11939 /* CLFE Pin: output 2 (0x0e) */
11940 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11941 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11943 /* Mic (rear) pin: input vref at 80% */
11944 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11945 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11946 /* Front Mic pin: input vref at 80% */
11947 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11948 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11949 /* Line In pin: input */
11950 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11951 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11952 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11953 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11954 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11955 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11956 /* CD pin widget for input */
11957 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11959 /* FIXME: use matrix-type input source selection */
11960 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11962 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11963 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11964 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11965 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
11967 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11968 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11969 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11970 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
11974 static struct hda_verb alc662_sue_init_verbs
[] = {
11975 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
11976 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
11980 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
11981 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11982 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11987 * generic initialization of ADC, input mixers and output mixers
11989 static struct hda_verb alc662_auto_init_verbs
[] = {
11991 * Unmute ADC and set the default input to mic-in
11993 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11994 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11996 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11998 * Note: PASD motherboards uses the Line In 2 as the input for front
11999 * panel mic (mic 2)
12001 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12003 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12004 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12005 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12006 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12009 * Set up output mixers (0x0c - 0x0f)
12011 /* set vol=0 to output mixers */
12012 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12013 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12014 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12016 /* set up input amps for analog loopback */
12017 /* Amp Indices: DAC = 0, mixer = 1 */
12018 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12019 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12020 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12021 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12022 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12023 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12026 /* FIXME: use matrix-type input source selection */
12027 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12029 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12030 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12034 /* capture mixer elements */
12035 static struct snd_kcontrol_new alc662_capture_mixer
[] = {
12036 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
12037 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
12039 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12040 /* The multiple "Capture Source" controls confuse alsamixer
12041 * So call somewhat different..
12042 * FIXME: the controls appear in the "playback" view!
12044 /* .name = "Capture Source", */
12045 .name
= "Input Source",
12047 .info
= alc882_mux_enum_info
,
12048 .get
= alc882_mux_enum_get
,
12049 .put
= alc882_mux_enum_put
,
12054 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
12056 unsigned int present
;
12057 unsigned char bits
;
12059 present
= snd_hda_codec_read(codec
, 0x14, 0,
12060 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12061 bits
= present
? HDA_AMP_MUTE
: 0;
12062 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
12063 HDA_AMP_MUTE
, bits
);
12066 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
12068 unsigned int present
;
12069 unsigned char bits
;
12071 present
= snd_hda_codec_read(codec
, 0x1b, 0,
12072 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12073 bits
= present
? HDA_AMP_MUTE
: 0;
12074 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
12075 HDA_AMP_MUTE
, bits
);
12076 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
12077 HDA_AMP_MUTE
, bits
);
12080 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
12083 if ((res
>> 26) == ALC880_HP_EVENT
)
12084 alc662_lenovo_101e_all_automute(codec
);
12085 if ((res
>> 26) == ALC880_FRONT_EVENT
)
12086 alc662_lenovo_101e_ispeaker_automute(codec
);
12089 static void alc662_eeepc_mic_automute(struct hda_codec
*codec
)
12091 unsigned int present
;
12093 present
= snd_hda_codec_read(codec
, 0x18, 0,
12094 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12095 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12096 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
12097 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12098 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
12099 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12100 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
12101 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12102 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
12105 /* unsolicited event for HP jack sensing */
12106 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
12109 if ((res
>> 26) == ALC880_HP_EVENT
)
12110 alc262_hippo1_automute( codec
);
12112 if ((res
>> 26) == ALC880_MIC_EVENT
)
12113 alc662_eeepc_mic_automute(codec
);
12116 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
12118 alc262_hippo1_automute( codec
);
12119 alc662_eeepc_mic_automute(codec
);
12122 #ifdef CONFIG_SND_HDA_POWER_SAVE
12123 #define alc662_loopbacks alc880_loopbacks
12127 /* pcm configuration: identiacal with ALC880 */
12128 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
12129 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
12130 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
12131 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
12134 * configuration and preset
12136 static const char *alc662_models
[ALC662_MODEL_LAST
] = {
12137 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
12138 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
12139 [ALC662_3ST_6ch
] = "3stack-6ch",
12140 [ALC662_5ST_DIG
] = "6stack-dig",
12141 [ALC662_LENOVO_101E
] = "lenovo-101e",
12142 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
12143 [ALC662_AUTO
] = "auto",
12146 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
12147 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
12148 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
12152 static struct alc_config_preset alc662_presets
[] = {
12153 [ALC662_3ST_2ch_DIG
] = {
12154 .mixers
= { alc662_3ST_2ch_mixer
, alc662_capture_mixer
},
12155 .init_verbs
= { alc662_init_verbs
},
12156 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
12157 .dac_nids
= alc662_dac_nids
,
12158 .dig_out_nid
= ALC662_DIGOUT_NID
,
12159 .num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
),
12160 .adc_nids
= alc662_adc_nids
,
12161 .dig_in_nid
= ALC662_DIGIN_NID
,
12162 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
12163 .channel_mode
= alc662_3ST_2ch_modes
,
12164 .input_mux
= &alc662_capture_source
,
12166 [ALC662_3ST_6ch_DIG
] = {
12167 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
12168 alc662_capture_mixer
},
12169 .init_verbs
= { alc662_init_verbs
},
12170 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
12171 .dac_nids
= alc662_dac_nids
,
12172 .dig_out_nid
= ALC662_DIGOUT_NID
,
12173 .num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
),
12174 .adc_nids
= alc662_adc_nids
,
12175 .dig_in_nid
= ALC662_DIGIN_NID
,
12176 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
12177 .channel_mode
= alc662_3ST_6ch_modes
,
12179 .input_mux
= &alc662_capture_source
,
12181 [ALC662_3ST_6ch
] = {
12182 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
12183 alc662_capture_mixer
},
12184 .init_verbs
= { alc662_init_verbs
},
12185 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
12186 .dac_nids
= alc662_dac_nids
,
12187 .num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
),
12188 .adc_nids
= alc662_adc_nids
,
12189 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
12190 .channel_mode
= alc662_3ST_6ch_modes
,
12192 .input_mux
= &alc662_capture_source
,
12194 [ALC662_5ST_DIG
] = {
12195 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
,
12196 alc662_capture_mixer
},
12197 .init_verbs
= { alc662_init_verbs
},
12198 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
12199 .dac_nids
= alc662_dac_nids
,
12200 .dig_out_nid
= ALC662_DIGOUT_NID
,
12201 .num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
),
12202 .adc_nids
= alc662_adc_nids
,
12203 .dig_in_nid
= ALC662_DIGIN_NID
,
12204 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
12205 .channel_mode
= alc662_5stack_modes
,
12206 .input_mux
= &alc662_capture_source
,
12208 [ALC662_LENOVO_101E
] = {
12209 .mixers
= { alc662_lenovo_101e_mixer
, alc662_capture_mixer
},
12210 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
12211 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
12212 .dac_nids
= alc662_dac_nids
,
12213 .num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
),
12214 .adc_nids
= alc662_adc_nids
,
12215 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
12216 .channel_mode
= alc662_3ST_2ch_modes
,
12217 .input_mux
= &alc662_lenovo_101e_capture_source
,
12218 .unsol_event
= alc662_lenovo_101e_unsol_event
,
12219 .init_hook
= alc662_lenovo_101e_all_automute
,
12221 [ALC662_ASUS_EEEPC_P701
] = {
12222 .mixers
= { alc662_eeepc_p701_mixer
, alc662_capture_mixer
},
12223 .init_verbs
= { alc662_init_verbs
,
12224 alc662_eeepc_sue_init_verbs
},
12225 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
12226 .dac_nids
= alc662_dac_nids
,
12227 .num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
),
12228 .adc_nids
= alc662_adc_nids
,
12229 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
12230 .channel_mode
= alc662_3ST_2ch_modes
,
12231 .input_mux
= &alc662_eeepc_capture_source
,
12232 .unsol_event
= alc662_eeepc_unsol_event
,
12233 .init_hook
= alc662_eeepc_inithook
,
12240 * BIOS auto configuration
12243 /* add playback controls from the parsed DAC table */
12244 static int alc662_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12245 const struct auto_pin_cfg
*cfg
)
12248 static const char *chname
[4] = {
12249 "Front", "Surround", NULL
/*CLFE*/, "Side"
12254 for (i
= 0; i
< cfg
->line_outs
; i
++) {
12255 if (!spec
->multiout
.dac_nids
[i
])
12257 nid
= alc880_idx_to_dac(i
);
12260 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12261 "Center Playback Volume",
12262 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
12266 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12267 "LFE Playback Volume",
12268 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
12272 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
12273 "Center Playback Switch",
12274 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
12278 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
12279 "LFE Playback Switch",
12280 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
12285 sprintf(name
, "%s Playback Volume", chname
[i
]);
12286 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
12287 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
12291 sprintf(name
, "%s Playback Switch", chname
[i
]);
12292 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
12293 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
12302 /* add playback controls for speaker and HP outputs */
12303 static int alc662_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
12313 if (alc880_is_fixed_pin(pin
)) {
12314 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
12315 /* printk("DAC nid=%x\n",nid); */
12316 /* specify the DAC as the extra output */
12317 if (!spec
->multiout
.hp_nid
)
12318 spec
->multiout
.hp_nid
= nid
;
12320 spec
->multiout
.extra_out_nid
[0] = nid
;
12321 /* control HP volume/switch on the output mixer amp */
12322 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
12323 sprintf(name
, "%s Playback Volume", pfx
);
12324 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
12325 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
12328 sprintf(name
, "%s Playback Switch", pfx
);
12329 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
12330 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
12333 } else if (alc880_is_multi_pin(pin
)) {
12334 /* set manual connection */
12335 /* we have only a switch on HP-out PIN */
12336 sprintf(name
, "%s Playback Switch", pfx
);
12337 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
12338 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
12345 /* create playback/capture controls for input pins */
12346 static int alc662_auto_create_analog_input_ctls(struct alc_spec
*spec
,
12347 const struct auto_pin_cfg
*cfg
)
12349 struct hda_input_mux
*imux
= &spec
->private_imux
;
12352 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12353 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
12354 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
12355 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
12356 auto_pin_cfg_labels
[i
],
12360 imux
->items
[imux
->num_items
].label
=
12361 auto_pin_cfg_labels
[i
];
12362 imux
->items
[imux
->num_items
].index
=
12363 alc880_input_pin_idx(cfg
->input_pins
[i
]);
12370 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
12371 hda_nid_t nid
, int pin_type
,
12374 /* set as output */
12375 snd_hda_codec_write(codec
, nid
, 0,
12376 AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
12377 snd_hda_codec_write(codec
, nid
, 0,
12378 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
12379 /* need the manual connection? */
12380 if (alc880_is_multi_pin(nid
)) {
12381 struct alc_spec
*spec
= codec
->spec
;
12382 int idx
= alc880_multi_pin_idx(nid
);
12383 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
12384 AC_VERB_SET_CONNECT_SEL
,
12385 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
12389 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
12391 struct alc_spec
*spec
= codec
->spec
;
12394 for (i
= 0; i
<= HDA_SIDE
; i
++) {
12395 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
12396 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
12398 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
12403 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
12405 struct alc_spec
*spec
= codec
->spec
;
12408 pin
= spec
->autocfg
.hp_pins
[0];
12409 if (pin
) /* connect to front */
12411 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
12414 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
12415 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
12417 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
12419 struct alc_spec
*spec
= codec
->spec
;
12422 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12423 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
12424 if (alc662_is_input_pin(nid
)) {
12425 snd_hda_codec_write(codec
, nid
, 0,
12426 AC_VERB_SET_PIN_WIDGET_CONTROL
,
12427 (i
<= AUTO_PIN_FRONT_MIC
?
12428 PIN_VREF80
: PIN_IN
));
12429 if (nid
!= ALC662_PIN_CD_NID
)
12430 snd_hda_codec_write(codec
, nid
, 0,
12431 AC_VERB_SET_AMP_GAIN_MUTE
,
12437 static int alc662_parse_auto_config(struct hda_codec
*codec
)
12439 struct alc_spec
*spec
= codec
->spec
;
12441 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
12443 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12447 if (!spec
->autocfg
.line_outs
)
12448 return 0; /* can't find valid BIOS pin config */
12450 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
12453 err
= alc662_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12456 err
= alc662_auto_create_extra_out(spec
,
12457 spec
->autocfg
.speaker_pins
[0],
12461 err
= alc662_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
12465 err
= alc662_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
12469 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12471 if (spec
->autocfg
.dig_out_pin
)
12472 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
12474 if (spec
->kctl_alloc
)
12475 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
12477 spec
->num_mux_defs
= 1;
12478 spec
->input_mux
= &spec
->private_imux
;
12480 spec
->init_verbs
[spec
->num_init_verbs
++] = alc662_auto_init_verbs
;
12481 spec
->mixers
[spec
->num_mixers
] = alc662_capture_mixer
;
12482 spec
->num_mixers
++;
12486 /* additional initialization for auto-configuration model */
12487 static void alc662_auto_init(struct hda_codec
*codec
)
12489 alc662_auto_init_multi_out(codec
);
12490 alc662_auto_init_hp_out(codec
);
12491 alc662_auto_init_analog_input(codec
);
12494 static int patch_alc662(struct hda_codec
*codec
)
12496 struct alc_spec
*spec
;
12497 int err
, board_config
;
12499 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
12503 codec
->spec
= spec
;
12505 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
12508 if (board_config
< 0) {
12509 printk(KERN_INFO
"hda_codec: Unknown model for ALC662, "
12510 "trying auto-probe from BIOS...\n");
12511 board_config
= ALC662_AUTO
;
12514 if (board_config
== ALC662_AUTO
) {
12515 /* automatic parse from the BIOS config */
12516 err
= alc662_parse_auto_config(codec
);
12522 "hda_codec: Cannot set up configuration "
12523 "from BIOS. Using base mode...\n");
12524 board_config
= ALC662_3ST_2ch_DIG
;
12528 if (board_config
!= ALC662_AUTO
)
12529 setup_preset(spec
, &alc662_presets
[board_config
]);
12531 spec
->stream_name_analog
= "ALC662 Analog";
12532 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
12533 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
12535 spec
->stream_name_digital
= "ALC662 Digital";
12536 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
12537 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
12539 if (!spec
->adc_nids
&& spec
->input_mux
) {
12540 spec
->adc_nids
= alc662_adc_nids
;
12541 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
12544 codec
->patch_ops
= alc_patch_ops
;
12545 if (board_config
== ALC662_AUTO
)
12546 spec
->init_hook
= alc662_auto_init
;
12547 #ifdef CONFIG_SND_HDA_POWER_SAVE
12548 if (!spec
->loopback
.amplist
)
12549 spec
->loopback
.amplist
= alc662_loopbacks
;
12558 struct hda_codec_preset snd_hda_preset_realtek
[] = {
12559 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
12560 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
12561 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
12562 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
12563 .patch
= patch_alc861
},
12564 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
12565 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
12566 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
12567 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
12568 .patch
= patch_alc883
},
12569 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
12570 .patch
= patch_alc662
},
12571 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
12572 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
12573 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
12574 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
12575 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
12576 {} /* terminator */