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
,
99 ALC262_MODEL_LAST
/* last tag */
108 ALC268_MODEL_LAST
/* last tag */
125 /* ALC861-VD models */
146 ALC662_ASUS_EEEPC_P701
,
174 ALC883_TARGA_2ch_DIG
,
180 ALC883_LENOVO_101E_2ch
,
181 ALC883_LENOVO_NB0763
,
182 ALC888_LENOVO_MS7195_DIG
,
191 #define GPIO_MASK 0x03
194 /* codec parameterization */
195 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
196 unsigned int num_mixers
;
198 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
202 unsigned int num_init_verbs
;
204 char *stream_name_analog
; /* analog PCM stream */
205 struct hda_pcm_stream
*stream_analog_playback
;
206 struct hda_pcm_stream
*stream_analog_capture
;
208 char *stream_name_digital
; /* digital PCM stream */
209 struct hda_pcm_stream
*stream_digital_playback
;
210 struct hda_pcm_stream
*stream_digital_capture
;
213 struct hda_multi_out multiout
; /* playback set-up
214 * max_channels, dacs must be set
215 * dig_out_nid and hp_nid are optional
219 unsigned int num_adc_nids
;
221 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
224 unsigned int num_mux_defs
;
225 const struct hda_input_mux
*input_mux
;
226 unsigned int cur_mux
[3];
229 const struct hda_channel_mode
*channel_mode
;
230 int num_channel_mode
;
233 /* PCM information */
234 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
236 /* dynamic controls, init_verbs and input_mux */
237 struct auto_pin_cfg autocfg
;
238 unsigned int num_kctl_alloc
, num_kctl_used
;
239 struct snd_kcontrol_new
*kctl_alloc
;
240 struct hda_input_mux private_imux
;
241 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
244 void (*init_hook
)(struct hda_codec
*codec
);
245 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
247 /* for pin sensing */
248 unsigned int sense_updated
: 1;
249 unsigned int jack_present
: 1;
251 #ifdef CONFIG_SND_HDA_POWER_SAVE
252 struct hda_loopback_check loopback
;
257 * configuration template - to be copied to the spec instance
259 struct alc_config_preset
{
260 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
263 const struct hda_verb
*init_verbs
[5];
264 unsigned int num_dacs
;
266 hda_nid_t dig_out_nid
; /* optional */
267 hda_nid_t hp_nid
; /* optional */
268 unsigned int num_adc_nids
;
270 hda_nid_t dig_in_nid
;
271 unsigned int num_channel_mode
;
272 const struct hda_channel_mode
*channel_mode
;
274 unsigned int num_mux_defs
;
275 const struct hda_input_mux
*input_mux
;
276 void (*unsol_event
)(struct hda_codec
*, unsigned int);
277 void (*init_hook
)(struct hda_codec
*);
278 #ifdef CONFIG_SND_HDA_POWER_SAVE
279 struct hda_amp_list
*loopbacks
;
287 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
288 struct snd_ctl_elem_info
*uinfo
)
290 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
291 struct alc_spec
*spec
= codec
->spec
;
292 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
293 if (mux_idx
>= spec
->num_mux_defs
)
295 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
298 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
299 struct snd_ctl_elem_value
*ucontrol
)
301 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
302 struct alc_spec
*spec
= codec
->spec
;
303 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
305 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
309 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
310 struct snd_ctl_elem_value
*ucontrol
)
312 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
313 struct alc_spec
*spec
= codec
->spec
;
314 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
315 unsigned int mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
316 return snd_hda_input_mux_put(codec
, &spec
->input_mux
[mux_idx
], ucontrol
,
317 spec
->adc_nids
[adc_idx
],
318 &spec
->cur_mux
[adc_idx
]);
323 * channel mode setting
325 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
326 struct snd_ctl_elem_info
*uinfo
)
328 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
329 struct alc_spec
*spec
= codec
->spec
;
330 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
331 spec
->num_channel_mode
);
334 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
335 struct snd_ctl_elem_value
*ucontrol
)
337 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
338 struct alc_spec
*spec
= codec
->spec
;
339 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
340 spec
->num_channel_mode
,
341 spec
->multiout
.max_channels
);
344 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
345 struct snd_ctl_elem_value
*ucontrol
)
347 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
348 struct alc_spec
*spec
= codec
->spec
;
349 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
350 spec
->num_channel_mode
,
351 &spec
->multiout
.max_channels
);
352 if (err
>= 0 && spec
->need_dac_fix
)
353 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
358 * Control the mode of pin widget settings via the mixer. "pc" is used
359 * instead of "%" to avoid consequences of accidently treating the % as
360 * being part of a format specifier. Maximum allowed length of a value is
361 * 63 characters plus NULL terminator.
363 * Note: some retasking pin complexes seem to ignore requests for input
364 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
365 * are requested. Therefore order this list so that this behaviour will not
366 * cause problems when mixer clients move through the enum sequentially.
367 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
370 static char *alc_pin_mode_names
[] = {
371 "Mic 50pc bias", "Mic 80pc bias",
372 "Line in", "Line out", "Headphone out",
374 static unsigned char alc_pin_mode_values
[] = {
375 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
377 /* The control can present all 5 options, or it can limit the options based
378 * in the pin being assumed to be exclusively an input or an output pin. In
379 * addition, "input" pins may or may not process the mic bias option
380 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
381 * accept requests for bias as of chip versions up to March 2006) and/or
382 * wiring in the computer.
384 #define ALC_PIN_DIR_IN 0x00
385 #define ALC_PIN_DIR_OUT 0x01
386 #define ALC_PIN_DIR_INOUT 0x02
387 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
388 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
390 /* Info about the pin modes supported by the different pin direction modes.
391 * For each direction the minimum and maximum values are given.
393 static signed char alc_pin_mode_dir_info
[5][2] = {
394 { 0, 2 }, /* ALC_PIN_DIR_IN */
395 { 3, 4 }, /* ALC_PIN_DIR_OUT */
396 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
397 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
398 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
400 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
401 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
402 #define alc_pin_mode_n_items(_dir) \
403 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
405 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
406 struct snd_ctl_elem_info
*uinfo
)
408 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
409 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
411 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
413 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
415 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
416 item_num
= alc_pin_mode_min(dir
);
417 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
421 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
422 struct snd_ctl_elem_value
*ucontrol
)
425 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
426 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
427 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
428 long *valp
= ucontrol
->value
.integer
.value
;
429 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
430 AC_VERB_GET_PIN_WIDGET_CONTROL
,
433 /* Find enumerated value for current pinctl setting */
434 i
= alc_pin_mode_min(dir
);
435 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
437 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
441 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
442 struct snd_ctl_elem_value
*ucontrol
)
445 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
446 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
447 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
448 long val
= *ucontrol
->value
.integer
.value
;
449 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
450 AC_VERB_GET_PIN_WIDGET_CONTROL
,
453 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
454 val
= alc_pin_mode_min(dir
);
456 change
= pinctl
!= alc_pin_mode_values
[val
];
458 /* Set pin mode to that requested */
459 snd_hda_codec_write_cache(codec
, nid
, 0,
460 AC_VERB_SET_PIN_WIDGET_CONTROL
,
461 alc_pin_mode_values
[val
]);
463 /* Also enable the retasking pin's input/output as required
464 * for the requested pin mode. Enum values of 2 or less are
467 * Dynamically switching the input/output buffers probably
468 * reduces noise slightly (particularly on input) so we'll
469 * do it. However, having both input and output buffers
470 * enabled simultaneously doesn't seem to be problematic if
471 * this turns out to be necessary in the future.
474 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
475 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
476 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
479 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
480 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
481 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
488 #define ALC_PIN_MODE(xname, nid, dir) \
489 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
490 .info = alc_pin_mode_info, \
491 .get = alc_pin_mode_get, \
492 .put = alc_pin_mode_put, \
493 .private_value = nid | (dir<<16) }
495 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
496 * together using a mask with more than one bit set. This control is
497 * currently used only by the ALC260 test model. At this stage they are not
498 * needed for any "production" models.
500 #ifdef CONFIG_SND_DEBUG
501 #define alc_gpio_data_info snd_ctl_boolean_mono_info
503 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
504 struct snd_ctl_elem_value
*ucontrol
)
506 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
507 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
508 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
509 long *valp
= ucontrol
->value
.integer
.value
;
510 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
511 AC_VERB_GET_GPIO_DATA
, 0x00);
513 *valp
= (val
& mask
) != 0;
516 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
517 struct snd_ctl_elem_value
*ucontrol
)
520 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
521 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
522 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
523 long val
= *ucontrol
->value
.integer
.value
;
524 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
525 AC_VERB_GET_GPIO_DATA
,
528 /* Set/unset the masked GPIO bit(s) as needed */
529 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
534 snd_hda_codec_write_cache(codec
, nid
, 0,
535 AC_VERB_SET_GPIO_DATA
, gpio_data
);
539 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
540 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
541 .info = alc_gpio_data_info, \
542 .get = alc_gpio_data_get, \
543 .put = alc_gpio_data_put, \
544 .private_value = nid | (mask<<16) }
545 #endif /* CONFIG_SND_DEBUG */
547 /* A switch control to allow the enabling of the digital IO pins on the
548 * ALC260. This is incredibly simplistic; the intention of this control is
549 * to provide something in the test model allowing digital outputs to be
550 * identified if present. If models are found which can utilise these
551 * outputs a more complete mixer control can be devised for those models if
554 #ifdef CONFIG_SND_DEBUG
555 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
557 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
558 struct snd_ctl_elem_value
*ucontrol
)
560 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
561 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
562 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
563 long *valp
= ucontrol
->value
.integer
.value
;
564 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
565 AC_VERB_GET_DIGI_CONVERT
, 0x00);
567 *valp
= (val
& mask
) != 0;
570 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
571 struct snd_ctl_elem_value
*ucontrol
)
574 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
575 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
576 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
577 long val
= *ucontrol
->value
.integer
.value
;
578 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
579 AC_VERB_GET_DIGI_CONVERT
,
582 /* Set/unset the masked control bit(s) as needed */
583 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
588 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
593 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
594 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
595 .info = alc_spdif_ctrl_info, \
596 .get = alc_spdif_ctrl_get, \
597 .put = alc_spdif_ctrl_put, \
598 .private_value = nid | (mask<<16) }
599 #endif /* CONFIG_SND_DEBUG */
602 * set up from the preset table
604 static void setup_preset(struct alc_spec
*spec
,
605 const struct alc_config_preset
*preset
)
609 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
610 spec
->mixers
[spec
->num_mixers
++] = preset
->mixers
[i
];
611 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
613 spec
->init_verbs
[spec
->num_init_verbs
++] =
614 preset
->init_verbs
[i
];
616 spec
->channel_mode
= preset
->channel_mode
;
617 spec
->num_channel_mode
= preset
->num_channel_mode
;
618 spec
->need_dac_fix
= preset
->need_dac_fix
;
620 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
622 spec
->multiout
.num_dacs
= preset
->num_dacs
;
623 spec
->multiout
.dac_nids
= preset
->dac_nids
;
624 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
625 spec
->multiout
.hp_nid
= preset
->hp_nid
;
627 spec
->num_mux_defs
= preset
->num_mux_defs
;
628 if (!spec
->num_mux_defs
)
629 spec
->num_mux_defs
= 1;
630 spec
->input_mux
= preset
->input_mux
;
632 spec
->num_adc_nids
= preset
->num_adc_nids
;
633 spec
->adc_nids
= preset
->adc_nids
;
634 spec
->dig_in_nid
= preset
->dig_in_nid
;
636 spec
->unsol_event
= preset
->unsol_event
;
637 spec
->init_hook
= preset
->init_hook
;
638 #ifdef CONFIG_SND_HDA_POWER_SAVE
639 spec
->loopback
.amplist
= preset
->loopbacks
;
643 /* Enable GPIO mask and set output */
644 static struct hda_verb alc_gpio1_init_verbs
[] = {
645 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
646 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
647 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
651 static struct hda_verb alc_gpio2_init_verbs
[] = {
652 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
653 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
654 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
658 static struct hda_verb alc_gpio3_init_verbs
[] = {
659 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
660 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
661 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
665 static void alc_sku_automute(struct hda_codec
*codec
)
667 struct alc_spec
*spec
= codec
->spec
;
669 unsigned int present
;
670 unsigned int hp_nid
= spec
->autocfg
.hp_pins
[0];
671 unsigned int sp_nid
= spec
->autocfg
.speaker_pins
[0];
673 /* need to execute and sync at first */
674 snd_hda_codec_read(codec
, hp_nid
, 0, AC_VERB_SET_PIN_SENSE
, 0);
675 present
= snd_hda_codec_read(codec
, hp_nid
, 0,
676 AC_VERB_GET_PIN_SENSE
, 0);
677 spec
->jack_present
= (present
& 0x80000000) != 0;
678 if (spec
->jack_present
) {
679 /* mute internal speaker */
680 snd_hda_codec_amp_stereo(codec
, sp_nid
, HDA_OUTPUT
, 0,
681 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
683 /* unmute internal speaker if necessary */
684 mute
= snd_hda_codec_amp_read(codec
, hp_nid
, 0, HDA_OUTPUT
, 0);
685 snd_hda_codec_amp_stereo(codec
, sp_nid
, HDA_OUTPUT
, 0,
690 /* unsolicited event for HP jack sensing */
691 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
693 if (codec
->vendor_id
== 0x10ec0880)
697 if (res
!= ALC880_HP_EVENT
)
700 alc_sku_automute(codec
);
703 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
704 * 31 ~ 16 : Manufacture ID
706 * 7 ~ 0 : Assembly ID
707 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
709 static void alc_subsystem_id(struct hda_codec
*codec
,
710 unsigned int porta
, unsigned int porte
,
713 unsigned int ass
, tmp
, i
;
715 struct alc_spec
*spec
= codec
->spec
;
717 ass
= codec
->subsystem_id
& 0xffff;
718 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
722 * 31~30 : port conetcivity
725 * 19~16 : Check sum (15:1)
730 if (codec
->vendor_id
== 0x10ec0260)
732 ass
= snd_hda_codec_read(codec
, nid
, 0,
733 AC_VERB_GET_CONFIG_DEFAULT
, 0);
734 if (!(ass
& 1) && !(ass
& 0x100000))
736 if ((ass
>> 30) != 1) /* no physical connection */
741 for (i
= 1; i
< 16; i
++) {
745 if (((ass
>> 16) & 0xf) != tmp
)
751 * 2 : 0 --> Desktop, 1 --> Laptop
752 * 3~5 : External Amplifier control
755 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
758 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
761 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
764 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
766 case 5: /* set EAPD output high */
767 switch (codec
->vendor_id
) {
769 snd_hda_codec_write(codec
, 0x0f, 0,
770 AC_VERB_SET_EAPD_BTLENABLE
, 2);
771 snd_hda_codec_write(codec
, 0x10, 0,
772 AC_VERB_SET_EAPD_BTLENABLE
, 2);
780 snd_hda_codec_write(codec
, 0x14, 0,
781 AC_VERB_SET_EAPD_BTLENABLE
, 2);
782 snd_hda_codec_write(codec
, 0x15, 0,
783 AC_VERB_SET_EAPD_BTLENABLE
, 2);
786 switch (codec
->vendor_id
) {
788 snd_hda_codec_write(codec
, 0x1a, 0,
789 AC_VERB_SET_COEF_INDEX
, 7);
790 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
791 AC_VERB_GET_PROC_COEF
, 0);
792 snd_hda_codec_write(codec
, 0x1a, 0,
793 AC_VERB_SET_COEF_INDEX
, 7);
794 snd_hda_codec_write(codec
, 0x1a, 0,
795 AC_VERB_SET_PROC_COEF
,
804 snd_hda_codec_write(codec
, 0x20, 0,
805 AC_VERB_SET_COEF_INDEX
, 7);
806 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
807 AC_VERB_GET_PROC_COEF
, 0);
808 snd_hda_codec_write(codec
, 0x20, 0,
809 AC_VERB_SET_COEF_INDEX
, 7);
810 snd_hda_codec_write(codec
, 0x20, 0,
811 AC_VERB_SET_PROC_COEF
,
816 snd_hda_codec_write(codec
, 0x20, 0,
817 AC_VERB_SET_COEF_INDEX
, 7);
818 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
819 AC_VERB_GET_PROC_COEF
, 0);
820 snd_hda_codec_write(codec
, 0x20, 0,
821 AC_VERB_SET_COEF_INDEX
, 7);
822 snd_hda_codec_write(codec
, 0x20, 0,
823 AC_VERB_SET_PROC_COEF
,
831 /* is laptop and enable the function "Mute internal speaker
832 * when the external headphone out jack is plugged"
834 if (!(ass
& 0x4) || !(ass
& 0x8000))
837 * 10~8 : Jack location
838 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
840 * 15 : 1 --> enable the function "Mute internal speaker
841 * when the external headphone out jack is plugged"
843 if (!spec
->autocfg
.speaker_pins
[0]) {
844 if (spec
->multiout
.dac_nids
[0])
845 spec
->autocfg
.speaker_pins
[0] =
846 spec
->multiout
.dac_nids
[0];
851 if (!spec
->autocfg
.hp_pins
[0]) {
852 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
854 spec
->autocfg
.hp_pins
[0] = porta
;
856 spec
->autocfg
.hp_pins
[0] = porte
;
858 spec
->autocfg
.hp_pins
[0] = portd
;
863 snd_hda_codec_write(codec
, spec
->autocfg
.hp_pins
[0], 0,
864 AC_VERB_SET_UNSOLICITED_ENABLE
,
865 AC_USRSP_EN
| ALC880_HP_EVENT
);
866 spec
->unsol_event
= alc_sku_unsol_event
;
867 spec
->init_hook
= alc_sku_automute
;
871 * Fix-up pin default configurations
879 static void alc_fix_pincfg(struct hda_codec
*codec
,
880 const struct snd_pci_quirk
*quirk
,
881 const struct alc_pincfg
**pinfix
)
883 const struct alc_pincfg
*cfg
;
885 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
889 cfg
= pinfix
[quirk
->value
];
890 for (; cfg
->nid
; cfg
++) {
893 for (i
= 0; i
< 4; i
++) {
894 snd_hda_codec_write(codec
, cfg
->nid
, 0,
895 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
+ i
,
903 * ALC880 3-stack model
905 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
906 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
907 * F-Mic = 0x1b, HP = 0x19
910 static hda_nid_t alc880_dac_nids
[4] = {
911 /* front, rear, clfe, rear_surr */
912 0x02, 0x05, 0x04, 0x03
915 static hda_nid_t alc880_adc_nids
[3] = {
920 /* The datasheet says the node 0x07 is connected from inputs,
921 * but it shows zero connection in the real implementation on some devices.
922 * Note: this is a 915GAV bug, fixed on 915GLV
924 static hda_nid_t alc880_adc_nids_alt
[2] = {
929 #define ALC880_DIGOUT_NID 0x06
930 #define ALC880_DIGIN_NID 0x0a
932 static struct hda_input_mux alc880_capture_source
= {
936 { "Front Mic", 0x3 },
942 /* channel source setting (2/6 channel selection for 3-stack) */
944 static struct hda_verb alc880_threestack_ch2_init
[] = {
945 /* set line-in to input, mute it */
946 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
947 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
948 /* set mic-in to input vref 80%, mute it */
949 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
950 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
955 static struct hda_verb alc880_threestack_ch6_init
[] = {
956 /* set line-in to output, unmute it */
957 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
958 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
959 /* set mic-in to output, unmute it */
960 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
961 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
965 static struct hda_channel_mode alc880_threestack_modes
[2] = {
966 { 2, alc880_threestack_ch2_init
},
967 { 6, alc880_threestack_ch6_init
},
970 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
971 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
972 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
973 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
974 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
975 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
976 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
977 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
978 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
979 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
980 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
981 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
982 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
983 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
984 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
985 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
986 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
987 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
988 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
989 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
991 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
992 .name
= "Channel Mode",
993 .info
= alc_ch_mode_info
,
994 .get
= alc_ch_mode_get
,
995 .put
= alc_ch_mode_put
,
1000 /* capture mixer elements */
1001 static struct snd_kcontrol_new alc880_capture_mixer
[] = {
1002 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
1003 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
1004 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
1005 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
1006 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
1007 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
1009 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1010 /* The multiple "Capture Source" controls confuse alsamixer
1011 * So call somewhat different..
1012 * FIXME: the controls appear in the "playback" view!
1014 /* .name = "Capture Source", */
1015 .name
= "Input Source",
1017 .info
= alc_mux_enum_info
,
1018 .get
= alc_mux_enum_get
,
1019 .put
= alc_mux_enum_put
,
1024 /* capture mixer elements (in case NID 0x07 not available) */
1025 static struct snd_kcontrol_new alc880_capture_alt_mixer
[] = {
1026 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1027 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1028 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
1029 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
1031 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1032 /* The multiple "Capture Source" controls confuse alsamixer
1033 * So call somewhat different..
1034 * FIXME: the controls appear in the "playback" view!
1036 /* .name = "Capture Source", */
1037 .name
= "Input Source",
1039 .info
= alc_mux_enum_info
,
1040 .get
= alc_mux_enum_get
,
1041 .put
= alc_mux_enum_put
,
1049 * ALC880 5-stack model
1051 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1053 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1054 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1057 /* additional mixers to alc880_three_stack_mixer */
1058 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
1059 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1060 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
1064 /* channel source setting (6/8 channel selection for 5-stack) */
1066 static struct hda_verb alc880_fivestack_ch6_init
[] = {
1067 /* set line-in to input, mute it */
1068 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1069 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1074 static struct hda_verb alc880_fivestack_ch8_init
[] = {
1075 /* set line-in to output, unmute it */
1076 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1077 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1081 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
1082 { 6, alc880_fivestack_ch6_init
},
1083 { 8, alc880_fivestack_ch8_init
},
1088 * ALC880 6-stack model
1090 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1091 * Side = 0x05 (0x0f)
1092 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1093 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1096 static hda_nid_t alc880_6st_dac_nids
[4] = {
1097 /* front, rear, clfe, rear_surr */
1098 0x02, 0x03, 0x04, 0x05
1101 static struct hda_input_mux alc880_6stack_capture_source
= {
1105 { "Front Mic", 0x1 },
1111 /* fixed 8-channels */
1112 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
1116 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
1117 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1118 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1119 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1120 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1121 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1122 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1123 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1124 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1125 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1126 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1127 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1128 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1133 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1134 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1135 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1136 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1138 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1139 .name
= "Channel Mode",
1140 .info
= alc_ch_mode_info
,
1141 .get
= alc_ch_mode_get
,
1142 .put
= alc_ch_mode_put
,
1151 * W810 has rear IO for:
1154 * Center/LFE (DAC 04)
1157 * The system also has a pair of internal speakers, and a headphone jack.
1158 * These are both connected to Line2 on the codec, hence to DAC 02.
1160 * There is a variable resistor to control the speaker or headphone
1161 * volume. This is a hardware-only device without a software API.
1163 * Plugging headphones in will disable the internal speakers. This is
1164 * implemented in hardware, not via the driver using jack sense. In
1165 * a similar fashion, plugging into the rear socket marked "front" will
1166 * disable both the speakers and headphones.
1168 * For input, there's a microphone jack, and an "audio in" jack.
1169 * These may not do anything useful with this driver yet, because I
1170 * haven't setup any initialization verbs for these yet...
1173 static hda_nid_t alc880_w810_dac_nids
[3] = {
1174 /* front, rear/surround, clfe */
1178 /* fixed 6 channels */
1179 static struct hda_channel_mode alc880_w810_modes
[1] = {
1183 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1184 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
1185 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1186 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1187 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1188 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1189 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1190 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1191 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1192 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1193 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1201 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1202 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1206 static hda_nid_t alc880_z71v_dac_nids
[1] = {
1209 #define ALC880_Z71V_HP_DAC 0x03
1211 /* fixed 2 channels */
1212 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
1216 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
1217 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1218 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1219 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1220 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
1221 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1222 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1231 * ALC880 F1734 model
1233 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1234 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1237 static hda_nid_t alc880_f1734_dac_nids
[1] = {
1240 #define ALC880_F1734_HP_DAC 0x02
1242 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
1243 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1244 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1245 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1246 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1247 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1248 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1250 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1259 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1260 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1261 * Mic = 0x18, Line = 0x1a
1264 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1265 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1267 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
1268 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1269 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1270 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1271 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1272 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1273 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1274 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1275 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1276 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1277 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1278 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1279 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1281 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1283 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1284 .name
= "Channel Mode",
1285 .info
= alc_ch_mode_info
,
1286 .get
= alc_ch_mode_get
,
1287 .put
= alc_ch_mode_put
,
1294 * ALC880 ASUS W1V model
1296 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1297 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1298 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1301 /* additional mixers to alc880_asus_mixer */
1302 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
1303 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
1304 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
1308 /* additional mixers to alc880_asus_mixer */
1309 static struct snd_kcontrol_new alc880_pcbeep_mixer
[] = {
1310 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1311 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1316 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
1317 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1318 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1319 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
1320 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
1321 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
1322 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
1323 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
1324 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1325 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1327 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1328 /* The multiple "Capture Source" controls confuse alsamixer
1329 * So call somewhat different..
1330 * FIXME: the controls appear in the "playback" view!
1332 /* .name = "Capture Source", */
1333 .name
= "Input Source",
1335 .info
= alc_mux_enum_info
,
1336 .get
= alc_mux_enum_get
,
1337 .put
= alc_mux_enum_put
,
1343 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
1344 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1345 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT
),
1346 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1347 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1348 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1349 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1350 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1351 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1352 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1353 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1354 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1355 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1356 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1357 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1358 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1359 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1360 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1361 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1363 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1364 .name
= "Channel Mode",
1365 .info
= alc_ch_mode_info
,
1366 .get
= alc_ch_mode_get
,
1367 .put
= alc_ch_mode_put
,
1372 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
1373 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1374 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1375 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1376 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1377 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1378 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1379 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1380 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1381 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1382 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1386 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
1387 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1388 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT
),
1389 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1390 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1391 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1392 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1397 * build control elements
1399 static int alc_build_controls(struct hda_codec
*codec
)
1401 struct alc_spec
*spec
= codec
->spec
;
1405 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1406 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1411 if (spec
->multiout
.dig_out_nid
) {
1412 err
= snd_hda_create_spdif_out_ctls(codec
,
1413 spec
->multiout
.dig_out_nid
);
1417 if (spec
->dig_in_nid
) {
1418 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1427 * initialize the codec volumes, etc
1431 * generic initialization of ADC, input mixers and output mixers
1433 static struct hda_verb alc880_volume_init_verbs
[] = {
1435 * Unmute ADC0-2 and set the default input to mic-in
1437 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
1438 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1439 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
1440 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1441 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
1442 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1444 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1446 * Note: PASD motherboards uses the Line In 2 as the input for front
1449 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1450 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
1453 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
1454 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
1455 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
1456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
1459 * Set up output mixers (0x0c - 0x0f)
1461 /* set vol=0 to output mixers */
1462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1463 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1464 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1465 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1466 /* set up input amps for analog loopback */
1467 /* Amp Indices: DAC = 0, mixer = 1 */
1468 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1469 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1470 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1471 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1472 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1473 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1474 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1475 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1481 * 3-stack pin configuration:
1482 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1484 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
1486 * preset connection lists of input pins
1487 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1489 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
1490 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1491 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
1494 * Set pin mode and muting
1496 /* set front pin widgets 0x14 for output */
1497 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1498 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1499 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1500 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1501 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1502 /* Mic2 (as headphone out) for HP output */
1503 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1504 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1505 /* Line In pin widget for input */
1506 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1507 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1508 /* Line2 (as front mic) pin widget for input and vref at 80% */
1509 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1510 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1511 /* CD pin widget for input */
1512 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1518 * 5-stack pin configuration:
1519 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1520 * line-in/side = 0x1a, f-mic = 0x1b
1522 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
1524 * preset connection lists of input pins
1525 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1527 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1528 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
1531 * Set pin mode and muting
1533 /* set pin widgets 0x14-0x17 for output */
1534 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1535 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1536 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1537 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1538 /* unmute pins for output (no gain on this amp) */
1539 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1540 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1541 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1542 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1544 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1545 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1546 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1547 /* Mic2 (as headphone out) for HP output */
1548 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1549 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1550 /* Line In pin widget for input */
1551 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1552 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1553 /* Line2 (as front mic) pin widget for input and vref at 80% */
1554 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1555 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1556 /* CD pin widget for input */
1557 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1563 * W810 pin configuration:
1564 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1566 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
1567 /* hphone/speaker input selector: front DAC */
1568 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
1570 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1571 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1572 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1573 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1574 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1575 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1577 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1578 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1584 * Z71V pin configuration:
1585 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1587 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
1588 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1589 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1590 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1591 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1593 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1594 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1595 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1596 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1602 * 6-stack pin configuration:
1603 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1604 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1606 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
1607 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1609 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1610 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1611 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1612 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1613 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1614 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1615 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1616 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1618 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1619 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1620 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1621 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1622 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1623 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1624 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1625 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1626 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1632 * Uniwill pin configuration:
1633 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1636 static struct hda_verb alc880_uniwill_init_verbs
[] = {
1637 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1639 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1640 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1641 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1642 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1643 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1644 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1645 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1646 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1647 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1648 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1649 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1650 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1651 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1652 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1654 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1655 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1656 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1657 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1658 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1659 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1660 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1661 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1662 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1664 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1665 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
1672 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1674 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
1675 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1677 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1678 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1679 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1680 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1681 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1682 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1683 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1684 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1685 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1686 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1687 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1688 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1690 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1691 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1692 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1693 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1694 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1695 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1697 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1698 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
1703 static struct hda_verb alc880_beep_init_verbs
[] = {
1704 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
1708 /* toggle speaker-output according to the hp-jack state */
1709 static void alc880_uniwill_hp_automute(struct hda_codec
*codec
)
1711 unsigned int present
;
1714 present
= snd_hda_codec_read(codec
, 0x14, 0,
1715 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1716 bits
= present
? HDA_AMP_MUTE
: 0;
1717 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
1718 HDA_AMP_MUTE
, bits
);
1719 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
1720 HDA_AMP_MUTE
, bits
);
1723 /* auto-toggle front mic */
1724 static void alc880_uniwill_mic_automute(struct hda_codec
*codec
)
1726 unsigned int present
;
1729 present
= snd_hda_codec_read(codec
, 0x18, 0,
1730 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1731 bits
= present
? HDA_AMP_MUTE
: 0;
1732 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
1735 static void alc880_uniwill_automute(struct hda_codec
*codec
)
1737 alc880_uniwill_hp_automute(codec
);
1738 alc880_uniwill_mic_automute(codec
);
1741 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
1744 /* Looks like the unsol event is incompatible with the standard
1745 * definition. 4bit tag is placed at 28 bit!
1747 switch (res
>> 28) {
1748 case ALC880_HP_EVENT
:
1749 alc880_uniwill_hp_automute(codec
);
1751 case ALC880_MIC_EVENT
:
1752 alc880_uniwill_mic_automute(codec
);
1757 static void alc880_uniwill_p53_hp_automute(struct hda_codec
*codec
)
1759 unsigned int present
;
1762 present
= snd_hda_codec_read(codec
, 0x14, 0,
1763 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1764 bits
= present
? HDA_AMP_MUTE
: 0;
1765 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_INPUT
, 0, HDA_AMP_MUTE
, bits
);
1768 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
1770 unsigned int present
;
1772 present
= snd_hda_codec_read(codec
, 0x21, 0,
1773 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
1774 present
&= HDA_AMP_VOLMASK
;
1775 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
1776 HDA_AMP_VOLMASK
, present
);
1777 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
1778 HDA_AMP_VOLMASK
, present
);
1781 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
1784 /* Looks like the unsol event is incompatible with the standard
1785 * definition. 4bit tag is placed at 28 bit!
1787 if ((res
>> 28) == ALC880_HP_EVENT
)
1788 alc880_uniwill_p53_hp_automute(codec
);
1789 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
1790 alc880_uniwill_p53_dcvol_automute(codec
);
1795 * F1734 pin configuration:
1796 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1798 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
1799 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1800 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1801 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
1802 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1805 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1806 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1807 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1809 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1810 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1811 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1812 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1813 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1814 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1815 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1816 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1817 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1824 * ASUS pin configuration:
1825 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1827 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
1828 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1829 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1830 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
1831 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1833 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1834 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1835 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1836 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1837 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1838 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1839 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1840 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1842 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1843 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1844 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1845 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1846 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1847 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1848 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1849 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1850 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1855 /* Enable GPIO mask and set output */
1856 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1857 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1859 /* Clevo m520g init */
1860 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
1861 /* headphone output */
1862 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
1864 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1865 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1867 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1868 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1870 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1871 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1872 /* Mic1 (rear panel) */
1873 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1874 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1875 /* Mic2 (front panel) */
1876 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1877 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1879 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1880 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1881 /* change to EAPD mode */
1882 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1883 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
1888 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
1889 /* change to EAPD mode */
1890 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1891 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
1893 /* Headphone output */
1894 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1896 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1897 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
1899 /* Line In pin widget for input */
1900 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1901 /* CD pin widget for input */
1902 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1903 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1904 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1906 /* change to EAPD mode */
1907 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1908 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
1914 * LG m1 express dual
1917 * Rear Line-In/Out (blue): 0x14
1918 * Build-in Mic-In: 0x15
1920 * HP-Out (green): 0x1b
1921 * Mic-In/Out (red): 0x19
1925 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
1926 static hda_nid_t alc880_lg_dac_nids
[3] = {
1930 /* seems analog CD is not working */
1931 static struct hda_input_mux alc880_lg_capture_source
= {
1936 { "Internal Mic", 0x6 },
1940 /* 2,4,6 channel modes */
1941 static struct hda_verb alc880_lg_ch2_init
[] = {
1942 /* set line-in and mic-in to input */
1943 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1944 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1948 static struct hda_verb alc880_lg_ch4_init
[] = {
1949 /* set line-in to out and mic-in to input */
1950 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1951 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1955 static struct hda_verb alc880_lg_ch6_init
[] = {
1956 /* set line-in and mic-in to output */
1957 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1958 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1962 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
1963 { 2, alc880_lg_ch2_init
},
1964 { 4, alc880_lg_ch4_init
},
1965 { 6, alc880_lg_ch6_init
},
1968 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
1969 /* FIXME: it's not really "master" but front channels */
1970 HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1971 HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT
),
1972 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1973 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
1974 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
1975 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
1976 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
1977 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
1978 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1979 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1980 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
1981 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
1982 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
1983 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
1985 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1986 .name
= "Channel Mode",
1987 .info
= alc_ch_mode_info
,
1988 .get
= alc_ch_mode_get
,
1989 .put
= alc_ch_mode_put
,
1994 static struct hda_verb alc880_lg_init_verbs
[] = {
1995 /* set capture source to mic-in */
1996 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1997 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1998 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1999 /* mute all amp mixer inputs */
2000 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
2001 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2003 /* line-in to input */
2004 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2005 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2007 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2010 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2011 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2012 /* mic-in to input */
2013 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2014 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2015 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2017 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
2018 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2019 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2021 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2025 /* toggle speaker-output according to the hp-jack state */
2026 static void alc880_lg_automute(struct hda_codec
*codec
)
2028 unsigned int present
;
2031 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2032 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2033 bits
= present
? HDA_AMP_MUTE
: 0;
2034 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
2035 HDA_AMP_MUTE
, bits
);
2038 static void alc880_lg_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2040 /* Looks like the unsol event is incompatible with the standard
2041 * definition. 4bit tag is placed at 28 bit!
2043 if ((res
>> 28) == 0x01)
2044 alc880_lg_automute(codec
);
2053 * Built-in Mic-In: 0x19
2059 static struct hda_input_mux alc880_lg_lw_capture_source
= {
2063 { "Internal Mic", 0x1 },
2068 #define alc880_lg_lw_modes alc880_threestack_modes
2070 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
2071 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2072 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2073 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2074 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2075 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2076 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2077 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2078 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2079 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2080 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2081 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2082 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2083 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
2084 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
2086 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2087 .name
= "Channel Mode",
2088 .info
= alc_ch_mode_info
,
2089 .get
= alc_ch_mode_get
,
2090 .put
= alc_ch_mode_put
,
2095 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
2096 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2097 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2098 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2100 /* set capture source to mic-in */
2101 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2102 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2103 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2104 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2106 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2107 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2109 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2110 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2111 /* mic-in to input */
2112 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2113 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2115 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2116 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2118 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2122 /* toggle speaker-output according to the hp-jack state */
2123 static void alc880_lg_lw_automute(struct hda_codec
*codec
)
2125 unsigned int present
;
2128 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2129 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2130 bits
= present
? HDA_AMP_MUTE
: 0;
2131 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
2132 HDA_AMP_MUTE
, bits
);
2135 static void alc880_lg_lw_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2137 /* Looks like the unsol event is incompatible with the standard
2138 * definition. 4bit tag is placed at 28 bit!
2140 if ((res
>> 28) == 0x01)
2141 alc880_lg_lw_automute(codec
);
2144 #ifdef CONFIG_SND_HDA_POWER_SAVE
2145 static struct hda_amp_list alc880_loopbacks
[] = {
2146 { 0x0b, HDA_INPUT
, 0 },
2147 { 0x0b, HDA_INPUT
, 1 },
2148 { 0x0b, HDA_INPUT
, 2 },
2149 { 0x0b, HDA_INPUT
, 3 },
2150 { 0x0b, HDA_INPUT
, 4 },
2154 static struct hda_amp_list alc880_lg_loopbacks
[] = {
2155 { 0x0b, HDA_INPUT
, 1 },
2156 { 0x0b, HDA_INPUT
, 6 },
2157 { 0x0b, HDA_INPUT
, 7 },
2166 static int alc_init(struct hda_codec
*codec
)
2168 struct alc_spec
*spec
= codec
->spec
;
2171 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
2172 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
2174 if (spec
->init_hook
)
2175 spec
->init_hook(codec
);
2180 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2182 struct alc_spec
*spec
= codec
->spec
;
2184 if (spec
->unsol_event
)
2185 spec
->unsol_event(codec
, res
);
2188 #ifdef CONFIG_SND_HDA_POWER_SAVE
2189 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
2191 struct alc_spec
*spec
= codec
->spec
;
2192 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
2197 * Analog playback callbacks
2199 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2200 struct hda_codec
*codec
,
2201 struct snd_pcm_substream
*substream
)
2203 struct alc_spec
*spec
= codec
->spec
;
2204 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
);
2207 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2208 struct hda_codec
*codec
,
2209 unsigned int stream_tag
,
2210 unsigned int format
,
2211 struct snd_pcm_substream
*substream
)
2213 struct alc_spec
*spec
= codec
->spec
;
2214 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
2215 stream_tag
, format
, substream
);
2218 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2219 struct hda_codec
*codec
,
2220 struct snd_pcm_substream
*substream
)
2222 struct alc_spec
*spec
= codec
->spec
;
2223 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2229 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2230 struct hda_codec
*codec
,
2231 struct snd_pcm_substream
*substream
)
2233 struct alc_spec
*spec
= codec
->spec
;
2234 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2237 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2238 struct hda_codec
*codec
,
2239 unsigned int stream_tag
,
2240 unsigned int format
,
2241 struct snd_pcm_substream
*substream
)
2243 struct alc_spec
*spec
= codec
->spec
;
2244 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2245 stream_tag
, format
, substream
);
2248 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2249 struct hda_codec
*codec
,
2250 struct snd_pcm_substream
*substream
)
2252 struct alc_spec
*spec
= codec
->spec
;
2253 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2259 static int alc880_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2260 struct hda_codec
*codec
,
2261 unsigned int stream_tag
,
2262 unsigned int format
,
2263 struct snd_pcm_substream
*substream
)
2265 struct alc_spec
*spec
= codec
->spec
;
2267 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
2268 stream_tag
, 0, format
);
2272 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2273 struct hda_codec
*codec
,
2274 struct snd_pcm_substream
*substream
)
2276 struct alc_spec
*spec
= codec
->spec
;
2278 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
2286 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
2290 /* NID is set in alc_build_pcms */
2292 .open
= alc880_playback_pcm_open
,
2293 .prepare
= alc880_playback_pcm_prepare
,
2294 .cleanup
= alc880_playback_pcm_cleanup
2298 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
2302 /* NID is set in alc_build_pcms */
2304 .prepare
= alc880_capture_pcm_prepare
,
2305 .cleanup
= alc880_capture_pcm_cleanup
2309 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
2313 /* NID is set in alc_build_pcms */
2315 .open
= alc880_dig_playback_pcm_open
,
2316 .close
= alc880_dig_playback_pcm_close
,
2317 .prepare
= alc880_dig_playback_pcm_prepare
2321 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
2325 /* NID is set in alc_build_pcms */
2328 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2329 static struct hda_pcm_stream alc_pcm_null_playback
= {
2335 static int alc_build_pcms(struct hda_codec
*codec
)
2337 struct alc_spec
*spec
= codec
->spec
;
2338 struct hda_pcm
*info
= spec
->pcm_rec
;
2341 codec
->num_pcms
= 1;
2342 codec
->pcm_info
= info
;
2344 info
->name
= spec
->stream_name_analog
;
2345 if (spec
->stream_analog_playback
) {
2346 snd_assert(spec
->multiout
.dac_nids
, return -EINVAL
);
2347 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
2348 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
2350 if (spec
->stream_analog_capture
) {
2351 snd_assert(spec
->adc_nids
, return -EINVAL
);
2352 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
2353 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
2356 if (spec
->channel_mode
) {
2357 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
2358 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
2359 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
2360 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
2365 /* SPDIF for stream index #1 */
2366 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2367 codec
->num_pcms
= 2;
2368 info
= spec
->pcm_rec
+ 1;
2369 info
->name
= spec
->stream_name_digital
;
2370 if (spec
->multiout
.dig_out_nid
&&
2371 spec
->stream_digital_playback
) {
2372 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
2373 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2375 if (spec
->dig_in_nid
&&
2376 spec
->stream_digital_capture
) {
2377 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
2378 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2382 /* If the use of more than one ADC is requested for the current
2383 * model, configure a second analog capture-only PCM.
2385 /* Additional Analaog capture for index #2 */
2386 if (spec
->num_adc_nids
> 1 && spec
->stream_analog_capture
&&
2388 codec
->num_pcms
= 3;
2389 info
= spec
->pcm_rec
+ 2;
2390 info
->name
= spec
->stream_name_analog
;
2391 /* No playback stream for second PCM */
2392 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = alc_pcm_null_playback
;
2393 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
2394 if (spec
->stream_analog_capture
) {
2395 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
2396 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[1];
2403 static void alc_free(struct hda_codec
*codec
)
2405 struct alc_spec
*spec
= codec
->spec
;
2411 if (spec
->kctl_alloc
) {
2412 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
2413 kfree(spec
->kctl_alloc
[i
].name
);
2414 kfree(spec
->kctl_alloc
);
2421 static struct hda_codec_ops alc_patch_ops
= {
2422 .build_controls
= alc_build_controls
,
2423 .build_pcms
= alc_build_pcms
,
2426 .unsol_event
= alc_unsol_event
,
2427 #ifdef CONFIG_SND_HDA_POWER_SAVE
2428 .check_power_status
= alc_check_power_status
,
2434 * Test configuration for debugging
2436 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2439 #ifdef CONFIG_SND_DEBUG
2440 static hda_nid_t alc880_test_dac_nids
[4] = {
2441 0x02, 0x03, 0x04, 0x05
2444 static struct hda_input_mux alc880_test_capture_source
= {
2453 { "Surround", 0x6 },
2457 static struct hda_channel_mode alc880_test_modes
[4] = {
2464 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
2465 struct snd_ctl_elem_info
*uinfo
)
2467 static char *texts
[] = {
2468 "N/A", "Line Out", "HP Out",
2469 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2471 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2473 uinfo
->value
.enumerated
.items
= 8;
2474 if (uinfo
->value
.enumerated
.item
>= 8)
2475 uinfo
->value
.enumerated
.item
= 7;
2476 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2480 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
2481 struct snd_ctl_elem_value
*ucontrol
)
2483 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2484 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2485 unsigned int pin_ctl
, item
= 0;
2487 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2488 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2489 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
2490 if (pin_ctl
& AC_PINCTL_HP_EN
)
2494 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
2495 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
2496 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
2497 case AC_PINCTL_VREF_50
: item
= 4; break;
2498 case AC_PINCTL_VREF_GRD
: item
= 5; break;
2499 case AC_PINCTL_VREF_80
: item
= 6; break;
2500 case AC_PINCTL_VREF_100
: item
= 7; break;
2503 ucontrol
->value
.enumerated
.item
[0] = item
;
2507 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
2508 struct snd_ctl_elem_value
*ucontrol
)
2510 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2511 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2512 static unsigned int ctls
[] = {
2513 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
2514 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
2515 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
2516 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
2517 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
2518 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
2520 unsigned int old_ctl
, new_ctl
;
2522 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2523 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2524 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
2525 if (old_ctl
!= new_ctl
) {
2527 snd_hda_codec_write_cache(codec
, nid
, 0,
2528 AC_VERB_SET_PIN_WIDGET_CONTROL
,
2530 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
2532 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
2539 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
2540 struct snd_ctl_elem_info
*uinfo
)
2542 static char *texts
[] = {
2543 "Front", "Surround", "CLFE", "Side"
2545 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2547 uinfo
->value
.enumerated
.items
= 4;
2548 if (uinfo
->value
.enumerated
.item
>= 4)
2549 uinfo
->value
.enumerated
.item
= 3;
2550 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2554 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
2555 struct snd_ctl_elem_value
*ucontrol
)
2557 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2558 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2561 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
2562 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
2566 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
2567 struct snd_ctl_elem_value
*ucontrol
)
2569 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2570 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2573 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
2574 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
2575 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
2576 snd_hda_codec_write_cache(codec
, nid
, 0,
2577 AC_VERB_SET_CONNECT_SEL
, sel
);
2583 #define PIN_CTL_TEST(xname,nid) { \
2584 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2586 .info = alc_test_pin_ctl_info, \
2587 .get = alc_test_pin_ctl_get, \
2588 .put = alc_test_pin_ctl_put, \
2589 .private_value = nid \
2592 #define PIN_SRC_TEST(xname,nid) { \
2593 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2595 .info = alc_test_pin_src_info, \
2596 .get = alc_test_pin_src_get, \
2597 .put = alc_test_pin_src_put, \
2598 .private_value = nid \
2601 static struct snd_kcontrol_new alc880_test_mixer
[] = {
2602 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2603 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2604 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
2605 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2606 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2607 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2608 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
2609 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2610 PIN_CTL_TEST("Front Pin Mode", 0x14),
2611 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2612 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2613 PIN_CTL_TEST("Side Pin Mode", 0x17),
2614 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2615 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2616 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2617 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2618 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2619 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2620 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2621 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2622 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2623 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2624 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2625 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2626 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
2627 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
2628 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2629 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2630 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
2631 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
2633 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2634 .name
= "Channel Mode",
2635 .info
= alc_ch_mode_info
,
2636 .get
= alc_ch_mode_get
,
2637 .put
= alc_ch_mode_put
,
2642 static struct hda_verb alc880_test_init_verbs
[] = {
2643 /* Unmute inputs of 0x0c - 0x0f */
2644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2645 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2646 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2647 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2648 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2649 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2650 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2651 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2652 /* Vol output for 0x0c-0x0f */
2653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2654 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2655 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2656 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2657 /* Set output pins 0x14-0x17 */
2658 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2659 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2660 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2661 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2662 /* Unmute output pins 0x14-0x17 */
2663 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2664 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2665 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2666 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2667 /* Set input pins 0x18-0x1c */
2668 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2669 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2670 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2671 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2672 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2673 /* Mute input pins 0x18-0x1b */
2674 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2675 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2676 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2677 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2679 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2680 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2681 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2682 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2683 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2684 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2685 /* Analog input/passthru */
2686 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2687 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
2689 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
2690 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
2698 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
2699 [ALC880_3ST
] = "3stack",
2700 [ALC880_TCL_S700
] = "tcl",
2701 [ALC880_3ST_DIG
] = "3stack-digout",
2702 [ALC880_CLEVO
] = "clevo",
2703 [ALC880_5ST
] = "5stack",
2704 [ALC880_5ST_DIG
] = "5stack-digout",
2705 [ALC880_W810
] = "w810",
2706 [ALC880_Z71V
] = "z71v",
2707 [ALC880_6ST
] = "6stack",
2708 [ALC880_6ST_DIG
] = "6stack-digout",
2709 [ALC880_ASUS
] = "asus",
2710 [ALC880_ASUS_W1V
] = "asus-w1v",
2711 [ALC880_ASUS_DIG
] = "asus-dig",
2712 [ALC880_ASUS_DIG2
] = "asus-dig2",
2713 [ALC880_UNIWILL_DIG
] = "uniwill",
2714 [ALC880_UNIWILL_P53
] = "uniwill-p53",
2715 [ALC880_FUJITSU
] = "fujitsu",
2716 [ALC880_F1734
] = "F1734",
2718 [ALC880_LG_LW
] = "lg-lw",
2719 #ifdef CONFIG_SND_DEBUG
2720 [ALC880_TEST
] = "test",
2722 [ALC880_AUTO
] = "auto",
2725 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
2726 /* Broken BIOS configuration */
2727 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
),
2728 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
2730 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
2731 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
2732 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
2733 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
2734 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
2735 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
2736 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
2737 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
2738 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
2740 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
2741 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
2743 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
2744 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
2745 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
2746 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
2747 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
2748 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
2749 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
2750 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2751 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
2752 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
2753 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS
),
2754 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
2755 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
2756 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
2757 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS
),
2759 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
2760 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
2761 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
2762 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
2763 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
2764 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
2765 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
2766 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
2767 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
2768 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
2769 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
2770 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
2771 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
2772 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
2773 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
2774 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
2775 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
2776 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
2778 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
2779 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
2780 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
2781 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
2783 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
2784 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL
),
2785 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
2786 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
2788 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
2789 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
2790 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
2791 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
2793 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
2794 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
2795 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
2796 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
2797 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
2798 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
2799 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
2800 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
2801 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
2802 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
2803 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST
),
2809 * ALC880 codec presets
2811 static struct alc_config_preset alc880_presets
[] = {
2813 .mixers
= { alc880_three_stack_mixer
},
2814 .init_verbs
= { alc880_volume_init_verbs
,
2815 alc880_pin_3stack_init_verbs
},
2816 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2817 .dac_nids
= alc880_dac_nids
,
2818 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2819 .channel_mode
= alc880_threestack_modes
,
2821 .input_mux
= &alc880_capture_source
,
2823 [ALC880_3ST_DIG
] = {
2824 .mixers
= { alc880_three_stack_mixer
},
2825 .init_verbs
= { alc880_volume_init_verbs
,
2826 alc880_pin_3stack_init_verbs
},
2827 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2828 .dac_nids
= alc880_dac_nids
,
2829 .dig_out_nid
= ALC880_DIGOUT_NID
,
2830 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2831 .channel_mode
= alc880_threestack_modes
,
2833 .input_mux
= &alc880_capture_source
,
2835 [ALC880_TCL_S700
] = {
2836 .mixers
= { alc880_tcl_s700_mixer
},
2837 .init_verbs
= { alc880_volume_init_verbs
,
2838 alc880_pin_tcl_S700_init_verbs
,
2839 alc880_gpio2_init_verbs
},
2840 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2841 .dac_nids
= alc880_dac_nids
,
2843 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2844 .channel_mode
= alc880_2_jack_modes
,
2845 .input_mux
= &alc880_capture_source
,
2848 .mixers
= { alc880_three_stack_mixer
,
2849 alc880_five_stack_mixer
},
2850 .init_verbs
= { alc880_volume_init_verbs
,
2851 alc880_pin_5stack_init_verbs
},
2852 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2853 .dac_nids
= alc880_dac_nids
,
2854 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
2855 .channel_mode
= alc880_fivestack_modes
,
2856 .input_mux
= &alc880_capture_source
,
2858 [ALC880_5ST_DIG
] = {
2859 .mixers
= { alc880_three_stack_mixer
,
2860 alc880_five_stack_mixer
},
2861 .init_verbs
= { alc880_volume_init_verbs
,
2862 alc880_pin_5stack_init_verbs
},
2863 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2864 .dac_nids
= alc880_dac_nids
,
2865 .dig_out_nid
= ALC880_DIGOUT_NID
,
2866 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
2867 .channel_mode
= alc880_fivestack_modes
,
2868 .input_mux
= &alc880_capture_source
,
2871 .mixers
= { alc880_six_stack_mixer
},
2872 .init_verbs
= { alc880_volume_init_verbs
,
2873 alc880_pin_6stack_init_verbs
},
2874 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
2875 .dac_nids
= alc880_6st_dac_nids
,
2876 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
2877 .channel_mode
= alc880_sixstack_modes
,
2878 .input_mux
= &alc880_6stack_capture_source
,
2880 [ALC880_6ST_DIG
] = {
2881 .mixers
= { alc880_six_stack_mixer
},
2882 .init_verbs
= { alc880_volume_init_verbs
,
2883 alc880_pin_6stack_init_verbs
},
2884 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
2885 .dac_nids
= alc880_6st_dac_nids
,
2886 .dig_out_nid
= ALC880_DIGOUT_NID
,
2887 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
2888 .channel_mode
= alc880_sixstack_modes
,
2889 .input_mux
= &alc880_6stack_capture_source
,
2892 .mixers
= { alc880_w810_base_mixer
},
2893 .init_verbs
= { alc880_volume_init_verbs
,
2894 alc880_pin_w810_init_verbs
,
2895 alc880_gpio2_init_verbs
},
2896 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
2897 .dac_nids
= alc880_w810_dac_nids
,
2898 .dig_out_nid
= ALC880_DIGOUT_NID
,
2899 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
2900 .channel_mode
= alc880_w810_modes
,
2901 .input_mux
= &alc880_capture_source
,
2904 .mixers
= { alc880_z71v_mixer
},
2905 .init_verbs
= { alc880_volume_init_verbs
,
2906 alc880_pin_z71v_init_verbs
},
2907 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
2908 .dac_nids
= alc880_z71v_dac_nids
,
2909 .dig_out_nid
= ALC880_DIGOUT_NID
,
2911 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2912 .channel_mode
= alc880_2_jack_modes
,
2913 .input_mux
= &alc880_capture_source
,
2916 .mixers
= { alc880_f1734_mixer
},
2917 .init_verbs
= { alc880_volume_init_verbs
,
2918 alc880_pin_f1734_init_verbs
},
2919 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
2920 .dac_nids
= alc880_f1734_dac_nids
,
2922 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2923 .channel_mode
= alc880_2_jack_modes
,
2924 .input_mux
= &alc880_capture_source
,
2927 .mixers
= { alc880_asus_mixer
},
2928 .init_verbs
= { alc880_volume_init_verbs
,
2929 alc880_pin_asus_init_verbs
,
2930 alc880_gpio1_init_verbs
},
2931 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2932 .dac_nids
= alc880_asus_dac_nids
,
2933 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2934 .channel_mode
= alc880_asus_modes
,
2936 .input_mux
= &alc880_capture_source
,
2938 [ALC880_ASUS_DIG
] = {
2939 .mixers
= { alc880_asus_mixer
},
2940 .init_verbs
= { alc880_volume_init_verbs
,
2941 alc880_pin_asus_init_verbs
,
2942 alc880_gpio1_init_verbs
},
2943 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2944 .dac_nids
= alc880_asus_dac_nids
,
2945 .dig_out_nid
= ALC880_DIGOUT_NID
,
2946 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2947 .channel_mode
= alc880_asus_modes
,
2949 .input_mux
= &alc880_capture_source
,
2951 [ALC880_ASUS_DIG2
] = {
2952 .mixers
= { alc880_asus_mixer
},
2953 .init_verbs
= { alc880_volume_init_verbs
,
2954 alc880_pin_asus_init_verbs
,
2955 alc880_gpio2_init_verbs
}, /* use GPIO2 */
2956 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2957 .dac_nids
= alc880_asus_dac_nids
,
2958 .dig_out_nid
= ALC880_DIGOUT_NID
,
2959 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2960 .channel_mode
= alc880_asus_modes
,
2962 .input_mux
= &alc880_capture_source
,
2964 [ALC880_ASUS_W1V
] = {
2965 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
2966 .init_verbs
= { alc880_volume_init_verbs
,
2967 alc880_pin_asus_init_verbs
,
2968 alc880_gpio1_init_verbs
},
2969 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2970 .dac_nids
= alc880_asus_dac_nids
,
2971 .dig_out_nid
= ALC880_DIGOUT_NID
,
2972 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2973 .channel_mode
= alc880_asus_modes
,
2975 .input_mux
= &alc880_capture_source
,
2977 [ALC880_UNIWILL_DIG
] = {
2978 .mixers
= { alc880_asus_mixer
, alc880_pcbeep_mixer
},
2979 .init_verbs
= { alc880_volume_init_verbs
,
2980 alc880_pin_asus_init_verbs
},
2981 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2982 .dac_nids
= alc880_asus_dac_nids
,
2983 .dig_out_nid
= ALC880_DIGOUT_NID
,
2984 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2985 .channel_mode
= alc880_asus_modes
,
2987 .input_mux
= &alc880_capture_source
,
2989 [ALC880_UNIWILL
] = {
2990 .mixers
= { alc880_uniwill_mixer
},
2991 .init_verbs
= { alc880_volume_init_verbs
,
2992 alc880_uniwill_init_verbs
},
2993 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2994 .dac_nids
= alc880_asus_dac_nids
,
2995 .dig_out_nid
= ALC880_DIGOUT_NID
,
2996 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2997 .channel_mode
= alc880_threestack_modes
,
2999 .input_mux
= &alc880_capture_source
,
3000 .unsol_event
= alc880_uniwill_unsol_event
,
3001 .init_hook
= alc880_uniwill_automute
,
3003 [ALC880_UNIWILL_P53
] = {
3004 .mixers
= { alc880_uniwill_p53_mixer
},
3005 .init_verbs
= { alc880_volume_init_verbs
,
3006 alc880_uniwill_p53_init_verbs
},
3007 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3008 .dac_nids
= alc880_asus_dac_nids
,
3009 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3010 .channel_mode
= alc880_threestack_modes
,
3011 .input_mux
= &alc880_capture_source
,
3012 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3013 .init_hook
= alc880_uniwill_p53_hp_automute
,
3015 [ALC880_FUJITSU
] = {
3016 .mixers
= { alc880_fujitsu_mixer
,
3017 alc880_pcbeep_mixer
, },
3018 .init_verbs
= { alc880_volume_init_verbs
,
3019 alc880_uniwill_p53_init_verbs
,
3020 alc880_beep_init_verbs
},
3021 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3022 .dac_nids
= alc880_dac_nids
,
3023 .dig_out_nid
= ALC880_DIGOUT_NID
,
3024 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3025 .channel_mode
= alc880_2_jack_modes
,
3026 .input_mux
= &alc880_capture_source
,
3027 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3028 .init_hook
= alc880_uniwill_p53_hp_automute
,
3031 .mixers
= { alc880_three_stack_mixer
},
3032 .init_verbs
= { alc880_volume_init_verbs
,
3033 alc880_pin_clevo_init_verbs
},
3034 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3035 .dac_nids
= alc880_dac_nids
,
3037 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3038 .channel_mode
= alc880_threestack_modes
,
3040 .input_mux
= &alc880_capture_source
,
3043 .mixers
= { alc880_lg_mixer
},
3044 .init_verbs
= { alc880_volume_init_verbs
,
3045 alc880_lg_init_verbs
},
3046 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
3047 .dac_nids
= alc880_lg_dac_nids
,
3048 .dig_out_nid
= ALC880_DIGOUT_NID
,
3049 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
3050 .channel_mode
= alc880_lg_ch_modes
,
3052 .input_mux
= &alc880_lg_capture_source
,
3053 .unsol_event
= alc880_lg_unsol_event
,
3054 .init_hook
= alc880_lg_automute
,
3055 #ifdef CONFIG_SND_HDA_POWER_SAVE
3056 .loopbacks
= alc880_lg_loopbacks
,
3060 .mixers
= { alc880_lg_lw_mixer
},
3061 .init_verbs
= { alc880_volume_init_verbs
,
3062 alc880_lg_lw_init_verbs
},
3063 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3064 .dac_nids
= alc880_dac_nids
,
3065 .dig_out_nid
= ALC880_DIGOUT_NID
,
3066 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
3067 .channel_mode
= alc880_lg_lw_modes
,
3068 .input_mux
= &alc880_lg_lw_capture_source
,
3069 .unsol_event
= alc880_lg_lw_unsol_event
,
3070 .init_hook
= alc880_lg_lw_automute
,
3072 #ifdef CONFIG_SND_DEBUG
3074 .mixers
= { alc880_test_mixer
},
3075 .init_verbs
= { alc880_test_init_verbs
},
3076 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
3077 .dac_nids
= alc880_test_dac_nids
,
3078 .dig_out_nid
= ALC880_DIGOUT_NID
,
3079 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
3080 .channel_mode
= alc880_test_modes
,
3081 .input_mux
= &alc880_test_capture_source
,
3087 * Automatic parse of I/O pins from the BIOS configuration
3090 #define NUM_CONTROL_ALLOC 32
3091 #define NUM_VERB_ALLOC 32
3095 ALC_CTL_WIDGET_MUTE
,
3098 static struct snd_kcontrol_new alc880_control_templates
[] = {
3099 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
3100 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
3101 HDA_BIND_MUTE(NULL
, 0, 0, 0),
3104 /* add dynamic controls */
3105 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
3108 struct snd_kcontrol_new
*knew
;
3110 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
3111 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
3113 /* array + terminator */
3114 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
);
3117 if (spec
->kctl_alloc
) {
3118 memcpy(knew
, spec
->kctl_alloc
,
3119 sizeof(*knew
) * spec
->num_kctl_alloc
);
3120 kfree(spec
->kctl_alloc
);
3122 spec
->kctl_alloc
= knew
;
3123 spec
->num_kctl_alloc
= num
;
3126 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
3127 *knew
= alc880_control_templates
[type
];
3128 knew
->name
= kstrdup(name
, GFP_KERNEL
);
3131 knew
->private_value
= val
;
3132 spec
->num_kctl_used
++;
3136 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3137 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3138 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3139 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3140 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3141 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3142 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3143 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3144 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3145 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3146 #define ALC880_PIN_CD_NID 0x1c
3148 /* fill in the dac_nids table from the parsed pin configuration */
3149 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
3150 const struct auto_pin_cfg
*cfg
)
3156 memset(assigned
, 0, sizeof(assigned
));
3157 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
3159 /* check the pins hardwired to audio widget */
3160 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3161 nid
= cfg
->line_out_pins
[i
];
3162 if (alc880_is_fixed_pin(nid
)) {
3163 int idx
= alc880_fixed_pin_idx(nid
);
3164 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
3168 /* left pins can be connect to any audio widget */
3169 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3170 nid
= cfg
->line_out_pins
[i
];
3171 if (alc880_is_fixed_pin(nid
))
3173 /* search for an empty channel */
3174 for (j
= 0; j
< cfg
->line_outs
; j
++) {
3176 spec
->multiout
.dac_nids
[i
] =
3177 alc880_idx_to_dac(j
);
3183 spec
->multiout
.num_dacs
= cfg
->line_outs
;
3187 /* add playback controls from the parsed DAC table */
3188 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
3189 const struct auto_pin_cfg
*cfg
)
3192 static const char *chname
[4] = {
3193 "Front", "Surround", NULL
/*CLFE*/, "Side"
3198 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3199 if (!spec
->multiout
.dac_nids
[i
])
3201 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
3204 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3205 "Center Playback Volume",
3206 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
3210 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3211 "LFE Playback Volume",
3212 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
3216 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3217 "Center Playback Switch",
3218 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
3222 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3223 "LFE Playback Switch",
3224 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
3229 sprintf(name
, "%s Playback Volume", chname
[i
]);
3230 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3231 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
3235 sprintf(name
, "%s Playback Switch", chname
[i
]);
3236 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3237 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
3246 /* add playback controls for speaker and HP outputs */
3247 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
3257 if (alc880_is_fixed_pin(pin
)) {
3258 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
3259 /* specify the DAC as the extra output */
3260 if (!spec
->multiout
.hp_nid
)
3261 spec
->multiout
.hp_nid
= nid
;
3263 spec
->multiout
.extra_out_nid
[0] = nid
;
3264 /* control HP volume/switch on the output mixer amp */
3265 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
3266 sprintf(name
, "%s Playback Volume", pfx
);
3267 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3268 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
3271 sprintf(name
, "%s Playback Switch", pfx
);
3272 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3273 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
3276 } else if (alc880_is_multi_pin(pin
)) {
3277 /* set manual connection */
3278 /* we have only a switch on HP-out PIN */
3279 sprintf(name
, "%s Playback Switch", pfx
);
3280 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3281 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
3288 /* create input playback/capture controls for the given pin */
3289 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
3290 const char *ctlname
,
3291 int idx
, hda_nid_t mix_nid
)
3296 sprintf(name
, "%s Playback Volume", ctlname
);
3297 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3298 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3301 sprintf(name
, "%s Playback Switch", ctlname
);
3302 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3303 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3309 /* create playback/capture controls for input pins */
3310 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
3311 const struct auto_pin_cfg
*cfg
)
3313 struct hda_input_mux
*imux
= &spec
->private_imux
;
3316 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3317 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
3318 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
3319 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
3320 auto_pin_cfg_labels
[i
],
3324 imux
->items
[imux
->num_items
].label
=
3325 auto_pin_cfg_labels
[i
];
3326 imux
->items
[imux
->num_items
].index
=
3327 alc880_input_pin_idx(cfg
->input_pins
[i
]);
3334 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
3335 hda_nid_t nid
, int pin_type
,
3339 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
3341 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
3343 /* need the manual connection? */
3344 if (alc880_is_multi_pin(nid
)) {
3345 struct alc_spec
*spec
= codec
->spec
;
3346 int idx
= alc880_multi_pin_idx(nid
);
3347 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
3348 AC_VERB_SET_CONNECT_SEL
,
3349 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
3353 static int get_pin_type(int line_out_type
)
3355 if (line_out_type
== AUTO_PIN_HP_OUT
)
3361 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
3363 struct alc_spec
*spec
= codec
->spec
;
3366 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
3367 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
3368 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
3369 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
3370 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
3374 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
3376 struct alc_spec
*spec
= codec
->spec
;
3379 pin
= spec
->autocfg
.speaker_pins
[0];
3380 if (pin
) /* connect to front */
3381 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
3382 pin
= spec
->autocfg
.hp_pins
[0];
3383 if (pin
) /* connect to front */
3384 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
3387 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
3389 struct alc_spec
*spec
= codec
->spec
;
3392 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3393 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
3394 if (alc880_is_input_pin(nid
)) {
3395 snd_hda_codec_write(codec
, nid
, 0,
3396 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3397 i
<= AUTO_PIN_FRONT_MIC
?
3398 PIN_VREF80
: PIN_IN
);
3399 if (nid
!= ALC880_PIN_CD_NID
)
3400 snd_hda_codec_write(codec
, nid
, 0,
3401 AC_VERB_SET_AMP_GAIN_MUTE
,
3407 /* parse the BIOS configuration and set up the alc_spec */
3408 /* return 1 if successful, 0 if the proper config is not found,
3409 * or a negative error code
3411 static int alc880_parse_auto_config(struct hda_codec
*codec
)
3413 struct alc_spec
*spec
= codec
->spec
;
3415 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
3417 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
3421 if (!spec
->autocfg
.line_outs
)
3422 return 0; /* can't find valid BIOS pin config */
3424 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
3427 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
3430 err
= alc880_auto_create_extra_out(spec
,
3431 spec
->autocfg
.speaker_pins
[0],
3435 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
3439 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
3443 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
3445 if (spec
->autocfg
.dig_out_pin
)
3446 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
3447 if (spec
->autocfg
.dig_in_pin
)
3448 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
3450 if (spec
->kctl_alloc
)
3451 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3453 spec
->init_verbs
[spec
->num_init_verbs
++] = alc880_volume_init_verbs
;
3455 spec
->num_mux_defs
= 1;
3456 spec
->input_mux
= &spec
->private_imux
;
3461 /* additional initialization for auto-configuration model */
3462 static void alc880_auto_init(struct hda_codec
*codec
)
3464 alc880_auto_init_multi_out(codec
);
3465 alc880_auto_init_extra_out(codec
);
3466 alc880_auto_init_analog_input(codec
);
3470 * OK, here we have finally the patch for ALC880
3473 static int patch_alc880(struct hda_codec
*codec
)
3475 struct alc_spec
*spec
;
3479 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3485 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
3488 if (board_config
< 0) {
3489 printk(KERN_INFO
"hda_codec: Unknown model for ALC880, "
3490 "trying auto-probe from BIOS...\n");
3491 board_config
= ALC880_AUTO
;
3494 if (board_config
== ALC880_AUTO
) {
3495 /* automatic parse from the BIOS config */
3496 err
= alc880_parse_auto_config(codec
);
3502 "hda_codec: Cannot set up configuration "
3503 "from BIOS. Using 3-stack mode...\n");
3504 board_config
= ALC880_3ST
;
3508 if (board_config
!= ALC880_AUTO
)
3509 setup_preset(spec
, &alc880_presets
[board_config
]);
3511 spec
->stream_name_analog
= "ALC880 Analog";
3512 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
3513 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
3515 spec
->stream_name_digital
= "ALC880 Digital";
3516 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
3517 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
3519 if (!spec
->adc_nids
&& spec
->input_mux
) {
3520 /* check whether NID 0x07 is valid */
3521 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
3523 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
3524 if (wcap
!= AC_WID_AUD_IN
) {
3525 spec
->adc_nids
= alc880_adc_nids_alt
;
3526 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
3527 spec
->mixers
[spec
->num_mixers
] =
3528 alc880_capture_alt_mixer
;
3531 spec
->adc_nids
= alc880_adc_nids
;
3532 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
3533 spec
->mixers
[spec
->num_mixers
] = alc880_capture_mixer
;
3538 codec
->patch_ops
= alc_patch_ops
;
3539 if (board_config
== ALC880_AUTO
)
3540 spec
->init_hook
= alc880_auto_init
;
3541 #ifdef CONFIG_SND_HDA_POWER_SAVE
3542 if (!spec
->loopback
.amplist
)
3543 spec
->loopback
.amplist
= alc880_loopbacks
;
3554 static hda_nid_t alc260_dac_nids
[1] = {
3559 static hda_nid_t alc260_adc_nids
[1] = {
3564 static hda_nid_t alc260_adc_nids_alt
[1] = {
3569 static hda_nid_t alc260_hp_adc_nids
[2] = {
3574 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3575 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3577 static hda_nid_t alc260_dual_adc_nids
[2] = {
3582 #define ALC260_DIGOUT_NID 0x03
3583 #define ALC260_DIGIN_NID 0x06
3585 static struct hda_input_mux alc260_capture_source
= {
3589 { "Front Mic", 0x1 },
3595 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3596 * headphone jack and the internal CD lines since these are the only pins at
3597 * which audio can appear. For flexibility, also allow the option of
3598 * recording the mixer output on the second ADC (ADC0 doesn't have a
3599 * connection to the mixer output).
3601 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
3605 { "Mic/Line", 0x0 },
3607 { "Headphone", 0x2 },
3613 { "Mic/Line", 0x0 },
3615 { "Headphone", 0x2 },
3622 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3623 * the Fujitsu S702x, but jacks are marked differently.
3625 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
3632 { "Headphone", 0x5 },
3641 { "Headphone", 0x6 },
3647 * This is just place-holder, so there's something for alc_build_pcms to look
3648 * at when it calculates the maximum number of channels. ALC260 has no mixer
3649 * element which allows changing the channel mode, so the verb list is
3652 static struct hda_channel_mode alc260_modes
[1] = {
3657 /* Mixer combinations
3659 * basic: base_output + input + pc_beep + capture
3660 * HP: base_output + input + capture_alt
3661 * HP_3013: hp_3013 + input + capture
3662 * fujitsu: fujitsu + capture
3663 * acer: acer + capture
3666 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
3667 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3668 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
3669 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3670 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
3671 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3672 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
3676 static struct snd_kcontrol_new alc260_input_mixer
[] = {
3677 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3678 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3679 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3680 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3682 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3683 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
3684 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
3688 static struct snd_kcontrol_new alc260_pc_beep_mixer
[] = {
3689 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT
),
3690 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT
),
3694 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
3695 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3696 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
3697 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
3698 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
3699 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3700 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
3701 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3702 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
3706 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3707 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3709 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
3710 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3711 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
3712 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3713 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3714 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3715 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
3716 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
3717 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3718 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3719 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3720 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3721 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
3725 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3726 * versions of the ALC260 don't act on requests to enable mic bias from NID
3727 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3728 * datasheet doesn't mention this restriction. At this stage it's not clear
3729 * whether this behaviour is intentional or is a hardware bug in chip
3730 * revisions available in early 2006. Therefore for now allow the
3731 * "Headphone Jack Mode" control to span all choices, but if it turns out
3732 * that the lack of mic bias for this NID is intentional we could change the
3733 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3735 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3736 * don't appear to make the mic bias available from the "line" jack, even
3737 * though the NID used for this jack (0x14) can supply it. The theory is
3738 * that perhaps Acer have included blocking capacitors between the ALC260
3739 * and the output jack. If this turns out to be the case for all such
3740 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3741 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3743 * The C20x Tablet series have a mono internal speaker which is controlled
3744 * via the chip's Mono sum widget and pin complex, so include the necessary
3745 * controls for such models. On models without a "mono speaker" the control
3746 * won't do anything.
3748 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
3749 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3750 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
3751 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
3752 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3754 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3756 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3757 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3758 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3759 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3760 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3761 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3762 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3763 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3764 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3765 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3769 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
3770 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
3772 static struct snd_kcontrol_new alc260_will_mixer
[] = {
3773 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3774 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
3775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3776 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3777 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3778 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3779 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3780 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3781 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3782 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3783 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3784 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3788 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
3789 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
3791 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
3792 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3793 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
3794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3795 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3796 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3797 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
3798 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
3799 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3800 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3801 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3805 /* capture mixer elements */
3806 static struct snd_kcontrol_new alc260_capture_mixer
[] = {
3807 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT
),
3808 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT
),
3809 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT
),
3810 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT
),
3812 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3813 /* The multiple "Capture Source" controls confuse alsamixer
3814 * So call somewhat different..
3815 * FIXME: the controls appear in the "playback" view!
3817 /* .name = "Capture Source", */
3818 .name
= "Input Source",
3820 .info
= alc_mux_enum_info
,
3821 .get
= alc_mux_enum_get
,
3822 .put
= alc_mux_enum_put
,
3827 static struct snd_kcontrol_new alc260_capture_alt_mixer
[] = {
3828 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT
),
3829 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT
),
3831 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3832 /* The multiple "Capture Source" controls confuse alsamixer
3833 * So call somewhat different..
3834 * FIXME: the controls appear in the "playback" view!
3836 /* .name = "Capture Source", */
3837 .name
= "Input Source",
3839 .info
= alc_mux_enum_info
,
3840 .get
= alc_mux_enum_get
,
3841 .put
= alc_mux_enum_put
,
3847 * initialization verbs
3849 static struct hda_verb alc260_init_verbs
[] = {
3850 /* Line In pin widget for input */
3851 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3852 /* CD pin widget for input */
3853 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3854 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3855 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3856 /* Mic2 (front panel) pin widget for input and vref at 80% */
3857 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3858 /* LINE-2 is used for line-out in rear */
3859 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3860 /* select line-out */
3861 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
3863 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3865 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3867 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3868 /* mute capture amp left and right */
3869 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3870 /* set connection select to line in (default select for this ADC) */
3871 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3872 /* mute capture amp left and right */
3873 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3874 /* set connection select to line in (default select for this ADC) */
3875 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
3876 /* set vol=0 Line-Out mixer amp left and right */
3877 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3878 /* unmute pin widget amp left and right (no gain on this amp) */
3879 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3880 /* set vol=0 HP mixer amp left and right */
3881 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3882 /* unmute pin widget amp left and right (no gain on this amp) */
3883 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3884 /* set vol=0 Mono mixer amp left and right */
3885 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3886 /* unmute pin widget amp left and right (no gain on this amp) */
3887 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3888 /* unmute LINE-2 out pin */
3889 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3890 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3893 /* mute analog inputs */
3894 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3895 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3896 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3897 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3898 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3899 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3900 /* mute Front out path */
3901 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3902 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3903 /* mute Headphone out path */
3904 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3905 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3906 /* mute Mono out path */
3907 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3908 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3912 #if 0 /* should be identical with alc260_init_verbs? */
3913 static struct hda_verb alc260_hp_init_verbs
[] = {
3914 /* Headphone and output */
3915 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
3917 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3918 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3919 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3920 /* Mic2 (front panel) pin widget for input and vref at 80% */
3921 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3922 /* Line In pin widget for input */
3923 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3924 /* Line-2 pin widget for output */
3925 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3926 /* CD pin widget for input */
3927 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3928 /* unmute amp left and right */
3929 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
3930 /* set connection select to line in (default select for this ADC) */
3931 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3932 /* unmute Line-Out mixer amp left and right (volume = 0) */
3933 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3934 /* mute pin widget amp left and right (no gain on this amp) */
3935 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3936 /* unmute HP mixer amp left and right (volume = 0) */
3937 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3938 /* mute pin widget amp left and right (no gain on this amp) */
3939 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3940 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3943 /* mute analog inputs */
3944 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3945 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3946 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3947 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3948 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3949 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3950 /* Unmute Front out path */
3951 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3952 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3953 /* Unmute Headphone out path */
3954 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3955 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3956 /* Unmute Mono out path */
3957 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3958 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3963 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
3964 /* Line out and output */
3965 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3967 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3968 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3969 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3970 /* Mic2 (front panel) pin widget for input and vref at 80% */
3971 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3972 /* Line In pin widget for input */
3973 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3974 /* Headphone pin widget for output */
3975 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
3976 /* CD pin widget for input */
3977 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3978 /* unmute amp left and right */
3979 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
3980 /* set connection select to line in (default select for this ADC) */
3981 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3982 /* unmute Line-Out mixer amp left and right (volume = 0) */
3983 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3984 /* mute pin widget amp left and right (no gain on this amp) */
3985 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3986 /* unmute HP mixer amp left and right (volume = 0) */
3987 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3988 /* mute pin widget amp left and right (no gain on this amp) */
3989 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3990 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
3993 /* mute analog inputs */
3994 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3995 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3996 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
3997 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
3998 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
3999 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4000 /* Unmute Front out path */
4001 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4002 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4003 /* Unmute Headphone out path */
4004 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4005 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4006 /* Unmute Mono out path */
4007 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4008 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4012 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4013 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4014 * audio = 0x16, internal speaker = 0x10.
4016 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
4017 /* Disable all GPIOs */
4018 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
4019 /* Internal speaker is connected to headphone pin */
4020 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4021 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4023 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4024 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4025 /* Ensure all other unused pins are disabled and muted. */
4026 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4027 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4028 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4029 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4030 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4031 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4032 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4033 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4035 /* Disable digital (SPDIF) pins */
4036 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4037 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4039 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4040 * when acting as an output.
4042 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4044 /* Start with output sum widgets muted and their output gains at min */
4045 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4046 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4047 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4048 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4049 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4050 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4051 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4052 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4053 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4055 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4056 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4057 /* Unmute Line1 pin widget output buffer since it starts as an output.
4058 * If the pin mode is changed by the user the pin mode control will
4059 * take care of enabling the pin's input/output buffers as needed.
4060 * Therefore there's no need to enable the input buffer at this
4063 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4064 /* Unmute input buffer of pin widget used for Line-in (no equiv
4067 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4069 /* Mute capture amp left and right */
4070 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4071 /* Set ADC connection select to match default mixer setting - line
4074 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4076 /* Do the same for the second ADC: mute capture input amp and
4077 * set ADC connection to line in (on mic1 pin)
4079 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4080 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4082 /* Mute all inputs to mixer widget (even unconnected ones) */
4083 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4084 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4085 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4086 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4087 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4088 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4089 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4090 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4095 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4096 * similar laptops (adapted from Fujitsu init verbs).
4098 static struct hda_verb alc260_acer_init_verbs
[] = {
4099 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4100 * the headphone jack. Turn this on and rely on the standard mute
4101 * methods whenever the user wants to turn these outputs off.
4103 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4104 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4105 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
4106 /* Internal speaker/Headphone jack is connected to Line-out pin */
4107 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4108 /* Internal microphone/Mic jack is connected to Mic1 pin */
4109 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
4110 /* Line In jack is connected to Line1 pin */
4111 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4112 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4113 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4114 /* Ensure all other unused pins are disabled and muted. */
4115 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4116 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4117 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4118 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4120 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4121 /* Disable digital (SPDIF) pins */
4122 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4123 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4125 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4126 * bus when acting as outputs.
4128 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4129 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4131 /* Start with output sum widgets muted and their output gains at min */
4132 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4133 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4134 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4135 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4136 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4137 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4138 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4139 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4140 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4142 /* Unmute Line-out pin widget amp left and right
4143 * (no equiv mixer ctrl)
4145 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4146 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4147 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4148 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4149 * inputs. If the pin mode is changed by the user the pin mode control
4150 * will take care of enabling the pin's input/output buffers as needed.
4151 * Therefore there's no need to enable the input buffer at this
4154 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4155 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4157 /* Mute capture amp left and right */
4158 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4159 /* Set ADC connection select to match default mixer setting - mic
4162 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4164 /* Do similar with the second ADC: mute capture input amp and
4165 * set ADC connection to mic to match ALSA's default state.
4167 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4168 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4170 /* Mute all inputs to mixer widget (even unconnected ones) */
4171 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4172 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4173 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4174 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4175 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4176 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4177 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4178 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4183 static struct hda_verb alc260_will_verbs
[] = {
4184 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4185 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
4186 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
4187 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4188 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4189 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
4193 static struct hda_verb alc260_replacer_672v_verbs
[] = {
4194 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4195 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4196 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
4198 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4199 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4200 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4202 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4206 /* toggle speaker-output according to the hp-jack state */
4207 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
4209 unsigned int present
;
4211 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4212 present
= snd_hda_codec_read(codec
, 0x0f, 0,
4213 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
4215 snd_hda_codec_write_cache(codec
, 0x01, 0,
4216 AC_VERB_SET_GPIO_DATA
, 1);
4217 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4218 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4221 snd_hda_codec_write_cache(codec
, 0x01, 0,
4222 AC_VERB_SET_GPIO_DATA
, 0);
4223 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4224 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4229 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
4232 if ((res
>> 26) == ALC880_HP_EVENT
)
4233 alc260_replacer_672v_automute(codec
);
4236 /* Test configuration for debugging, modelled after the ALC880 test
4239 #ifdef CONFIG_SND_DEBUG
4240 static hda_nid_t alc260_test_dac_nids
[1] = {
4243 static hda_nid_t alc260_test_adc_nids
[2] = {
4246 /* For testing the ALC260, each input MUX needs its own definition since
4247 * the signal assignments are different. This assumes that the first ADC
4250 static struct hda_input_mux alc260_test_capture_sources
[2] = {
4254 { "MIC1 pin", 0x0 },
4255 { "MIC2 pin", 0x1 },
4256 { "LINE1 pin", 0x2 },
4257 { "LINE2 pin", 0x3 },
4259 { "LINE-OUT pin", 0x5 },
4260 { "HP-OUT pin", 0x6 },
4266 { "MIC1 pin", 0x0 },
4267 { "MIC2 pin", 0x1 },
4268 { "LINE1 pin", 0x2 },
4269 { "LINE2 pin", 0x3 },
4272 { "LINE-OUT pin", 0x6 },
4273 { "HP-OUT pin", 0x7 },
4277 static struct snd_kcontrol_new alc260_test_mixer
[] = {
4278 /* Output driver widgets */
4279 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4280 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4281 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4282 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
4283 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4284 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
4286 /* Modes for retasking pin widgets
4287 * Note: the ALC260 doesn't seem to act on requests to enable mic
4288 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4289 * mention this restriction. At this stage it's not clear whether
4290 * this behaviour is intentional or is a hardware bug in chip
4291 * revisions available at least up until early 2006. Therefore for
4292 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4293 * choices, but if it turns out that the lack of mic bias for these
4294 * NIDs is intentional we could change their modes from
4295 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4297 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
4298 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
4299 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
4300 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
4301 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
4302 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
4304 /* Loopback mixer controls */
4305 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
4306 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
4307 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
4308 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
4309 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
4310 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
4311 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
4312 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
4313 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4314 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4315 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4316 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4317 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
4318 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
4319 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
4320 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
4322 /* Controls for GPIO pins, assuming they are configured as outputs */
4323 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4324 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4325 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4326 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4328 /* Switches to allow the digital IO pins to be enabled. The datasheet
4329 * is ambigious as to which NID is which; testing on laptops which
4330 * make this output available should provide clarification.
4332 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4333 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4337 static struct hda_verb alc260_test_init_verbs
[] = {
4338 /* Enable all GPIOs as outputs with an initial value of 0 */
4339 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
4340 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4341 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
4343 /* Enable retasking pins as output, initially without power amp */
4344 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4345 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4346 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4347 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4348 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4349 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4351 /* Disable digital (SPDIF) pins initially, but users can enable
4352 * them via a mixer switch. In the case of SPDIF-out, this initverb
4353 * payload also sets the generation to 0, output to be in "consumer"
4354 * PCM format, copyright asserted, no pre-emphasis and no validity
4357 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4358 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4360 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4361 * OUT1 sum bus when acting as an output.
4363 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4364 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
4365 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4366 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
4368 /* Start with output sum widgets muted and their output gains at min */
4369 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4371 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4372 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4373 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4374 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4375 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4376 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4377 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4379 /* Unmute retasking pin widget output buffers since the default
4380 * state appears to be output. As the pin mode is changed by the
4381 * user the pin mode control will take care of enabling the pin's
4382 * input/output buffers as needed.
4384 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4385 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4386 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4387 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4388 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4389 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4390 /* Also unmute the mono-out pin widget */
4391 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4393 /* Mute capture amp left and right */
4394 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4395 /* Set ADC connection select to match default mixer setting (mic1
4398 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4400 /* Do the same for the second ADC: mute capture input amp and
4401 * set ADC connection to mic1 pin
4403 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4404 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4406 /* Mute all inputs to mixer widget (even unconnected ones) */
4407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4408 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4410 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4412 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4413 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4414 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4420 static struct hda_pcm_stream alc260_pcm_analog_playback
= {
4426 static struct hda_pcm_stream alc260_pcm_analog_capture
= {
4432 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4433 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4436 * for BIOS auto-configuration
4439 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
4443 unsigned long vol_val
, sw_val
;
4447 if (nid
>= 0x0f && nid
< 0x11) {
4448 nid_vol
= nid
- 0x7;
4449 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
4450 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4451 } else if (nid
== 0x11) {
4452 nid_vol
= nid
- 0x7;
4453 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
4454 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
4455 } else if (nid
>= 0x12 && nid
<= 0x15) {
4457 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
4458 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4462 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
4463 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
);
4466 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
4467 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
);
4473 /* add playback controls from the parsed DAC table */
4474 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
4475 const struct auto_pin_cfg
*cfg
)
4480 spec
->multiout
.num_dacs
= 1;
4481 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
4482 spec
->multiout
.dac_nids
[0] = 0x02;
4484 nid
= cfg
->line_out_pins
[0];
4486 err
= alc260_add_playback_controls(spec
, nid
, "Front");
4491 nid
= cfg
->speaker_pins
[0];
4493 err
= alc260_add_playback_controls(spec
, nid
, "Speaker");
4498 nid
= cfg
->hp_pins
[0];
4500 err
= alc260_add_playback_controls(spec
, nid
, "Headphone");
4507 /* create playback/capture controls for input pins */
4508 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
4509 const struct auto_pin_cfg
*cfg
)
4511 struct hda_input_mux
*imux
= &spec
->private_imux
;
4514 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4515 if (cfg
->input_pins
[i
] >= 0x12) {
4516 idx
= cfg
->input_pins
[i
] - 0x12;
4517 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4518 auto_pin_cfg_labels
[i
], idx
,
4522 imux
->items
[imux
->num_items
].label
=
4523 auto_pin_cfg_labels
[i
];
4524 imux
->items
[imux
->num_items
].index
= idx
;
4527 if (cfg
->input_pins
[i
] >= 0x0f && cfg
->input_pins
[i
] <= 0x10){
4528 idx
= cfg
->input_pins
[i
] - 0x09;
4529 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4530 auto_pin_cfg_labels
[i
], idx
,
4534 imux
->items
[imux
->num_items
].label
=
4535 auto_pin_cfg_labels
[i
];
4536 imux
->items
[imux
->num_items
].index
= idx
;
4543 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
4544 hda_nid_t nid
, int pin_type
,
4548 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4550 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4552 /* need the manual connection? */
4554 int idx
= nid
- 0x12;
4555 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
4556 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
4560 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
4562 struct alc_spec
*spec
= codec
->spec
;
4565 alc_subsystem_id(codec
, 0x10, 0x15, 0x0f);
4566 nid
= spec
->autocfg
.line_out_pins
[0];
4568 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
4569 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
4572 nid
= spec
->autocfg
.speaker_pins
[0];
4574 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
4576 nid
= spec
->autocfg
.hp_pins
[0];
4578 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
4581 #define ALC260_PIN_CD_NID 0x16
4582 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
4584 struct alc_spec
*spec
= codec
->spec
;
4587 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4588 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
4590 snd_hda_codec_write(codec
, nid
, 0,
4591 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4592 i
<= AUTO_PIN_FRONT_MIC
?
4593 PIN_VREF80
: PIN_IN
);
4594 if (nid
!= ALC260_PIN_CD_NID
)
4595 snd_hda_codec_write(codec
, nid
, 0,
4596 AC_VERB_SET_AMP_GAIN_MUTE
,
4603 * generic initialization of ADC, input mixers and output mixers
4605 static struct hda_verb alc260_volume_init_verbs
[] = {
4607 * Unmute ADC0-1 and set the default input to mic-in
4609 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4610 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4611 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4612 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4614 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4616 * Note: PASD motherboards uses the Line In 2 as the input for
4617 * front panel mic (mic 2)
4619 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4620 /* mute analog inputs */
4621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4622 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4623 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4624 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4625 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4628 * Set up output mixers (0x08 - 0x0a)
4630 /* set vol=0 to output mixers */
4631 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4632 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4633 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4634 /* set up input amps for analog loopback */
4635 /* Amp Indices: DAC = 0, mixer = 1 */
4636 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4637 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4638 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4639 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4640 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4641 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4646 static int alc260_parse_auto_config(struct hda_codec
*codec
)
4648 struct alc_spec
*spec
= codec
->spec
;
4651 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
4653 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
4657 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
4660 if (!spec
->kctl_alloc
)
4661 return 0; /* can't find valid BIOS pin config */
4662 err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
4666 spec
->multiout
.max_channels
= 2;
4668 if (spec
->autocfg
.dig_out_pin
)
4669 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
4670 if (spec
->kctl_alloc
)
4671 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
4673 spec
->init_verbs
[spec
->num_init_verbs
++] = alc260_volume_init_verbs
;
4675 spec
->num_mux_defs
= 1;
4676 spec
->input_mux
= &spec
->private_imux
;
4678 /* check whether NID 0x04 is valid */
4679 wcap
= get_wcaps(codec
, 0x04);
4680 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
4681 if (wcap
!= AC_WID_AUD_IN
) {
4682 spec
->adc_nids
= alc260_adc_nids_alt
;
4683 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
4684 spec
->mixers
[spec
->num_mixers
] = alc260_capture_alt_mixer
;
4686 spec
->adc_nids
= alc260_adc_nids
;
4687 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
4688 spec
->mixers
[spec
->num_mixers
] = alc260_capture_mixer
;
4695 /* additional initialization for auto-configuration model */
4696 static void alc260_auto_init(struct hda_codec
*codec
)
4698 alc260_auto_init_multi_out(codec
);
4699 alc260_auto_init_analog_input(codec
);
4702 #ifdef CONFIG_SND_HDA_POWER_SAVE
4703 static struct hda_amp_list alc260_loopbacks
[] = {
4704 { 0x07, HDA_INPUT
, 0 },
4705 { 0x07, HDA_INPUT
, 1 },
4706 { 0x07, HDA_INPUT
, 2 },
4707 { 0x07, HDA_INPUT
, 3 },
4708 { 0x07, HDA_INPUT
, 4 },
4714 * ALC260 configurations
4716 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
4717 [ALC260_BASIC
] = "basic",
4719 [ALC260_HP_3013
] = "hp-3013",
4720 [ALC260_FUJITSU_S702X
] = "fujitsu",
4721 [ALC260_ACER
] = "acer",
4722 [ALC260_WILL
] = "will",
4723 [ALC260_REPLACER_672V
] = "replacer",
4724 #ifdef CONFIG_SND_DEBUG
4725 [ALC260_TEST
] = "test",
4727 [ALC260_AUTO
] = "auto",
4730 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
4731 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
4732 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
4733 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
4734 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013
),
4735 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
4736 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP
),
4737 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013
),
4738 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
4739 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
4740 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
4741 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
4742 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
4743 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
4744 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
4745 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
4746 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
4747 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
4748 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
4752 static struct alc_config_preset alc260_presets
[] = {
4754 .mixers
= { alc260_base_output_mixer
,
4756 alc260_pc_beep_mixer
,
4757 alc260_capture_mixer
},
4758 .init_verbs
= { alc260_init_verbs
},
4759 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4760 .dac_nids
= alc260_dac_nids
,
4761 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
4762 .adc_nids
= alc260_adc_nids
,
4763 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4764 .channel_mode
= alc260_modes
,
4765 .input_mux
= &alc260_capture_source
,
4768 .mixers
= { alc260_base_output_mixer
,
4770 alc260_capture_alt_mixer
},
4771 .init_verbs
= { alc260_init_verbs
},
4772 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4773 .dac_nids
= alc260_dac_nids
,
4774 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
4775 .adc_nids
= alc260_hp_adc_nids
,
4776 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4777 .channel_mode
= alc260_modes
,
4778 .input_mux
= &alc260_capture_source
,
4780 [ALC260_HP_3013
] = {
4781 .mixers
= { alc260_hp_3013_mixer
,
4783 alc260_capture_alt_mixer
},
4784 .init_verbs
= { alc260_hp_3013_init_verbs
},
4785 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4786 .dac_nids
= alc260_dac_nids
,
4787 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
4788 .adc_nids
= alc260_hp_adc_nids
,
4789 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4790 .channel_mode
= alc260_modes
,
4791 .input_mux
= &alc260_capture_source
,
4793 [ALC260_FUJITSU_S702X
] = {
4794 .mixers
= { alc260_fujitsu_mixer
,
4795 alc260_capture_mixer
},
4796 .init_verbs
= { alc260_fujitsu_init_verbs
},
4797 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4798 .dac_nids
= alc260_dac_nids
,
4799 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
4800 .adc_nids
= alc260_dual_adc_nids
,
4801 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4802 .channel_mode
= alc260_modes
,
4803 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
4804 .input_mux
= alc260_fujitsu_capture_sources
,
4807 .mixers
= { alc260_acer_mixer
,
4808 alc260_capture_mixer
},
4809 .init_verbs
= { alc260_acer_init_verbs
},
4810 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4811 .dac_nids
= alc260_dac_nids
,
4812 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
4813 .adc_nids
= alc260_dual_adc_nids
,
4814 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4815 .channel_mode
= alc260_modes
,
4816 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
4817 .input_mux
= alc260_acer_capture_sources
,
4820 .mixers
= { alc260_will_mixer
,
4821 alc260_capture_mixer
},
4822 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
4823 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4824 .dac_nids
= alc260_dac_nids
,
4825 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
4826 .adc_nids
= alc260_adc_nids
,
4827 .dig_out_nid
= ALC260_DIGOUT_NID
,
4828 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4829 .channel_mode
= alc260_modes
,
4830 .input_mux
= &alc260_capture_source
,
4832 [ALC260_REPLACER_672V
] = {
4833 .mixers
= { alc260_replacer_672v_mixer
,
4834 alc260_capture_mixer
},
4835 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
4836 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4837 .dac_nids
= alc260_dac_nids
,
4838 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
4839 .adc_nids
= alc260_adc_nids
,
4840 .dig_out_nid
= ALC260_DIGOUT_NID
,
4841 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4842 .channel_mode
= alc260_modes
,
4843 .input_mux
= &alc260_capture_source
,
4844 .unsol_event
= alc260_replacer_672v_unsol_event
,
4845 .init_hook
= alc260_replacer_672v_automute
,
4847 #ifdef CONFIG_SND_DEBUG
4849 .mixers
= { alc260_test_mixer
,
4850 alc260_capture_mixer
},
4851 .init_verbs
= { alc260_test_init_verbs
},
4852 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
4853 .dac_nids
= alc260_test_dac_nids
,
4854 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
4855 .adc_nids
= alc260_test_adc_nids
,
4856 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4857 .channel_mode
= alc260_modes
,
4858 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
4859 .input_mux
= alc260_test_capture_sources
,
4864 static int patch_alc260(struct hda_codec
*codec
)
4866 struct alc_spec
*spec
;
4867 int err
, board_config
;
4869 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4875 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
4878 if (board_config
< 0) {
4879 snd_printd(KERN_INFO
"hda_codec: Unknown model for ALC260, "
4880 "trying auto-probe from BIOS...\n");
4881 board_config
= ALC260_AUTO
;
4884 if (board_config
== ALC260_AUTO
) {
4885 /* automatic parse from the BIOS config */
4886 err
= alc260_parse_auto_config(codec
);
4892 "hda_codec: Cannot set up configuration "
4893 "from BIOS. Using base mode...\n");
4894 board_config
= ALC260_BASIC
;
4898 if (board_config
!= ALC260_AUTO
)
4899 setup_preset(spec
, &alc260_presets
[board_config
]);
4901 spec
->stream_name_analog
= "ALC260 Analog";
4902 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
4903 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
4905 spec
->stream_name_digital
= "ALC260 Digital";
4906 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
4907 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
4909 codec
->patch_ops
= alc_patch_ops
;
4910 if (board_config
== ALC260_AUTO
)
4911 spec
->init_hook
= alc260_auto_init
;
4912 #ifdef CONFIG_SND_HDA_POWER_SAVE
4913 if (!spec
->loopback
.amplist
)
4914 spec
->loopback
.amplist
= alc260_loopbacks
;
4924 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
4925 * configuration. Each pin widget can choose any input DACs and a mixer.
4926 * Each ADC is connected from a mixer of all inputs. This makes possible
4927 * 6-channel independent captures.
4929 * In addition, an independent DAC for the multi-playback (not used in this
4932 #define ALC882_DIGOUT_NID 0x06
4933 #define ALC882_DIGIN_NID 0x0a
4935 static struct hda_channel_mode alc882_ch_modes
[1] = {
4939 static hda_nid_t alc882_dac_nids
[4] = {
4940 /* front, rear, clfe, rear_surr */
4941 0x02, 0x03, 0x04, 0x05
4944 /* identical with ALC880 */
4945 #define alc882_adc_nids alc880_adc_nids
4946 #define alc882_adc_nids_alt alc880_adc_nids_alt
4949 /* FIXME: should be a matrix-type input source selection */
4951 static struct hda_input_mux alc882_capture_source
= {
4955 { "Front Mic", 0x1 },
4960 #define alc882_mux_enum_info alc_mux_enum_info
4961 #define alc882_mux_enum_get alc_mux_enum_get
4963 static int alc882_mux_enum_put(struct snd_kcontrol
*kcontrol
,
4964 struct snd_ctl_elem_value
*ucontrol
)
4966 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4967 struct alc_spec
*spec
= codec
->spec
;
4968 const struct hda_input_mux
*imux
= spec
->input_mux
;
4969 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
4970 static hda_nid_t capture_mixers
[3] = { 0x24, 0x23, 0x22 };
4971 hda_nid_t nid
= capture_mixers
[adc_idx
];
4972 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
4973 unsigned int i
, idx
;
4975 idx
= ucontrol
->value
.enumerated
.item
[0];
4976 if (idx
>= imux
->num_items
)
4977 idx
= imux
->num_items
- 1;
4978 if (*cur_val
== idx
)
4980 for (i
= 0; i
< imux
->num_items
; i
++) {
4981 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
4982 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
4983 imux
->items
[i
].index
,
4993 static struct hda_verb alc882_3ST_ch2_init
[] = {
4994 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4995 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4996 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4997 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5004 static struct hda_verb alc882_3ST_ch6_init
[] = {
5005 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5006 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5007 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
5008 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5009 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5010 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5014 static struct hda_channel_mode alc882_3ST_6ch_modes
[2] = {
5015 { 2, alc882_3ST_ch2_init
},
5016 { 6, alc882_3ST_ch6_init
},
5022 static struct hda_verb alc882_sixstack_ch6_init
[] = {
5023 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
5024 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5025 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5026 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5033 static struct hda_verb alc882_sixstack_ch8_init
[] = {
5034 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5035 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5036 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5037 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5041 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
5042 { 6, alc882_sixstack_ch6_init
},
5043 { 8, alc882_sixstack_ch8_init
},
5047 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5053 static struct hda_verb alc885_mbp_ch2_init
[] = {
5054 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5055 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5056 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5063 static struct hda_verb alc885_mbp_ch6_init
[] = {
5064 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5065 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5066 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5067 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5068 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5072 static struct hda_channel_mode alc885_mbp_6ch_modes
[2] = {
5073 { 2, alc885_mbp_ch2_init
},
5074 { 6, alc885_mbp_ch6_init
},
5078 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5079 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5081 static struct snd_kcontrol_new alc882_base_mixer
[] = {
5082 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5083 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5084 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5085 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5086 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5087 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5088 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5089 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5090 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
5091 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
5092 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5093 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5094 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5095 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5096 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5098 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5099 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5100 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5101 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5102 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5103 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5104 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5108 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
5109 HDA_CODEC_VOLUME("Master Volume", 0x0c, 0x00, HDA_OUTPUT
),
5110 HDA_BIND_MUTE ("Master Switch", 0x0c, 0x02, HDA_INPUT
),
5111 HDA_CODEC_MUTE ("Speaker Switch", 0x14, 0x00, HDA_OUTPUT
),
5112 HDA_CODEC_VOLUME("Line Out Volume", 0x0d,0x00, HDA_OUTPUT
),
5113 HDA_CODEC_VOLUME("Line In Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5114 HDA_CODEC_MUTE ("Line In Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5115 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
5116 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
5117 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0x00, HDA_INPUT
),
5118 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
5121 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
5122 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5123 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5124 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5125 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5126 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5127 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5129 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5131 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5132 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5136 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
5137 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5138 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5139 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5140 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5141 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5142 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5143 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5145 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5146 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5147 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5148 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5149 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5153 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5154 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5156 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
5157 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5158 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5159 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5160 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
5161 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5162 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5163 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5164 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5165 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
5166 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
5167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5168 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5169 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5173 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
5174 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5175 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5176 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5177 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5178 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5179 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5180 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5182 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5183 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5184 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5185 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5189 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
5191 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5192 .name
= "Channel Mode",
5193 .info
= alc_ch_mode_info
,
5194 .get
= alc_ch_mode_get
,
5195 .put
= alc_ch_mode_put
,
5200 static struct hda_verb alc882_init_verbs
[] = {
5201 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5202 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5203 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5204 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5206 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5207 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5208 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5210 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5211 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5212 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5214 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5215 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5216 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5218 /* Front Pin: output 0 (0x0c) */
5219 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5220 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5221 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5222 /* Rear Pin: output 1 (0x0d) */
5223 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5224 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5225 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5226 /* CLFE Pin: output 2 (0x0e) */
5227 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5228 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5229 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
5230 /* Side Pin: output 3 (0x0f) */
5231 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5232 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5233 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
5234 /* Mic (rear) pin: input vref at 80% */
5235 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5236 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5237 /* Front Mic pin: input vref at 80% */
5238 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5239 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5240 /* Line In pin: input */
5241 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5242 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5243 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5244 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5245 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5246 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5247 /* CD pin widget for input */
5248 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5250 /* FIXME: use matrix-type input source selection */
5251 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5252 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5253 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5254 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5255 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5256 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5258 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5260 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5261 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5267 /* ADC1: mute amp left and right */
5268 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5269 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5270 /* ADC2: mute amp left and right */
5271 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5272 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5273 /* ADC3: mute amp left and right */
5274 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5275 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5280 static struct hda_verb alc882_eapd_verbs
[] = {
5281 /* change to EAPD mode */
5282 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
5283 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
5288 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
5289 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5290 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5291 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
5292 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5293 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5294 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5295 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5299 static struct hda_verb alc882_macpro_init_verbs
[] = {
5300 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5304 /* Front Pin: output 0 (0x0c) */
5305 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5307 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5308 /* Front Mic pin: input vref at 80% */
5309 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5310 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5311 /* Speaker: output */
5312 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5313 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5314 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
5315 /* Headphone output (output 0 - 0x0c) */
5316 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5317 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5318 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5320 /* FIXME: use matrix-type input source selection */
5321 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5322 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5323 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5326 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5328 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5330 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5331 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5333 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5337 /* ADC1: mute amp left and right */
5338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5339 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5340 /* ADC2: mute amp left and right */
5341 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5342 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5343 /* ADC3: mute amp left and right */
5344 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5345 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5350 /* Macbook Pro rev3 */
5351 static struct hda_verb alc885_mbp3_init_verbs
[] = {
5352 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5354 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5355 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5357 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5358 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5359 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5360 /* Front Pin: output 0 (0x0c) */
5361 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5362 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5363 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5364 /* HP Pin: output 0 (0x0d) */
5365 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
5366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5367 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5368 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5369 /* Mic (rear) pin: input vref at 80% */
5370 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5371 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5372 /* Front Mic pin: input vref at 80% */
5373 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5374 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5375 /* Line In pin: use output 1 when in LineOut mode */
5376 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5377 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5378 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
5380 /* FIXME: use matrix-type input source selection */
5381 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5382 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5383 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5388 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5389 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5390 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5391 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5393 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5394 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5395 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5397 /* ADC1: mute amp left and right */
5398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5399 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5400 /* ADC2: mute amp left and right */
5401 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5402 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5403 /* ADC3: mute amp left and right */
5404 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5405 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5410 /* iMac 24 mixer. */
5411 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
5412 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
5413 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
5417 /* iMac 24 init verbs. */
5418 static struct hda_verb alc885_imac24_init_verbs
[] = {
5419 /* Internal speakers: output 0 (0x0c) */
5420 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5421 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5422 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5423 /* Internal speakers: output 0 (0x0c) */
5424 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5425 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5426 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
5427 /* Headphone: output 0 (0x0c) */
5428 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5429 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5430 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5431 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5432 /* Front Mic: input vref at 80% */
5433 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5434 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5438 /* Toggle speaker-output according to the hp-jack state */
5439 static void alc885_imac24_automute(struct hda_codec
*codec
)
5441 unsigned int present
;
5443 present
= snd_hda_codec_read(codec
, 0x14, 0,
5444 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5445 snd_hda_codec_amp_stereo(codec
, 0x18, HDA_OUTPUT
, 0,
5446 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5447 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_OUTPUT
, 0,
5448 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5451 /* Processes unsolicited events. */
5452 static void alc885_imac24_unsol_event(struct hda_codec
*codec
,
5455 /* Headphone insertion or removal. */
5456 if ((res
>> 26) == ALC880_HP_EVENT
)
5457 alc885_imac24_automute(codec
);
5460 static void alc885_mbp3_automute(struct hda_codec
*codec
)
5462 unsigned int present
;
5464 present
= snd_hda_codec_read(codec
, 0x15, 0,
5465 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5466 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
5467 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5468 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
5469 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
5472 static void alc885_mbp3_unsol_event(struct hda_codec
*codec
,
5475 /* Headphone insertion or removal. */
5476 if ((res
>> 26) == ALC880_HP_EVENT
)
5477 alc885_mbp3_automute(codec
);
5481 static struct hda_verb alc882_targa_verbs
[] = {
5482 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5483 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5486 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5488 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5489 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5490 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5492 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5493 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
5494 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
5495 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
5499 /* toggle speaker-output according to the hp-jack state */
5500 static void alc882_targa_automute(struct hda_codec
*codec
)
5502 unsigned int present
;
5504 present
= snd_hda_codec_read(codec
, 0x14, 0,
5505 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5506 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
5507 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5508 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
5512 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
5514 /* Looks like the unsol event is incompatible with the standard
5515 * definition. 4bit tag is placed at 26 bit!
5517 if (((res
>> 26) == ALC880_HP_EVENT
)) {
5518 alc882_targa_automute(codec
);
5522 static struct hda_verb alc882_asus_a7j_verbs
[] = {
5523 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5524 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5527 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5528 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5530 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5531 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5532 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5534 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5535 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5536 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5540 static struct hda_verb alc882_asus_a7m_verbs
[] = {
5541 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5544 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5545 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5546 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5548 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5549 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5550 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5552 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5553 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5554 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5558 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
5560 unsigned int gpiostate
, gpiomask
, gpiodir
;
5562 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5563 AC_VERB_GET_GPIO_DATA
, 0);
5566 gpiostate
|= (1 << pin
);
5568 gpiostate
&= ~(1 << pin
);
5570 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5571 AC_VERB_GET_GPIO_MASK
, 0);
5572 gpiomask
|= (1 << pin
);
5574 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5575 AC_VERB_GET_GPIO_DIRECTION
, 0);
5576 gpiodir
|= (1 << pin
);
5579 snd_hda_codec_write(codec
, codec
->afg
, 0,
5580 AC_VERB_SET_GPIO_MASK
, gpiomask
);
5581 snd_hda_codec_write(codec
, codec
->afg
, 0,
5582 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
5586 snd_hda_codec_write(codec
, codec
->afg
, 0,
5587 AC_VERB_SET_GPIO_DATA
, gpiostate
);
5590 /* set up GPIO at initialization */
5591 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
5593 alc882_gpio_mute(codec
, 0, 0);
5594 alc882_gpio_mute(codec
, 1, 0);
5597 /* set up GPIO and update auto-muting at initialization */
5598 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
5600 alc885_macpro_init_hook(codec
);
5601 alc885_imac24_automute(codec
);
5605 * generic initialization of ADC, input mixers and output mixers
5607 static struct hda_verb alc882_auto_init_verbs
[] = {
5609 * Unmute ADC0-2 and set the default input to mic-in
5611 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5612 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5613 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5614 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5615 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5616 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5618 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5620 * Note: PASD motherboards uses the Line In 2 as the input for
5621 * front panel mic (mic 2)
5623 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5631 * Set up output mixers (0x0c - 0x0f)
5633 /* set vol=0 to output mixers */
5634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5635 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5636 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5637 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5638 /* set up input amps for analog loopback */
5639 /* Amp Indices: DAC = 0, mixer = 1 */
5640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5642 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5646 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5648 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5649 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5651 /* FIXME: use matrix-type input source selection */
5652 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5653 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5654 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5656 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5659 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5662 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5665 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5666 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5672 /* capture mixer elements */
5673 static struct snd_kcontrol_new alc882_capture_alt_mixer
[] = {
5674 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5675 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5676 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5677 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5679 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5680 /* The multiple "Capture Source" controls confuse alsamixer
5681 * So call somewhat different..
5682 * FIXME: the controls appear in the "playback" view!
5684 /* .name = "Capture Source", */
5685 .name
= "Input Source",
5687 .info
= alc882_mux_enum_info
,
5688 .get
= alc882_mux_enum_get
,
5689 .put
= alc882_mux_enum_put
,
5694 static struct snd_kcontrol_new alc882_capture_mixer
[] = {
5695 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
5696 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
5697 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
5698 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
5699 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
5700 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
5702 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5703 /* The multiple "Capture Source" controls confuse alsamixer
5704 * So call somewhat different..
5705 * FIXME: the controls appear in the "playback" view!
5707 /* .name = "Capture Source", */
5708 .name
= "Input Source",
5710 .info
= alc882_mux_enum_info
,
5711 .get
= alc882_mux_enum_get
,
5712 .put
= alc882_mux_enum_put
,
5717 #ifdef CONFIG_SND_HDA_POWER_SAVE
5718 #define alc882_loopbacks alc880_loopbacks
5721 /* pcm configuration: identiacal with ALC880 */
5722 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
5723 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
5724 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
5725 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
5728 * configuration and preset
5730 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
5731 [ALC882_3ST_DIG
] = "3stack-dig",
5732 [ALC882_6ST_DIG
] = "6stack-dig",
5733 [ALC882_ARIMA
] = "arima",
5734 [ALC882_W2JC
] = "w2jc",
5735 [ALC882_TARGA
] = "targa",
5736 [ALC882_ASUS_A7J
] = "asus-a7j",
5737 [ALC882_ASUS_A7M
] = "asus-a7m",
5738 [ALC885_MACPRO
] = "macpro",
5739 [ALC885_MBP3
] = "mbp3",
5740 [ALC885_IMAC24
] = "imac24",
5741 [ALC882_AUTO
] = "auto",
5744 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
5745 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
5746 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
5747 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
5748 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
5749 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA
),
5750 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
5751 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
5752 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
5753 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
5754 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
5755 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
5759 static struct alc_config_preset alc882_presets
[] = {
5760 [ALC882_3ST_DIG
] = {
5761 .mixers
= { alc882_base_mixer
},
5762 .init_verbs
= { alc882_init_verbs
},
5763 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5764 .dac_nids
= alc882_dac_nids
,
5765 .dig_out_nid
= ALC882_DIGOUT_NID
,
5766 .dig_in_nid
= ALC882_DIGIN_NID
,
5767 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
5768 .channel_mode
= alc882_ch_modes
,
5770 .input_mux
= &alc882_capture_source
,
5772 [ALC882_6ST_DIG
] = {
5773 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
5774 .init_verbs
= { alc882_init_verbs
},
5775 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5776 .dac_nids
= alc882_dac_nids
,
5777 .dig_out_nid
= ALC882_DIGOUT_NID
,
5778 .dig_in_nid
= ALC882_DIGIN_NID
,
5779 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
5780 .channel_mode
= alc882_sixstack_modes
,
5781 .input_mux
= &alc882_capture_source
,
5784 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
5785 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
},
5786 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5787 .dac_nids
= alc882_dac_nids
,
5788 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
5789 .channel_mode
= alc882_sixstack_modes
,
5790 .input_mux
= &alc882_capture_source
,
5793 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
5794 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
5795 alc880_gpio1_init_verbs
},
5796 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5797 .dac_nids
= alc882_dac_nids
,
5798 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
5799 .channel_mode
= alc880_threestack_modes
,
5801 .input_mux
= &alc882_capture_source
,
5802 .dig_out_nid
= ALC882_DIGOUT_NID
,
5805 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
5806 .init_verbs
= { alc885_mbp3_init_verbs
,
5807 alc880_gpio1_init_verbs
},
5808 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5809 .dac_nids
= alc882_dac_nids
,
5810 .channel_mode
= alc885_mbp_6ch_modes
,
5811 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_6ch_modes
),
5812 .input_mux
= &alc882_capture_source
,
5813 .dig_out_nid
= ALC882_DIGOUT_NID
,
5814 .dig_in_nid
= ALC882_DIGIN_NID
,
5815 .unsol_event
= alc885_mbp3_unsol_event
,
5816 .init_hook
= alc885_mbp3_automute
,
5819 .mixers
= { alc882_macpro_mixer
},
5820 .init_verbs
= { alc882_macpro_init_verbs
},
5821 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5822 .dac_nids
= alc882_dac_nids
,
5823 .dig_out_nid
= ALC882_DIGOUT_NID
,
5824 .dig_in_nid
= ALC882_DIGIN_NID
,
5825 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
5826 .channel_mode
= alc882_ch_modes
,
5827 .input_mux
= &alc882_capture_source
,
5828 .init_hook
= alc885_macpro_init_hook
,
5831 .mixers
= { alc885_imac24_mixer
},
5832 .init_verbs
= { alc885_imac24_init_verbs
},
5833 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5834 .dac_nids
= alc882_dac_nids
,
5835 .dig_out_nid
= ALC882_DIGOUT_NID
,
5836 .dig_in_nid
= ALC882_DIGIN_NID
,
5837 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
5838 .channel_mode
= alc882_ch_modes
,
5839 .input_mux
= &alc882_capture_source
,
5840 .unsol_event
= alc885_imac24_unsol_event
,
5841 .init_hook
= alc885_imac24_init_hook
,
5844 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
,
5845 alc882_capture_mixer
},
5846 .init_verbs
= { alc882_init_verbs
, alc882_targa_verbs
},
5847 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5848 .dac_nids
= alc882_dac_nids
,
5849 .dig_out_nid
= ALC882_DIGOUT_NID
,
5850 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
5851 .adc_nids
= alc882_adc_nids
,
5852 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
5853 .channel_mode
= alc882_3ST_6ch_modes
,
5855 .input_mux
= &alc882_capture_source
,
5856 .unsol_event
= alc882_targa_unsol_event
,
5857 .init_hook
= alc882_targa_automute
,
5859 [ALC882_ASUS_A7J
] = {
5860 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
,
5861 alc882_capture_mixer
},
5862 .init_verbs
= { alc882_init_verbs
, alc882_asus_a7j_verbs
},
5863 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5864 .dac_nids
= alc882_dac_nids
,
5865 .dig_out_nid
= ALC882_DIGOUT_NID
,
5866 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
5867 .adc_nids
= alc882_adc_nids
,
5868 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
5869 .channel_mode
= alc882_3ST_6ch_modes
,
5871 .input_mux
= &alc882_capture_source
,
5873 [ALC882_ASUS_A7M
] = {
5874 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
5875 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
5876 alc880_gpio1_init_verbs
,
5877 alc882_asus_a7m_verbs
},
5878 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
5879 .dac_nids
= alc882_dac_nids
,
5880 .dig_out_nid
= ALC882_DIGOUT_NID
,
5881 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
5882 .channel_mode
= alc880_threestack_modes
,
5884 .input_mux
= &alc882_capture_source
,
5893 PINFIX_ABIT_AW9D_MAX
5896 static struct alc_pincfg alc882_abit_aw9d_pinfix
[] = {
5897 { 0x15, 0x01080104 }, /* side */
5898 { 0x16, 0x01011012 }, /* rear */
5899 { 0x17, 0x01016011 }, /* clfe */
5903 static const struct alc_pincfg
*alc882_pin_fixes
[] = {
5904 [PINFIX_ABIT_AW9D_MAX
] = alc882_abit_aw9d_pinfix
,
5907 static struct snd_pci_quirk alc882_pinfix_tbl
[] = {
5908 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
5913 * BIOS auto configuration
5915 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
5916 hda_nid_t nid
, int pin_type
,
5920 struct alc_spec
*spec
= codec
->spec
;
5923 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
5926 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
5928 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5930 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
5932 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
5936 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
5938 struct alc_spec
*spec
= codec
->spec
;
5941 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
5942 for (i
= 0; i
<= HDA_SIDE
; i
++) {
5943 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
5944 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
5946 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
5951 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
5953 struct alc_spec
*spec
= codec
->spec
;
5956 pin
= spec
->autocfg
.hp_pins
[0];
5957 if (pin
) /* connect to front */
5959 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
5962 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
5963 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
5965 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
5967 struct alc_spec
*spec
= codec
->spec
;
5970 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5971 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5972 if (alc882_is_input_pin(nid
)) {
5973 snd_hda_codec_write(codec
, nid
, 0,
5974 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5975 i
<= AUTO_PIN_FRONT_MIC
?
5976 PIN_VREF80
: PIN_IN
);
5977 if (nid
!= ALC882_PIN_CD_NID
)
5978 snd_hda_codec_write(codec
, nid
, 0,
5979 AC_VERB_SET_AMP_GAIN_MUTE
,
5985 /* add mic boosts if needed */
5986 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
5988 struct alc_spec
*spec
= codec
->spec
;
5992 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
5994 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
5996 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6000 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
6002 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6004 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6011 /* almost identical with ALC880 parser... */
6012 static int alc882_parse_auto_config(struct hda_codec
*codec
)
6014 struct alc_spec
*spec
= codec
->spec
;
6015 int err
= alc880_parse_auto_config(codec
);
6020 return 0; /* no config found */
6022 err
= alc_auto_add_mic_boost(codec
);
6026 /* hack - override the init verbs */
6027 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
6029 return 1; /* config found */
6032 /* additional initialization for auto-configuration model */
6033 static void alc882_auto_init(struct hda_codec
*codec
)
6035 alc882_auto_init_multi_out(codec
);
6036 alc882_auto_init_hp_out(codec
);
6037 alc882_auto_init_analog_input(codec
);
6040 static int patch_alc882(struct hda_codec
*codec
)
6042 struct alc_spec
*spec
;
6043 int err
, board_config
;
6045 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6051 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
6055 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
6056 /* Pick up systems that don't supply PCI SSID */
6057 switch (codec
->subsystem_id
) {
6058 case 0x106b0c00: /* Mac Pro */
6059 board_config
= ALC885_MACPRO
;
6061 case 0x106b1000: /* iMac 24 */
6062 board_config
= ALC885_IMAC24
;
6064 case 0x106b2c00: /* Macbook Pro rev3 */
6065 board_config
= ALC885_MBP3
;
6068 printk(KERN_INFO
"hda_codec: Unknown model for ALC882, "
6069 "trying auto-probe from BIOS...\n");
6070 board_config
= ALC882_AUTO
;
6074 alc_fix_pincfg(codec
, alc882_pinfix_tbl
, alc882_pin_fixes
);
6076 if (board_config
== ALC882_AUTO
) {
6077 /* automatic parse from the BIOS config */
6078 err
= alc882_parse_auto_config(codec
);
6084 "hda_codec: Cannot set up configuration "
6085 "from BIOS. Using base mode...\n");
6086 board_config
= ALC882_3ST_DIG
;
6090 if (board_config
!= ALC882_AUTO
)
6091 setup_preset(spec
, &alc882_presets
[board_config
]);
6093 spec
->stream_name_analog
= "ALC882 Analog";
6094 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
6095 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
6097 spec
->stream_name_digital
= "ALC882 Digital";
6098 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
6099 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
6101 if (!spec
->adc_nids
&& spec
->input_mux
) {
6102 /* check whether NID 0x07 is valid */
6103 unsigned int wcap
= get_wcaps(codec
, 0x07);
6105 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
6106 if (wcap
!= AC_WID_AUD_IN
) {
6107 spec
->adc_nids
= alc882_adc_nids_alt
;
6108 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
6109 spec
->mixers
[spec
->num_mixers
] =
6110 alc882_capture_alt_mixer
;
6113 spec
->adc_nids
= alc882_adc_nids
;
6114 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
6115 spec
->mixers
[spec
->num_mixers
] = alc882_capture_mixer
;
6120 codec
->patch_ops
= alc_patch_ops
;
6121 if (board_config
== ALC882_AUTO
)
6122 spec
->init_hook
= alc882_auto_init
;
6123 #ifdef CONFIG_SND_HDA_POWER_SAVE
6124 if (!spec
->loopback
.amplist
)
6125 spec
->loopback
.amplist
= alc882_loopbacks
;
6134 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6135 * configuration. Each pin widget can choose any input DACs and a mixer.
6136 * Each ADC is connected from a mixer of all inputs. This makes possible
6137 * 6-channel independent captures.
6139 * In addition, an independent DAC for the multi-playback (not used in this
6142 #define ALC883_DIGOUT_NID 0x06
6143 #define ALC883_DIGIN_NID 0x0a
6145 static hda_nid_t alc883_dac_nids
[4] = {
6146 /* front, rear, clfe, rear_surr */
6147 0x02, 0x04, 0x03, 0x05
6150 static hda_nid_t alc883_adc_nids
[2] = {
6156 /* FIXME: should be a matrix-type input source selection */
6158 static struct hda_input_mux alc883_capture_source
= {
6162 { "Front Mic", 0x1 },
6168 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
6176 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
6186 #define alc883_mux_enum_info alc_mux_enum_info
6187 #define alc883_mux_enum_get alc_mux_enum_get
6189 static int alc883_mux_enum_put(struct snd_kcontrol
*kcontrol
,
6190 struct snd_ctl_elem_value
*ucontrol
)
6192 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6193 struct alc_spec
*spec
= codec
->spec
;
6194 const struct hda_input_mux
*imux
= spec
->input_mux
;
6195 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
6196 static hda_nid_t capture_mixers
[3] = { 0x24, 0x23, 0x22 };
6197 hda_nid_t nid
= capture_mixers
[adc_idx
];
6198 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
6199 unsigned int i
, idx
;
6201 idx
= ucontrol
->value
.enumerated
.item
[0];
6202 if (idx
>= imux
->num_items
)
6203 idx
= imux
->num_items
- 1;
6204 if (*cur_val
== idx
)
6206 for (i
= 0; i
< imux
->num_items
; i
++) {
6207 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
6208 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
6209 imux
->items
[i
].index
,
6219 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
6226 static struct hda_verb alc883_3ST_ch2_init
[] = {
6227 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6228 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6229 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6230 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6237 static struct hda_verb alc883_3ST_ch4_init
[] = {
6238 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6239 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6240 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6241 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6242 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6249 static struct hda_verb alc883_3ST_ch6_init
[] = {
6250 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6251 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6252 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6253 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6254 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6255 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6259 static struct hda_channel_mode alc883_3ST_6ch_modes
[3] = {
6260 { 2, alc883_3ST_ch2_init
},
6261 { 4, alc883_3ST_ch4_init
},
6262 { 6, alc883_3ST_ch6_init
},
6268 static struct hda_verb alc883_sixstack_ch6_init
[] = {
6269 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6270 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6271 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6272 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6279 static struct hda_verb alc883_sixstack_ch8_init
[] = {
6280 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6281 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6282 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6283 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6287 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
6288 { 6, alc883_sixstack_ch6_init
},
6289 { 8, alc883_sixstack_ch8_init
},
6292 static struct hda_verb alc883_medion_eapd_verbs
[] = {
6293 /* eanable EAPD on medion laptop */
6294 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
6295 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
6299 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6300 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6303 static struct snd_kcontrol_new alc883_base_mixer
[] = {
6304 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6305 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6306 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6307 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6308 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6309 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6310 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6311 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6312 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
6313 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
6314 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6315 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6316 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6317 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6318 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6319 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6320 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6321 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6322 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6323 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6324 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6325 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6326 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6327 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6328 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6329 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6330 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6332 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6333 /* .name = "Capture Source", */
6334 .name
= "Input Source",
6336 .info
= alc883_mux_enum_info
,
6337 .get
= alc883_mux_enum_get
,
6338 .put
= alc883_mux_enum_put
,
6343 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
6344 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6345 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6346 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6347 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6348 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6349 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6350 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6352 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6354 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6355 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6356 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6357 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6358 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6359 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6360 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6361 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6362 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6364 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6365 /* .name = "Capture Source", */
6366 .name
= "Input Source",
6368 .info
= alc883_mux_enum_info
,
6369 .get
= alc883_mux_enum_get
,
6370 .put
= alc883_mux_enum_put
,
6375 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
6376 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6377 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6378 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6379 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6380 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6381 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6382 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6383 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6384 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6385 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6386 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6387 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6388 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6390 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6391 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6392 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6393 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6394 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6395 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6396 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6397 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6398 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6399 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6400 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6402 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6403 /* .name = "Capture Source", */
6404 .name
= "Input Source",
6406 .info
= alc883_mux_enum_info
,
6407 .get
= alc883_mux_enum_get
,
6408 .put
= alc883_mux_enum_put
,
6413 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
6414 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6415 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6416 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6417 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6418 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6419 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6420 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT
),
6421 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
6422 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6423 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6424 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6425 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6426 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6427 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6428 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6430 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6431 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6432 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6433 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6434 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6435 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6436 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6439 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6440 /* .name = "Capture Source", */
6441 .name
= "Input Source",
6443 .info
= alc883_mux_enum_info
,
6444 .get
= alc883_mux_enum_get
,
6445 .put
= alc883_mux_enum_put
,
6450 static struct snd_kcontrol_new alc883_tagra_mixer
[] = {
6451 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6452 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6453 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6454 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6455 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6456 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6457 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6458 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6459 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6460 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6461 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6462 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6463 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6464 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6465 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6466 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6467 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6468 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6469 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6470 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6472 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6473 /* .name = "Capture Source", */
6474 .name
= "Input Source",
6476 .info
= alc883_mux_enum_info
,
6477 .get
= alc883_mux_enum_get
,
6478 .put
= alc883_mux_enum_put
,
6483 static struct snd_kcontrol_new alc883_tagra_2ch_mixer
[] = {
6484 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6485 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6486 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6487 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6488 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6489 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6490 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6491 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6492 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6493 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6494 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6495 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6497 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6498 /* .name = "Capture Source", */
6499 .name
= "Input Source",
6501 .info
= alc883_mux_enum_info
,
6502 .get
= alc883_mux_enum_get
,
6503 .put
= alc883_mux_enum_put
,
6508 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
6509 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6510 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6511 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6512 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT
),
6513 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6515 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6516 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6517 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6518 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6520 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6521 /* .name = "Capture Source", */
6522 .name
= "Input Source",
6524 .info
= alc883_mux_enum_info
,
6525 .get
= alc883_mux_enum_get
,
6526 .put
= alc883_mux_enum_put
,
6531 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
6532 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6533 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
6534 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6535 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6536 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6537 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6538 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6539 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6540 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6541 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6542 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6543 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6544 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6546 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6547 /* .name = "Capture Source", */
6548 .name
= "Input Source",
6550 .info
= alc883_mux_enum_info
,
6551 .get
= alc883_mux_enum_get
,
6552 .put
= alc883_mux_enum_put
,
6557 static struct snd_kcontrol_new alc883_medion_md2_mixer
[] = {
6558 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6559 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6560 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6561 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6562 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6563 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6564 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6565 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6566 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6567 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6568 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6569 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6570 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6572 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6573 /* .name = "Capture Source", */
6574 .name
= "Input Source",
6576 .info
= alc883_mux_enum_info
,
6577 .get
= alc883_mux_enum_get
,
6578 .put
= alc883_mux_enum_put
,
6583 static struct snd_kcontrol_new alc888_6st_hp_mixer
[] = {
6584 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6585 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6586 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
6587 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
6588 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
6589 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
6590 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
6591 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
6592 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
6593 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
6594 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6595 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6596 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6597 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6598 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6599 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6600 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6601 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6602 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6603 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6604 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6605 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6606 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6607 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6608 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6609 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6610 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6612 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6613 /* .name = "Capture Source", */
6614 .name
= "Input Source",
6616 .info
= alc883_mux_enum_info
,
6617 .get
= alc883_mux_enum_get
,
6618 .put
= alc883_mux_enum_put
,
6623 static struct snd_kcontrol_new alc888_3st_hp_mixer
[] = {
6624 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6625 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6626 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
6627 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
6628 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
6629 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
6630 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
6631 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
6632 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6633 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6634 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6635 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6636 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6637 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6638 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6639 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6640 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6641 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6642 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6643 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6644 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6645 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6646 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6647 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6648 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6650 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6651 /* .name = "Capture Source", */
6652 .name
= "Input Source",
6654 .info
= alc883_mux_enum_info
,
6655 .get
= alc883_mux_enum_get
,
6656 .put
= alc883_mux_enum_put
,
6661 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
6662 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6663 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6665 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6666 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6667 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6668 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6669 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6670 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6671 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6672 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6673 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6675 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6676 /* .name = "Capture Source", */
6677 .name
= "Input Source",
6679 .info
= alc883_mux_enum_info
,
6680 .get
= alc883_mux_enum_get
,
6681 .put
= alc883_mux_enum_put
,
6686 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
6688 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6689 .name
= "Channel Mode",
6690 .info
= alc_ch_mode_info
,
6691 .get
= alc_ch_mode_get
,
6692 .put
= alc_ch_mode_put
,
6697 static struct hda_verb alc883_init_verbs
[] = {
6698 /* ADC1: mute amp left and right */
6699 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6700 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6701 /* ADC2: mute amp left and right */
6702 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6703 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6704 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6705 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6706 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6707 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6709 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6710 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6711 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6713 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6714 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6715 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6717 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6718 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6719 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6721 /* mute analog input loopbacks */
6722 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6723 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6724 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
6725 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
6726 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
6728 /* Front Pin: output 0 (0x0c) */
6729 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6730 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6731 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
6732 /* Rear Pin: output 1 (0x0d) */
6733 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6734 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6735 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
6736 /* CLFE Pin: output 2 (0x0e) */
6737 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6738 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6739 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
6740 /* Side Pin: output 3 (0x0f) */
6741 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6742 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6743 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
6744 /* Mic (rear) pin: input vref at 80% */
6745 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6746 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6747 /* Front Mic pin: input vref at 80% */
6748 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6749 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6750 /* Line In pin: input */
6751 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6752 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6753 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6754 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6755 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6756 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6757 /* CD pin widget for input */
6758 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6760 /* FIXME: use matrix-type input source selection */
6761 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6763 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6764 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6765 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6766 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
6768 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6769 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6770 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
6775 static struct hda_verb alc883_tagra_verbs
[] = {
6776 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6777 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6779 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6780 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6782 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
6783 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
6784 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
6786 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6787 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
6788 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
6789 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
6794 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
6795 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6796 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
6797 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
6801 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
6802 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6803 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6804 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6805 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6809 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
6810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6812 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6813 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
6814 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6818 static struct hda_verb alc883_haier_w66_verbs
[] = {
6819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6820 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6822 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6824 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6825 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6826 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6827 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6831 static struct hda_verb alc888_6st_hp_verbs
[] = {
6832 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
6833 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* Rear : output 2 (0x0e) */
6834 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* CLFE : output 1 (0x0d) */
6835 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* Side : output 3 (0x0f) */
6839 static struct hda_verb alc888_3st_hp_verbs
[] = {
6840 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
6841 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
6842 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
6846 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
6847 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6848 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6849 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6850 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6854 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
6855 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6856 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6857 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6858 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6862 static struct hda_channel_mode alc888_3st_hp_modes
[2] = {
6863 { 2, alc888_3st_hp_2ch_init
},
6864 { 6, alc888_3st_hp_6ch_init
},
6867 /* toggle front-jack and RCA according to the hp-jack state */
6868 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
6870 unsigned int present
;
6872 present
= snd_hda_codec_read(codec
, 0x1b, 0,
6873 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6874 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
6875 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6876 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
6877 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6880 /* toggle RCA according to the front-jack state */
6881 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
6883 unsigned int present
;
6885 present
= snd_hda_codec_read(codec
, 0x14, 0,
6886 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6887 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
6888 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6891 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
6894 if ((res
>> 26) == ALC880_HP_EVENT
)
6895 alc888_lenovo_ms7195_front_automute(codec
);
6896 if ((res
>> 26) == ALC880_FRONT_EVENT
)
6897 alc888_lenovo_ms7195_rca_automute(codec
);
6900 static struct hda_verb alc883_medion_md2_verbs
[] = {
6901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6904 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6906 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
6910 /* toggle speaker-output according to the hp-jack state */
6911 static void alc883_medion_md2_automute(struct hda_codec
*codec
)
6913 unsigned int present
;
6915 present
= snd_hda_codec_read(codec
, 0x14, 0,
6916 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6917 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
6918 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
6921 static void alc883_medion_md2_unsol_event(struct hda_codec
*codec
,
6924 if ((res
>> 26) == ALC880_HP_EVENT
)
6925 alc883_medion_md2_automute(codec
);
6928 /* toggle speaker-output according to the hp-jack state */
6929 static void alc883_tagra_automute(struct hda_codec
*codec
)
6931 unsigned int present
;
6934 present
= snd_hda_codec_read(codec
, 0x14, 0,
6935 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6936 bits
= present
? HDA_AMP_MUTE
: 0;
6937 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
6938 HDA_AMP_MUTE
, bits
);
6939 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
6943 static void alc883_tagra_unsol_event(struct hda_codec
*codec
, unsigned int res
)
6945 if ((res
>> 26) == ALC880_HP_EVENT
)
6946 alc883_tagra_automute(codec
);
6949 static void alc883_haier_w66_automute(struct hda_codec
*codec
)
6951 unsigned int present
;
6954 present
= snd_hda_codec_read(codec
, 0x1b, 0,
6955 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6956 bits
= present
? 0x80 : 0;
6957 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
6961 static void alc883_haier_w66_unsol_event(struct hda_codec
*codec
,
6964 if ((res
>> 26) == ALC880_HP_EVENT
)
6965 alc883_haier_w66_automute(codec
);
6968 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
6970 unsigned int present
;
6973 present
= snd_hda_codec_read(codec
, 0x14, 0,
6974 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6975 bits
= present
? HDA_AMP_MUTE
: 0;
6976 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
6977 HDA_AMP_MUTE
, bits
);
6980 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
6982 unsigned int present
;
6985 present
= snd_hda_codec_read(codec
, 0x1b, 0,
6986 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
6987 bits
= present
? HDA_AMP_MUTE
: 0;
6988 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
6989 HDA_AMP_MUTE
, bits
);
6990 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
6991 HDA_AMP_MUTE
, bits
);
6994 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
6997 if ((res
>> 26) == ALC880_HP_EVENT
)
6998 alc883_lenovo_101e_all_automute(codec
);
6999 if ((res
>> 26) == ALC880_FRONT_EVENT
)
7000 alc883_lenovo_101e_ispeaker_automute(codec
);
7003 /* toggle speaker-output according to the hp-jack state */
7004 static void alc883_acer_aspire_automute(struct hda_codec
*codec
)
7006 unsigned int present
;
7008 present
= snd_hda_codec_read(codec
, 0x14, 0,
7009 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7010 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7011 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7012 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
7013 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7016 static void alc883_acer_aspire_unsol_event(struct hda_codec
*codec
,
7019 if ((res
>> 26) == ALC880_HP_EVENT
)
7020 alc883_acer_aspire_automute(codec
);
7023 static struct hda_verb alc883_acer_eapd_verbs
[] = {
7024 /* HP Pin: output 0 (0x0c) */
7025 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7026 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7027 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7028 /* Front Pin: output 0 (0x0c) */
7029 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7030 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7031 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7032 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
7033 /* eanable EAPD on medion laptop */
7034 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
7035 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
7036 /* enable unsolicited event */
7037 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7042 * generic initialization of ADC, input mixers and output mixers
7044 static struct hda_verb alc883_auto_init_verbs
[] = {
7046 * Unmute ADC0-2 and set the default input to mic-in
7048 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7049 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7050 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7051 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7053 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7055 * Note: PASD motherboards uses the Line In 2 as the input for
7056 * front panel mic (mic 2)
7058 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7059 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7060 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7061 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7062 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7066 * Set up output mixers (0x0c - 0x0f)
7068 /* set vol=0 to output mixers */
7069 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7070 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7071 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7072 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7073 /* set up input amps for analog loopback */
7074 /* Amp Indices: DAC = 0, mixer = 1 */
7075 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7076 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7077 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7078 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7079 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7080 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7081 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7083 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7084 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7086 /* FIXME: use matrix-type input source selection */
7087 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7089 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7090 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7091 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7092 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7093 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7095 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7096 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7098 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7099 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7104 /* capture mixer elements */
7105 static struct snd_kcontrol_new alc883_capture_mixer
[] = {
7106 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7107 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7108 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7109 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7111 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7112 /* The multiple "Capture Source" controls confuse alsamixer
7113 * So call somewhat different..
7114 * FIXME: the controls appear in the "playback" view!
7116 /* .name = "Capture Source", */
7117 .name
= "Input Source",
7119 .info
= alc882_mux_enum_info
,
7120 .get
= alc882_mux_enum_get
,
7121 .put
= alc882_mux_enum_put
,
7126 #ifdef CONFIG_SND_HDA_POWER_SAVE
7127 #define alc883_loopbacks alc880_loopbacks
7130 /* pcm configuration: identiacal with ALC880 */
7131 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7132 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7133 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7134 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7137 * configuration and preset
7139 static const char *alc883_models
[ALC883_MODEL_LAST
] = {
7140 [ALC883_3ST_2ch_DIG
] = "3stack-dig",
7141 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
7142 [ALC883_3ST_6ch
] = "3stack-6ch",
7143 [ALC883_6ST_DIG
] = "6stack-dig",
7144 [ALC883_TARGA_DIG
] = "targa-dig",
7145 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
7146 [ALC883_ACER
] = "acer",
7147 [ALC883_ACER_ASPIRE
] = "acer-aspire",
7148 [ALC883_MEDION
] = "medion",
7149 [ALC883_MEDION_MD2
] = "medion-md2",
7150 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
7151 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
7152 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
7153 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
7154 [ALC883_HAIER_W66
] = "haier-w66",
7155 [ALC888_6ST_HP
] = "6stack-hp",
7156 [ALC888_3ST_HP
] = "3stack-hp",
7157 [ALC883_AUTO
] = "auto",
7160 static struct snd_pci_quirk alc883_cfg_tbl
[] = {
7161 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG
),
7162 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
7163 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
7164 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD
),
7165 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG
),
7166 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG
),
7167 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
7168 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
7169 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
7170 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
7171 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
7172 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
7173 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
7174 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
7175 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
7176 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
7177 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
7178 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
7179 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
7180 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
7181 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
7182 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
7183 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
7184 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
7185 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
7186 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
7187 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
7188 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER
),
7189 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
7190 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
7191 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
7192 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch
),
7193 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
7194 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7195 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7196 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP
),
7197 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
7198 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
7199 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2
),
7200 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
7201 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7202 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
7203 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
7207 static struct alc_config_preset alc883_presets
[] = {
7208 [ALC883_3ST_2ch_DIG
] = {
7209 .mixers
= { alc883_3ST_2ch_mixer
},
7210 .init_verbs
= { alc883_init_verbs
},
7211 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7212 .dac_nids
= alc883_dac_nids
,
7213 .dig_out_nid
= ALC883_DIGOUT_NID
,
7214 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7215 .adc_nids
= alc883_adc_nids
,
7216 .dig_in_nid
= ALC883_DIGIN_NID
,
7217 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7218 .channel_mode
= alc883_3ST_2ch_modes
,
7219 .input_mux
= &alc883_capture_source
,
7221 [ALC883_3ST_6ch_DIG
] = {
7222 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
7223 .init_verbs
= { alc883_init_verbs
},
7224 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7225 .dac_nids
= alc883_dac_nids
,
7226 .dig_out_nid
= ALC883_DIGOUT_NID
,
7227 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7228 .adc_nids
= alc883_adc_nids
,
7229 .dig_in_nid
= ALC883_DIGIN_NID
,
7230 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7231 .channel_mode
= alc883_3ST_6ch_modes
,
7233 .input_mux
= &alc883_capture_source
,
7235 [ALC883_3ST_6ch
] = {
7236 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
7237 .init_verbs
= { alc883_init_verbs
},
7238 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7239 .dac_nids
= alc883_dac_nids
,
7240 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7241 .adc_nids
= alc883_adc_nids
,
7242 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7243 .channel_mode
= alc883_3ST_6ch_modes
,
7245 .input_mux
= &alc883_capture_source
,
7247 [ALC883_6ST_DIG
] = {
7248 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
7249 .init_verbs
= { alc883_init_verbs
},
7250 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7251 .dac_nids
= alc883_dac_nids
,
7252 .dig_out_nid
= ALC883_DIGOUT_NID
,
7253 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7254 .adc_nids
= alc883_adc_nids
,
7255 .dig_in_nid
= ALC883_DIGIN_NID
,
7256 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
7257 .channel_mode
= alc883_sixstack_modes
,
7258 .input_mux
= &alc883_capture_source
,
7260 [ALC883_TARGA_DIG
] = {
7261 .mixers
= { alc883_tagra_mixer
, alc883_chmode_mixer
},
7262 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
7263 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7264 .dac_nids
= alc883_dac_nids
,
7265 .dig_out_nid
= ALC883_DIGOUT_NID
,
7266 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7267 .adc_nids
= alc883_adc_nids
,
7268 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7269 .channel_mode
= alc883_3ST_6ch_modes
,
7271 .input_mux
= &alc883_capture_source
,
7272 .unsol_event
= alc883_tagra_unsol_event
,
7273 .init_hook
= alc883_tagra_automute
,
7275 [ALC883_TARGA_2ch_DIG
] = {
7276 .mixers
= { alc883_tagra_2ch_mixer
},
7277 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
7278 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7279 .dac_nids
= alc883_dac_nids
,
7280 .dig_out_nid
= ALC883_DIGOUT_NID
,
7281 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7282 .adc_nids
= alc883_adc_nids
,
7283 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7284 .channel_mode
= alc883_3ST_2ch_modes
,
7285 .input_mux
= &alc883_capture_source
,
7286 .unsol_event
= alc883_tagra_unsol_event
,
7287 .init_hook
= alc883_tagra_automute
,
7290 .mixers
= { alc883_base_mixer
},
7291 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7292 * and the headphone jack. Turn this on and rely on the
7293 * standard mute methods whenever the user wants to turn
7294 * these outputs off.
7296 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
7297 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7298 .dac_nids
= alc883_dac_nids
,
7299 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7300 .adc_nids
= alc883_adc_nids
,
7301 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7302 .channel_mode
= alc883_3ST_2ch_modes
,
7303 .input_mux
= &alc883_capture_source
,
7305 [ALC883_ACER_ASPIRE
] = {
7306 .mixers
= { alc883_acer_aspire_mixer
},
7307 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
7308 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7309 .dac_nids
= alc883_dac_nids
,
7310 .dig_out_nid
= ALC883_DIGOUT_NID
,
7311 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7312 .adc_nids
= alc883_adc_nids
,
7313 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7314 .channel_mode
= alc883_3ST_2ch_modes
,
7315 .input_mux
= &alc883_capture_source
,
7316 .unsol_event
= alc883_acer_aspire_unsol_event
,
7317 .init_hook
= alc883_acer_aspire_automute
,
7320 .mixers
= { alc883_fivestack_mixer
,
7321 alc883_chmode_mixer
},
7322 .init_verbs
= { alc883_init_verbs
,
7323 alc883_medion_eapd_verbs
},
7324 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7325 .dac_nids
= alc883_dac_nids
,
7326 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7327 .adc_nids
= alc883_adc_nids
,
7328 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
7329 .channel_mode
= alc883_sixstack_modes
,
7330 .input_mux
= &alc883_capture_source
,
7332 [ALC883_MEDION_MD2
] = {
7333 .mixers
= { alc883_medion_md2_mixer
},
7334 .init_verbs
= { alc883_init_verbs
, alc883_medion_md2_verbs
},
7335 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7336 .dac_nids
= alc883_dac_nids
,
7337 .dig_out_nid
= ALC883_DIGOUT_NID
,
7338 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7339 .adc_nids
= alc883_adc_nids
,
7340 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7341 .channel_mode
= alc883_3ST_2ch_modes
,
7342 .input_mux
= &alc883_capture_source
,
7343 .unsol_event
= alc883_medion_md2_unsol_event
,
7344 .init_hook
= alc883_medion_md2_automute
,
7346 [ALC883_LAPTOP_EAPD
] = {
7347 .mixers
= { alc883_base_mixer
},
7348 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
7349 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7350 .dac_nids
= alc883_dac_nids
,
7351 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7352 .adc_nids
= alc883_adc_nids
,
7353 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7354 .channel_mode
= alc883_3ST_2ch_modes
,
7355 .input_mux
= &alc883_capture_source
,
7357 [ALC883_LENOVO_101E_2ch
] = {
7358 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
7359 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
7360 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7361 .dac_nids
= alc883_dac_nids
,
7362 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7363 .adc_nids
= alc883_adc_nids
,
7364 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7365 .channel_mode
= alc883_3ST_2ch_modes
,
7366 .input_mux
= &alc883_lenovo_101e_capture_source
,
7367 .unsol_event
= alc883_lenovo_101e_unsol_event
,
7368 .init_hook
= alc883_lenovo_101e_all_automute
,
7370 [ALC883_LENOVO_NB0763
] = {
7371 .mixers
= { alc883_lenovo_nb0763_mixer
},
7372 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
7373 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7374 .dac_nids
= alc883_dac_nids
,
7375 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7376 .adc_nids
= alc883_adc_nids
,
7377 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7378 .channel_mode
= alc883_3ST_2ch_modes
,
7380 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
7381 .unsol_event
= alc883_medion_md2_unsol_event
,
7382 .init_hook
= alc883_medion_md2_automute
,
7384 [ALC888_LENOVO_MS7195_DIG
] = {
7385 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
7386 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
7387 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7388 .dac_nids
= alc883_dac_nids
,
7389 .dig_out_nid
= ALC883_DIGOUT_NID
,
7390 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7391 .adc_nids
= alc883_adc_nids
,
7392 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7393 .channel_mode
= alc883_3ST_6ch_modes
,
7395 .input_mux
= &alc883_capture_source
,
7396 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
7397 .init_hook
= alc888_lenovo_ms7195_front_automute
,
7399 [ALC883_HAIER_W66
] = {
7400 .mixers
= { alc883_tagra_2ch_mixer
},
7401 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
7402 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7403 .dac_nids
= alc883_dac_nids
,
7404 .dig_out_nid
= ALC883_DIGOUT_NID
,
7405 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7406 .adc_nids
= alc883_adc_nids
,
7407 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7408 .channel_mode
= alc883_3ST_2ch_modes
,
7409 .input_mux
= &alc883_capture_source
,
7410 .unsol_event
= alc883_haier_w66_unsol_event
,
7411 .init_hook
= alc883_haier_w66_automute
,
7414 .mixers
= { alc888_6st_hp_mixer
, alc883_chmode_mixer
},
7415 .init_verbs
= { alc883_init_verbs
, alc888_6st_hp_verbs
},
7416 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7417 .dac_nids
= alc883_dac_nids
,
7418 .dig_out_nid
= ALC883_DIGOUT_NID
,
7419 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7420 .adc_nids
= alc883_adc_nids
,
7421 .dig_in_nid
= ALC883_DIGIN_NID
,
7422 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
7423 .channel_mode
= alc883_sixstack_modes
,
7424 .input_mux
= &alc883_capture_source
,
7427 .mixers
= { alc888_3st_hp_mixer
, alc883_chmode_mixer
},
7428 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
7429 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7430 .dac_nids
= alc883_dac_nids
,
7431 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
7432 .adc_nids
= alc883_adc_nids
,
7433 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
7434 .channel_mode
= alc888_3st_hp_modes
,
7436 .input_mux
= &alc883_capture_source
,
7442 * BIOS auto configuration
7444 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
7445 hda_nid_t nid
, int pin_type
,
7449 struct alc_spec
*spec
= codec
->spec
;
7452 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
7455 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
7457 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
7459 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
7461 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
7465 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
7467 struct alc_spec
*spec
= codec
->spec
;
7470 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
7471 for (i
= 0; i
<= HDA_SIDE
; i
++) {
7472 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
7473 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
7475 alc883_auto_set_output_and_unmute(codec
, nid
, pin_type
,
7480 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
7482 struct alc_spec
*spec
= codec
->spec
;
7485 pin
= spec
->autocfg
.hp_pins
[0];
7486 if (pin
) /* connect to front */
7488 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
7491 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
7492 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
7494 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
7496 struct alc_spec
*spec
= codec
->spec
;
7499 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
7500 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
7501 if (alc883_is_input_pin(nid
)) {
7502 snd_hda_codec_write(codec
, nid
, 0,
7503 AC_VERB_SET_PIN_WIDGET_CONTROL
,
7504 (i
<= AUTO_PIN_FRONT_MIC
?
7505 PIN_VREF80
: PIN_IN
));
7506 if (nid
!= ALC883_PIN_CD_NID
)
7507 snd_hda_codec_write(codec
, nid
, 0,
7508 AC_VERB_SET_AMP_GAIN_MUTE
,
7514 /* almost identical with ALC880 parser... */
7515 static int alc883_parse_auto_config(struct hda_codec
*codec
)
7517 struct alc_spec
*spec
= codec
->spec
;
7518 int err
= alc880_parse_auto_config(codec
);
7523 return 0; /* no config found */
7525 err
= alc_auto_add_mic_boost(codec
);
7529 /* hack - override the init verbs */
7530 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
7531 spec
->mixers
[spec
->num_mixers
] = alc883_capture_mixer
;
7534 return 1; /* config found */
7537 /* additional initialization for auto-configuration model */
7538 static void alc883_auto_init(struct hda_codec
*codec
)
7540 alc883_auto_init_multi_out(codec
);
7541 alc883_auto_init_hp_out(codec
);
7542 alc883_auto_init_analog_input(codec
);
7545 static int patch_alc883(struct hda_codec
*codec
)
7547 struct alc_spec
*spec
;
7548 int err
, board_config
;
7550 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
7556 board_config
= snd_hda_check_board_config(codec
, ALC883_MODEL_LAST
,
7559 if (board_config
< 0) {
7560 printk(KERN_INFO
"hda_codec: Unknown model for ALC883, "
7561 "trying auto-probe from BIOS...\n");
7562 board_config
= ALC883_AUTO
;
7565 if (board_config
== ALC883_AUTO
) {
7566 /* automatic parse from the BIOS config */
7567 err
= alc883_parse_auto_config(codec
);
7573 "hda_codec: Cannot set up configuration "
7574 "from BIOS. Using base mode...\n");
7575 board_config
= ALC883_3ST_2ch_DIG
;
7579 if (board_config
!= ALC883_AUTO
)
7580 setup_preset(spec
, &alc883_presets
[board_config
]);
7582 spec
->stream_name_analog
= "ALC883 Analog";
7583 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
7584 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
7586 spec
->stream_name_digital
= "ALC883 Digital";
7587 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
7588 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
7590 if (!spec
->adc_nids
&& spec
->input_mux
) {
7591 spec
->adc_nids
= alc883_adc_nids
;
7592 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
7595 codec
->patch_ops
= alc_patch_ops
;
7596 if (board_config
== ALC883_AUTO
)
7597 spec
->init_hook
= alc883_auto_init
;
7598 #ifdef CONFIG_SND_HDA_POWER_SAVE
7599 if (!spec
->loopback
.amplist
)
7600 spec
->loopback
.amplist
= alc883_loopbacks
;
7610 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
7611 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
7613 #define alc262_dac_nids alc260_dac_nids
7614 #define alc262_adc_nids alc882_adc_nids
7615 #define alc262_adc_nids_alt alc882_adc_nids_alt
7617 #define alc262_modes alc260_modes
7618 #define alc262_capture_source alc882_capture_source
7620 static struct snd_kcontrol_new alc262_base_mixer
[] = {
7621 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7622 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7623 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7624 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7625 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7626 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7627 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7628 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7629 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7630 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7631 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7632 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7633 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7634 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7635 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
7636 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7637 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7638 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
7642 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
7643 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7644 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7645 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7646 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7647 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7648 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7649 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7650 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7651 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7652 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7653 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7654 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7655 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
7656 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
7657 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
7658 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7662 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
7663 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7664 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7665 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7666 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7667 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
7669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7671 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7672 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7673 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7674 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7675 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7676 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7677 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7678 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7679 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7680 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7681 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
7682 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
7686 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
7687 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7688 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7689 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
7690 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7691 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
7692 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
7693 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7694 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7695 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT
),
7696 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7697 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7698 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7699 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7700 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7701 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7705 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
7706 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7707 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7708 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT
),
7712 /* bind hp and internal speaker mute (with plug check) */
7713 static int alc262_sony_master_sw_put(struct snd_kcontrol
*kcontrol
,
7714 struct snd_ctl_elem_value
*ucontrol
)
7716 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
7717 long *valp
= ucontrol
->value
.integer
.value
;
7720 /* change hp mute */
7721 change
= snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
7723 valp
[0] ? 0 : HDA_AMP_MUTE
);
7724 change
|= snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
7726 valp
[1] ? 0 : HDA_AMP_MUTE
);
7728 /* change speaker according to HP jack state */
7729 struct alc_spec
*spec
= codec
->spec
;
7731 if (spec
->jack_present
)
7732 mute
= HDA_AMP_MUTE
;
7734 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0,
7736 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7737 HDA_AMP_MUTE
, mute
);
7742 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
7743 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7745 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7746 .name
= "Master Playback Switch",
7747 .info
= snd_hda_mixer_amp_switch_info
,
7748 .get
= snd_hda_mixer_amp_switch_get
,
7749 .put
= alc262_sony_master_sw_put
,
7750 .private_value
= HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
7752 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7753 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7754 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7755 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7759 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
7760 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7761 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7762 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
7763 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7764 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7765 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
7766 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
7770 #define alc262_capture_mixer alc882_capture_mixer
7771 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
7774 * generic initialization of ADC, input mixers and output mixers
7776 static struct hda_verb alc262_init_verbs
[] = {
7778 * Unmute ADC0-2 and set the default input to mic-in
7780 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
7781 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7782 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7783 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7784 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7785 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7787 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7789 * Note: PASD motherboards uses the Line In 2 as the input for
7790 * front panel mic (mic 2)
7792 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7793 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7794 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7795 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7796 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7797 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7800 * Set up output mixers (0x0c - 0x0e)
7802 /* set vol=0 to output mixers */
7803 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7804 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7805 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7806 /* set up input amps for analog loopback */
7807 /* Amp Indices: DAC = 0, mixer = 1 */
7808 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7809 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7810 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7811 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7812 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7813 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7815 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
7816 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
7817 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
7818 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
7819 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
7820 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
7822 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
7823 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
7824 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
7825 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
7826 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
7828 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7829 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7831 /* FIXME: use matrix-type input source selection */
7832 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7833 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7834 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
7835 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
7836 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
7837 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
7839 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
7840 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
7841 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
7842 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
7844 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
7845 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
7846 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
7847 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
7852 static struct hda_verb alc262_hippo_unsol_verbs
[] = {
7853 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
7854 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7858 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
7859 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
7860 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7861 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
7863 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
7864 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7868 static struct hda_verb alc262_sony_unsol_verbs
[] = {
7869 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
7870 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7871 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
7873 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
7874 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7877 /* mute/unmute internal speaker according to the hp jack and mute state */
7878 static void alc262_hippo_automute(struct hda_codec
*codec
)
7880 struct alc_spec
*spec
= codec
->spec
;
7882 unsigned int present
;
7884 /* need to execute and sync at first */
7885 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
7886 present
= snd_hda_codec_read(codec
, 0x15, 0,
7887 AC_VERB_GET_PIN_SENSE
, 0);
7888 spec
->jack_present
= (present
& 0x80000000) != 0;
7889 if (spec
->jack_present
) {
7890 /* mute internal speaker */
7891 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7892 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
7894 /* unmute internal speaker if necessary */
7895 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
7896 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7897 HDA_AMP_MUTE
, mute
);
7901 /* unsolicited event for HP jack sensing */
7902 static void alc262_hippo_unsol_event(struct hda_codec
*codec
,
7905 if ((res
>> 26) != ALC880_HP_EVENT
)
7907 alc262_hippo_automute(codec
);
7910 static void alc262_hippo1_automute(struct hda_codec
*codec
)
7913 unsigned int present
;
7915 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
7916 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7917 AC_VERB_GET_PIN_SENSE
, 0);
7918 present
= (present
& 0x80000000) != 0;
7920 /* mute internal speaker */
7921 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7922 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
7924 /* unmute internal speaker if necessary */
7925 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
7926 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7927 HDA_AMP_MUTE
, mute
);
7931 /* unsolicited event for HP jack sensing */
7932 static void alc262_hippo1_unsol_event(struct hda_codec
*codec
,
7935 if ((res
>> 26) != ALC880_HP_EVENT
)
7937 alc262_hippo1_automute(codec
);
7942 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
7945 #define ALC_HP_EVENT 0x37
7947 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
7948 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
7949 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7953 static struct hda_input_mux alc262_fujitsu_capture_source
= {
7962 static struct hda_input_mux alc262_HP_capture_source
= {
7966 { "Front Mic", 0x1 },
7973 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
7977 { "Front Mic", 0x2 },
7983 /* mute/unmute internal speaker according to the hp jack and mute state */
7984 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
7986 struct alc_spec
*spec
= codec
->spec
;
7989 if (force
|| !spec
->sense_updated
) {
7990 unsigned int present
;
7991 /* need to execute and sync at first */
7992 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
7993 present
= snd_hda_codec_read(codec
, 0x14, 0,
7994 AC_VERB_GET_PIN_SENSE
, 0);
7995 spec
->jack_present
= (present
& 0x80000000) != 0;
7996 spec
->sense_updated
= 1;
7998 if (spec
->jack_present
) {
7999 /* mute internal speaker */
8000 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8001 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8003 /* unmute internal speaker if necessary */
8004 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
8005 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8006 HDA_AMP_MUTE
, mute
);
8010 /* unsolicited event for HP jack sensing */
8011 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
8014 if ((res
>> 26) != ALC_HP_EVENT
)
8016 alc262_fujitsu_automute(codec
, 1);
8019 /* bind volumes of both NID 0x0c and 0x0d */
8020 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
8021 .ops
= &snd_hda_bind_vol
,
8023 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
8024 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
8029 /* bind hp and internal speaker mute (with plug check) */
8030 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
8031 struct snd_ctl_elem_value
*ucontrol
)
8033 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8034 long *valp
= ucontrol
->value
.integer
.value
;
8037 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
8039 valp
[0] ? 0 : HDA_AMP_MUTE
);
8040 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
8042 valp
[1] ? 0 : HDA_AMP_MUTE
);
8044 alc262_fujitsu_automute(codec
, 0);
8048 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
8049 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
8051 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8052 .name
= "Master Playback Switch",
8053 .info
= snd_hda_mixer_amp_switch_info
,
8054 .get
= snd_hda_mixer_amp_switch_get
,
8055 .put
= alc262_fujitsu_master_sw_put
,
8056 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
8058 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8059 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8060 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8061 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8062 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8063 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8064 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8065 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8069 /* additional init verbs for Benq laptops */
8070 static struct hda_verb alc262_EAPD_verbs
[] = {
8071 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8072 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
8076 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
8077 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8078 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8080 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8081 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
8085 /* add playback controls from the parsed DAC table */
8086 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
8087 const struct auto_pin_cfg
*cfg
)
8092 spec
->multiout
.num_dacs
= 1; /* only use one dac */
8093 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
8094 spec
->multiout
.dac_nids
[0] = 2;
8096 nid
= cfg
->line_out_pins
[0];
8098 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
8099 "Front Playback Volume",
8100 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
));
8103 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8104 "Front Playback Switch",
8105 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
8110 nid
= cfg
->speaker_pins
[0];
8113 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
8114 "Speaker Playback Volume",
8115 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8119 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8120 "Speaker Playback Switch",
8121 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
8126 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8127 "Speaker Playback Switch",
8128 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
8134 nid
= cfg
->hp_pins
[0];
8136 /* spec->multiout.hp_nid = 2; */
8138 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
8139 "Headphone Playback Volume",
8140 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8144 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8145 "Headphone Playback Switch",
8146 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
8151 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8152 "Headphone Playback Switch",
8153 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
8162 /* identical with ALC880 */
8163 #define alc262_auto_create_analog_input_ctls \
8164 alc880_auto_create_analog_input_ctls
8167 * generic initialization of ADC, input mixers and output mixers
8169 static struct hda_verb alc262_volume_init_verbs
[] = {
8171 * Unmute ADC0-2 and set the default input to mic-in
8173 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8174 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8175 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8176 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8177 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8178 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8180 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8182 * Note: PASD motherboards uses the Line In 2 as the input for
8183 * front panel mic (mic 2)
8185 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8187 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8188 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8189 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8190 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8193 * Set up output mixers (0x0c - 0x0f)
8195 /* set vol=0 to output mixers */
8196 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8197 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8198 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8200 /* set up input amps for analog loopback */
8201 /* Amp Indices: DAC = 0, mixer = 1 */
8202 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8203 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8204 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8205 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8206 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8207 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8209 /* FIXME: use matrix-type input source selection */
8210 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8211 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8212 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8213 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8214 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8215 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8217 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8218 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8219 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8220 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8222 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8223 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8224 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8225 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8230 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
8232 * Unmute ADC0-2 and set the default input to mic-in
8234 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8235 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8236 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8237 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8238 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8239 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8241 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8243 * Note: PASD motherboards uses the Line In 2 as the input for
8244 * front panel mic (mic 2)
8246 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
8253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
8256 * Set up output mixers (0x0c - 0x0e)
8258 /* set vol=0 to output mixers */
8259 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8260 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8261 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8263 /* set up input amps for analog loopback */
8264 /* Amp Indices: DAC = 0, mixer = 1 */
8265 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8266 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8267 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8268 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8269 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8270 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8272 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8273 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8274 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8276 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8277 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8279 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8280 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8282 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8283 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8284 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8286 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8288 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
8289 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8290 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8291 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
8292 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8293 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8296 /* FIXME: use matrix-type input source selection */
8297 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8298 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8299 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8300 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
8301 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
8302 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
8304 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8305 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
8306 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
8307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
8309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
8311 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
8312 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
8317 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
8319 * Unmute ADC0-2 and set the default input to mic-in
8321 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8322 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8323 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8324 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8325 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8326 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8328 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8330 * Note: PASD motherboards uses the Line In 2 as the input for front
8333 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8334 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8335 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
8340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
8341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
8343 * Set up output mixers (0x0c - 0x0e)
8345 /* set vol=0 to output mixers */
8346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8350 /* set up input amps for analog loopback */
8351 /* Amp Indices: DAC = 0, mixer = 1 */
8352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8354 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
8361 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
8362 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
8363 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
8364 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
8365 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
8366 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
8368 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8371 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8372 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8374 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
8375 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8376 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8377 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
8378 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8379 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
8381 /* FIXME: use matrix-type input source selection */
8382 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8383 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
8385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
8386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
8387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
8388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
8389 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8390 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
8392 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
8395 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
8396 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
8397 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
8400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
8403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
8404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
8405 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
8406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
8411 #ifdef CONFIG_SND_HDA_POWER_SAVE
8412 #define alc262_loopbacks alc880_loopbacks
8415 /* pcm configuration: identiacal with ALC880 */
8416 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
8417 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
8418 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
8419 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
8422 * BIOS auto configuration
8424 static int alc262_parse_auto_config(struct hda_codec
*codec
)
8426 struct alc_spec
*spec
= codec
->spec
;
8428 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
8430 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
8434 if (!spec
->autocfg
.line_outs
)
8435 return 0; /* can't find valid BIOS pin config */
8436 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
8439 err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
8443 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
8445 if (spec
->autocfg
.dig_out_pin
)
8446 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
8447 if (spec
->autocfg
.dig_in_pin
)
8448 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
8450 if (spec
->kctl_alloc
)
8451 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
8453 spec
->init_verbs
[spec
->num_init_verbs
++] = alc262_volume_init_verbs
;
8454 spec
->num_mux_defs
= 1;
8455 spec
->input_mux
= &spec
->private_imux
;
8457 err
= alc_auto_add_mic_boost(codec
);
8464 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
8465 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
8466 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
8469 /* init callback for auto-configuration model -- overriding the default init */
8470 static void alc262_auto_init(struct hda_codec
*codec
)
8472 alc262_auto_init_multi_out(codec
);
8473 alc262_auto_init_hp_out(codec
);
8474 alc262_auto_init_analog_input(codec
);
8478 * configuration and preset
8480 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
8481 [ALC262_BASIC
] = "basic",
8482 [ALC262_HIPPO
] = "hippo",
8483 [ALC262_HIPPO_1
] = "hippo_1",
8484 [ALC262_FUJITSU
] = "fujitsu",
8485 [ALC262_HP_BPC
] = "hp-bpc",
8486 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
8487 [ALC262_BENQ_ED8
] = "benq",
8488 [ALC262_BENQ_T31
] = "benq-t31",
8489 [ALC262_SONY_ASSAMD
] = "sony-assamd",
8490 [ALC262_AUTO
] = "auto",
8493 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
8494 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
8495 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC
),
8496 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
8497 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC
),
8498 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC
),
8499 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
8500 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC
),
8501 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
8502 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC
),
8503 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
8504 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
8505 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
8506 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
8507 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
8508 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
8509 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
8510 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
8511 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
8512 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
8513 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
8514 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
8515 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
8516 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
8517 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD
),
8518 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
8519 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
8523 static struct alc_config_preset alc262_presets
[] = {
8525 .mixers
= { alc262_base_mixer
},
8526 .init_verbs
= { alc262_init_verbs
},
8527 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8528 .dac_nids
= alc262_dac_nids
,
8530 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8531 .channel_mode
= alc262_modes
,
8532 .input_mux
= &alc262_capture_source
,
8535 .mixers
= { alc262_base_mixer
},
8536 .init_verbs
= { alc262_init_verbs
, alc262_hippo_unsol_verbs
},
8537 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8538 .dac_nids
= alc262_dac_nids
,
8540 .dig_out_nid
= ALC262_DIGOUT_NID
,
8541 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8542 .channel_mode
= alc262_modes
,
8543 .input_mux
= &alc262_capture_source
,
8544 .unsol_event
= alc262_hippo_unsol_event
,
8545 .init_hook
= alc262_hippo_automute
,
8547 [ALC262_HIPPO_1
] = {
8548 .mixers
= { alc262_hippo1_mixer
},
8549 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
8550 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8551 .dac_nids
= alc262_dac_nids
,
8553 .dig_out_nid
= ALC262_DIGOUT_NID
,
8554 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8555 .channel_mode
= alc262_modes
,
8556 .input_mux
= &alc262_capture_source
,
8557 .unsol_event
= alc262_hippo1_unsol_event
,
8558 .init_hook
= alc262_hippo1_automute
,
8560 [ALC262_FUJITSU
] = {
8561 .mixers
= { alc262_fujitsu_mixer
},
8562 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
8563 alc262_fujitsu_unsol_verbs
},
8564 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8565 .dac_nids
= alc262_dac_nids
,
8567 .dig_out_nid
= ALC262_DIGOUT_NID
,
8568 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8569 .channel_mode
= alc262_modes
,
8570 .input_mux
= &alc262_fujitsu_capture_source
,
8571 .unsol_event
= alc262_fujitsu_unsol_event
,
8574 .mixers
= { alc262_HP_BPC_mixer
},
8575 .init_verbs
= { alc262_HP_BPC_init_verbs
},
8576 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8577 .dac_nids
= alc262_dac_nids
,
8579 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8580 .channel_mode
= alc262_modes
,
8581 .input_mux
= &alc262_HP_capture_source
,
8583 [ALC262_HP_BPC_D7000_WF
] = {
8584 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
8585 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
8586 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8587 .dac_nids
= alc262_dac_nids
,
8589 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8590 .channel_mode
= alc262_modes
,
8591 .input_mux
= &alc262_HP_D7000_capture_source
,
8593 [ALC262_HP_BPC_D7000_WL
] = {
8594 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
8595 alc262_HP_BPC_WildWest_option_mixer
},
8596 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
8597 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8598 .dac_nids
= alc262_dac_nids
,
8600 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8601 .channel_mode
= alc262_modes
,
8602 .input_mux
= &alc262_HP_D7000_capture_source
,
8604 [ALC262_BENQ_ED8
] = {
8605 .mixers
= { alc262_base_mixer
},
8606 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
8607 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8608 .dac_nids
= alc262_dac_nids
,
8610 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8611 .channel_mode
= alc262_modes
,
8612 .input_mux
= &alc262_capture_source
,
8614 [ALC262_SONY_ASSAMD
] = {
8615 .mixers
= { alc262_sony_mixer
},
8616 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
8617 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8618 .dac_nids
= alc262_dac_nids
,
8620 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8621 .channel_mode
= alc262_modes
,
8622 .input_mux
= &alc262_capture_source
,
8623 .unsol_event
= alc262_hippo_unsol_event
,
8624 .init_hook
= alc262_hippo_automute
,
8626 [ALC262_BENQ_T31
] = {
8627 .mixers
= { alc262_benq_t31_mixer
},
8628 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
, alc262_hippo_unsol_verbs
},
8629 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
8630 .dac_nids
= alc262_dac_nids
,
8632 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
8633 .channel_mode
= alc262_modes
,
8634 .input_mux
= &alc262_capture_source
,
8635 .unsol_event
= alc262_hippo_unsol_event
,
8636 .init_hook
= alc262_hippo_automute
,
8640 static int patch_alc262(struct hda_codec
*codec
)
8642 struct alc_spec
*spec
;
8646 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
8652 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
8657 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
8658 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
8659 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
8660 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
8664 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
8668 if (board_config
< 0) {
8669 printk(KERN_INFO
"hda_codec: Unknown model for ALC262, "
8670 "trying auto-probe from BIOS...\n");
8671 board_config
= ALC262_AUTO
;
8674 if (board_config
== ALC262_AUTO
) {
8675 /* automatic parse from the BIOS config */
8676 err
= alc262_parse_auto_config(codec
);
8682 "hda_codec: Cannot set up configuration "
8683 "from BIOS. Using base mode...\n");
8684 board_config
= ALC262_BASIC
;
8688 if (board_config
!= ALC262_AUTO
)
8689 setup_preset(spec
, &alc262_presets
[board_config
]);
8691 spec
->stream_name_analog
= "ALC262 Analog";
8692 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
8693 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
8695 spec
->stream_name_digital
= "ALC262 Digital";
8696 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
8697 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
8699 if (!spec
->adc_nids
&& spec
->input_mux
) {
8700 /* check whether NID 0x07 is valid */
8701 unsigned int wcap
= get_wcaps(codec
, 0x07);
8704 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
8705 if (wcap
!= AC_WID_AUD_IN
) {
8706 spec
->adc_nids
= alc262_adc_nids_alt
;
8707 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids_alt
);
8708 spec
->mixers
[spec
->num_mixers
] =
8709 alc262_capture_alt_mixer
;
8712 spec
->adc_nids
= alc262_adc_nids
;
8713 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids
);
8714 spec
->mixers
[spec
->num_mixers
] = alc262_capture_mixer
;
8719 codec
->patch_ops
= alc_patch_ops
;
8720 if (board_config
== ALC262_AUTO
)
8721 spec
->init_hook
= alc262_auto_init
;
8722 #ifdef CONFIG_SND_HDA_POWER_SAVE
8723 if (!spec
->loopback
.amplist
)
8724 spec
->loopback
.amplist
= alc262_loopbacks
;
8731 * ALC268 channel source setting (2 channel)
8733 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
8734 #define alc268_modes alc260_modes
8736 static hda_nid_t alc268_dac_nids
[2] = {
8741 static hda_nid_t alc268_adc_nids
[2] = {
8746 static hda_nid_t alc268_adc_nids_alt
[1] = {
8751 static struct snd_kcontrol_new alc268_base_mixer
[] = {
8752 /* output mixer control */
8753 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
8754 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8755 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
8756 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8757 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8758 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8759 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
8763 static struct hda_verb alc268_eapd_verbs
[] = {
8764 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8765 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
8769 /* Toshiba specific */
8770 #define alc268_toshiba_automute alc262_hippo_automute
8772 static struct hda_verb alc268_toshiba_verbs
[] = {
8773 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8778 /* bind volumes of both NID 0x02 and 0x03 */
8779 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
8780 .ops
= &snd_hda_bind_vol
,
8782 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
8783 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
8788 /* mute/unmute internal speaker according to the hp jack and mute state */
8789 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
8791 struct alc_spec
*spec
= codec
->spec
;
8794 if (force
|| !spec
->sense_updated
) {
8795 unsigned int present
;
8796 present
= snd_hda_codec_read(codec
, 0x14, 0,
8797 AC_VERB_GET_PIN_SENSE
, 0);
8798 spec
->jack_present
= (present
& 0x80000000) != 0;
8799 spec
->sense_updated
= 1;
8801 if (spec
->jack_present
)
8802 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
8803 else /* unmute internal speaker if necessary */
8804 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
8805 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8806 HDA_AMP_MUTE
, mute
);
8810 /* bind hp and internal speaker mute (with plug check) */
8811 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
8812 struct snd_ctl_elem_value
*ucontrol
)
8814 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8815 long *valp
= ucontrol
->value
.integer
.value
;
8818 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
8820 valp
[0] ? 0 : HDA_AMP_MUTE
);
8821 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
8823 valp
[1] ? 0 : HDA_AMP_MUTE
);
8825 alc268_acer_automute(codec
, 0);
8829 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
8830 /* output mixer control */
8831 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
8833 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8834 .name
= "Master Playback Switch",
8835 .info
= snd_hda_mixer_amp_switch_info
,
8836 .get
= snd_hda_mixer_amp_switch_get
,
8837 .put
= alc268_acer_master_sw_put
,
8838 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
8840 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8841 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
8842 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
8846 static struct hda_verb alc268_acer_verbs
[] = {
8847 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8848 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8850 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8854 /* unsolicited event for HP jack sensing */
8855 static void alc268_toshiba_unsol_event(struct hda_codec
*codec
,
8858 if ((res
>> 26) != ALC880_HP_EVENT
)
8860 alc268_toshiba_automute(codec
);
8863 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
8866 if ((res
>> 26) != ALC880_HP_EVENT
)
8868 alc268_acer_automute(codec
, 1);
8871 static void alc268_acer_init_hook(struct hda_codec
*codec
)
8873 alc268_acer_automute(codec
, 1);
8877 * generic initialization of ADC, input mixers and output mixers
8879 static struct hda_verb alc268_base_init_verbs
[] = {
8880 /* Unmute DAC0-1 and set vol = 0 */
8881 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8882 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8883 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8884 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8885 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8886 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8889 * Set up output mixers (0x0c - 0x0e)
8891 /* set vol=0 to output mixers */
8892 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8893 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8894 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8895 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
8897 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8898 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8900 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8901 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8902 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8903 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8904 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8905 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8906 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8907 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8909 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8910 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8911 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8912 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8913 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8914 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8915 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8916 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8918 /* FIXME: use matrix-type input source selection */
8919 /* Mixer elements: 0x18, 19, 1a, 1c, 14, 15, 0b */
8920 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8922 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8923 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8924 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
8925 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
8927 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8928 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8929 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
8930 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
8935 * generic initialization of ADC, input mixers and output mixers
8937 static struct hda_verb alc268_volume_init_verbs
[] = {
8938 /* set output DAC */
8939 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8940 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8941 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8942 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8944 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8945 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8946 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8947 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8948 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8950 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8951 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8952 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8953 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8954 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8956 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8957 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8958 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8959 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
8961 /* set PCBEEP vol = 0 */
8962 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, (0xb000 | (0x00 << 8))},
8967 #define alc268_mux_enum_info alc_mux_enum_info
8968 #define alc268_mux_enum_get alc_mux_enum_get
8970 static int alc268_mux_enum_put(struct snd_kcontrol
*kcontrol
,
8971 struct snd_ctl_elem_value
*ucontrol
)
8973 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8974 struct alc_spec
*spec
= codec
->spec
;
8975 const struct hda_input_mux
*imux
= spec
->input_mux
;
8976 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
8977 static hda_nid_t capture_mixers
[3] = { 0x23, 0x24 };
8978 hda_nid_t nid
= capture_mixers
[adc_idx
];
8979 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
8980 unsigned int i
, idx
;
8982 idx
= ucontrol
->value
.enumerated
.item
[0];
8983 if (idx
>= imux
->num_items
)
8984 idx
= imux
->num_items
- 1;
8985 if (*cur_val
== idx
)
8987 for (i
= 0; i
< imux
->num_items
; i
++) {
8988 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
8989 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
8990 imux
->items
[i
].index
,
8992 snd_hda_codec_write_cache(codec
, nid
, 0,
8993 AC_VERB_SET_CONNECT_SEL
,
9000 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
9001 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
9002 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
9004 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9005 /* The multiple "Capture Source" controls confuse alsamixer
9006 * So call somewhat different..
9007 * FIXME: the controls appear in the "playback" view!
9009 /* .name = "Capture Source", */
9010 .name
= "Input Source",
9012 .info
= alc268_mux_enum_info
,
9013 .get
= alc268_mux_enum_get
,
9014 .put
= alc268_mux_enum_put
,
9019 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
9020 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
9021 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
9022 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
9023 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
9025 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9026 /* The multiple "Capture Source" controls confuse alsamixer
9027 * So call somewhat different..
9028 * FIXME: the controls appear in the "playback" view!
9030 /* .name = "Capture Source", */
9031 .name
= "Input Source",
9033 .info
= alc268_mux_enum_info
,
9034 .get
= alc268_mux_enum_get
,
9035 .put
= alc268_mux_enum_put
,
9040 static struct hda_input_mux alc268_capture_source
= {
9044 { "Front Mic", 0x1 },
9050 /* create input playback/capture controls for the given pin */
9051 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
9052 const char *ctlname
, int idx
)
9057 sprintf(name
, "%s Playback Volume", ctlname
);
9059 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
9060 HDA_COMPOSE_AMP_VAL(0x02, 3, idx
,
9064 } else if (nid
== 0x15) {
9065 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
9066 HDA_COMPOSE_AMP_VAL(0x03, 3, idx
,
9072 sprintf(name
, "%s Playback Switch", ctlname
);
9073 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
9074 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
9080 /* add playback controls from the parsed DAC table */
9081 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
9082 const struct auto_pin_cfg
*cfg
)
9087 spec
->multiout
.num_dacs
= 2; /* only use one dac */
9088 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
9089 spec
->multiout
.dac_nids
[0] = 2;
9090 spec
->multiout
.dac_nids
[1] = 3;
9092 nid
= cfg
->line_out_pins
[0];
9094 alc268_new_analog_output(spec
, nid
, "Front", 0);
9096 nid
= cfg
->speaker_pins
[0];
9098 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
9099 "Speaker Playback Volume",
9100 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
9104 nid
= cfg
->hp_pins
[0];
9106 alc268_new_analog_output(spec
, nid
, "Headphone", 0);
9108 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
9110 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
9111 "Mono Playback Switch",
9112 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_INPUT
));
9119 /* create playback/capture controls for input pins */
9120 static int alc268_auto_create_analog_input_ctls(struct alc_spec
*spec
,
9121 const struct auto_pin_cfg
*cfg
)
9123 struct hda_input_mux
*imux
= &spec
->private_imux
;
9126 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
9127 switch(cfg
->input_pins
[i
]) {
9129 idx1
= 0; /* Mic 1 */
9132 idx1
= 1; /* Mic 2 */
9135 idx1
= 2; /* Line In */
9143 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
9144 imux
->items
[imux
->num_items
].index
= idx1
;
9150 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
9152 struct alc_spec
*spec
= codec
->spec
;
9153 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
9154 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
9155 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
9156 unsigned int dac_vol1
, dac_vol2
;
9159 snd_hda_codec_write(codec
, speaker_nid
, 0,
9160 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
9161 snd_hda_codec_write(codec
, 0x0f, 0,
9162 AC_VERB_SET_AMP_GAIN_MUTE
,
9164 snd_hda_codec_write(codec
, 0x10, 0,
9165 AC_VERB_SET_AMP_GAIN_MUTE
,
9168 snd_hda_codec_write(codec
, 0x0f, 0,
9169 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
9170 snd_hda_codec_write(codec
, 0x10, 0,
9171 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
9174 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
9175 if (line_nid
== 0x14)
9176 dac_vol2
= AMP_OUT_ZERO
;
9177 else if (line_nid
== 0x15)
9178 dac_vol1
= AMP_OUT_ZERO
;
9180 dac_vol2
= AMP_OUT_ZERO
;
9181 else if (hp_nid
== 0x15)
9182 dac_vol1
= AMP_OUT_ZERO
;
9183 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
9184 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
9185 spec
->autocfg
.line_out_pins
[2] != 0x16)
9186 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
9188 snd_hda_codec_write(codec
, 0x02, 0,
9189 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
9190 snd_hda_codec_write(codec
, 0x03, 0,
9191 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
9194 /* pcm configuration: identiacal with ALC880 */
9195 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
9196 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
9197 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
9200 * BIOS auto configuration
9202 static int alc268_parse_auto_config(struct hda_codec
*codec
)
9204 struct alc_spec
*spec
= codec
->spec
;
9206 static hda_nid_t alc268_ignore
[] = { 0 };
9208 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
9212 if (!spec
->autocfg
.line_outs
)
9213 return 0; /* can't find valid BIOS pin config */
9215 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
9218 err
= alc268_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
9222 spec
->multiout
.max_channels
= 2;
9224 /* digital only support output */
9225 if (spec
->autocfg
.dig_out_pin
)
9226 spec
->multiout
.dig_out_nid
= ALC268_DIGOUT_NID
;
9228 if (spec
->kctl_alloc
)
9229 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
9231 spec
->init_verbs
[spec
->num_init_verbs
++] = alc268_volume_init_verbs
;
9232 spec
->num_mux_defs
= 1;
9233 spec
->input_mux
= &spec
->private_imux
;
9235 err
= alc_auto_add_mic_boost(codec
);
9242 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
9243 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
9244 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
9246 /* init callback for auto-configuration model -- overriding the default init */
9247 static void alc268_auto_init(struct hda_codec
*codec
)
9249 alc268_auto_init_multi_out(codec
);
9250 alc268_auto_init_hp_out(codec
);
9251 alc268_auto_init_mono_speaker_out(codec
);
9252 alc268_auto_init_analog_input(codec
);
9256 * configuration and preset
9258 static const char *alc268_models
[ALC268_MODEL_LAST
] = {
9259 [ALC268_3ST
] = "3stack",
9260 [ALC268_TOSHIBA
] = "toshiba",
9261 [ALC268_ACER
] = "acer",
9262 [ALC268_AUTO
] = "auto",
9265 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
9266 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
9267 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA
),
9268 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA
),
9269 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA
),
9270 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
9271 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
9272 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
9276 static struct alc_config_preset alc268_presets
[] = {
9278 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
},
9279 .init_verbs
= { alc268_base_init_verbs
},
9280 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
9281 .dac_nids
= alc268_dac_nids
,
9282 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
9283 .adc_nids
= alc268_adc_nids_alt
,
9285 .dig_out_nid
= ALC268_DIGOUT_NID
,
9286 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
9287 .channel_mode
= alc268_modes
,
9288 .input_mux
= &alc268_capture_source
,
9290 [ALC268_TOSHIBA
] = {
9291 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
},
9292 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
9293 alc268_toshiba_verbs
},
9294 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
9295 .dac_nids
= alc268_dac_nids
,
9296 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
9297 .adc_nids
= alc268_adc_nids_alt
,
9299 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
9300 .channel_mode
= alc268_modes
,
9301 .input_mux
= &alc268_capture_source
,
9302 .unsol_event
= alc268_toshiba_unsol_event
,
9303 .init_hook
= alc268_toshiba_automute
,
9306 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
},
9307 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
9308 alc268_acer_verbs
},
9309 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
9310 .dac_nids
= alc268_dac_nids
,
9311 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
9312 .adc_nids
= alc268_adc_nids_alt
,
9314 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
9315 .channel_mode
= alc268_modes
,
9316 .input_mux
= &alc268_capture_source
,
9317 .unsol_event
= alc268_acer_unsol_event
,
9318 .init_hook
= alc268_acer_init_hook
,
9322 static int patch_alc268(struct hda_codec
*codec
)
9324 struct alc_spec
*spec
;
9328 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
9334 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
9338 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
9339 printk(KERN_INFO
"hda_codec: Unknown model for ALC268, "
9340 "trying auto-probe from BIOS...\n");
9341 board_config
= ALC268_AUTO
;
9344 if (board_config
== ALC268_AUTO
) {
9345 /* automatic parse from the BIOS config */
9346 err
= alc268_parse_auto_config(codec
);
9352 "hda_codec: Cannot set up configuration "
9353 "from BIOS. Using base mode...\n");
9354 board_config
= ALC268_3ST
;
9358 if (board_config
!= ALC268_AUTO
)
9359 setup_preset(spec
, &alc268_presets
[board_config
]);
9361 spec
->stream_name_analog
= "ALC268 Analog";
9362 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
9363 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
9365 spec
->stream_name_digital
= "ALC268 Digital";
9366 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
9368 if (board_config
== ALC268_AUTO
) {
9369 if (!spec
->adc_nids
&& spec
->input_mux
) {
9370 /* check whether NID 0x07 is valid */
9371 unsigned int wcap
= get_wcaps(codec
, 0x07);
9374 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
9375 if (wcap
!= AC_WID_AUD_IN
) {
9376 spec
->adc_nids
= alc268_adc_nids_alt
;
9377 spec
->num_adc_nids
=
9378 ARRAY_SIZE(alc268_adc_nids_alt
);
9379 spec
->mixers
[spec
->num_mixers
] =
9380 alc268_capture_alt_mixer
;
9383 spec
->adc_nids
= alc268_adc_nids
;
9384 spec
->num_adc_nids
=
9385 ARRAY_SIZE(alc268_adc_nids
);
9386 spec
->mixers
[spec
->num_mixers
] =
9387 alc268_capture_mixer
;
9392 codec
->patch_ops
= alc_patch_ops
;
9393 if (board_config
== ALC268_AUTO
)
9394 spec
->init_hook
= alc268_auto_init
;
9400 * ALC861 channel source setting (2/6 channel selection for 3-stack)
9404 * set the path ways for 2 channel output
9405 * need to set the codec line out and mic 1 pin widgets to inputs
9407 static struct hda_verb alc861_threestack_ch2_init
[] = {
9408 /* set pin widget 1Ah (line in) for input */
9409 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9410 /* set pin widget 18h (mic1/2) for input, for mic also enable
9413 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9415 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
9417 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
9418 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
9424 * need to set the codec line out and mic 1 pin widgets to outputs
9426 static struct hda_verb alc861_threestack_ch6_init
[] = {
9427 /* set pin widget 1Ah (line in) for output (Back Surround)*/
9428 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9429 /* set pin widget 18h (mic1) for output (CLFE)*/
9430 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9432 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9433 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9435 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
9437 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
9438 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
9443 static struct hda_channel_mode alc861_threestack_modes
[2] = {
9444 { 2, alc861_threestack_ch2_init
},
9445 { 6, alc861_threestack_ch6_init
},
9447 /* Set mic1 as input and unmute the mixer */
9448 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
9449 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9450 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
9453 /* Set mic1 as output and mute mixer */
9454 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
9455 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9456 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
9460 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
9461 { 2, alc861_uniwill_m31_ch2_init
},
9462 { 4, alc861_uniwill_m31_ch4_init
},
9465 /* Set mic1 and line-in as input and unmute the mixer */
9466 static struct hda_verb alc861_asus_ch2_init
[] = {
9467 /* set pin widget 1Ah (line in) for input */
9468 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9469 /* set pin widget 18h (mic1/2) for input, for mic also enable
9472 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9474 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
9476 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
9477 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
9481 /* Set mic1 nad line-in as output and mute mixer */
9482 static struct hda_verb alc861_asus_ch6_init
[] = {
9483 /* set pin widget 1Ah (line in) for output (Back Surround)*/
9484 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9485 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
9486 /* set pin widget 18h (mic1) for output (CLFE)*/
9487 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9488 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
9489 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9490 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9492 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
9494 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
9495 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
9500 static struct hda_channel_mode alc861_asus_modes
[2] = {
9501 { 2, alc861_asus_ch2_init
},
9502 { 6, alc861_asus_ch6_init
},
9507 static struct snd_kcontrol_new alc861_base_mixer
[] = {
9508 /* output mixer control */
9509 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
9510 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
9511 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
9512 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
9513 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
9515 /*Input mixer control */
9516 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
9517 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
9518 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
9519 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
9520 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
9521 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
9522 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
9523 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
9524 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
9525 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
9527 /* Capture mixer control */
9528 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
9529 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
9531 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9532 .name
= "Capture Source",
9534 .info
= alc_mux_enum_info
,
9535 .get
= alc_mux_enum_get
,
9536 .put
= alc_mux_enum_put
,
9541 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
9542 /* output mixer control */
9543 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
9544 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
9545 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
9546 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
9547 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
9549 /* Input mixer control */
9550 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
9551 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
9552 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
9553 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
9554 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
9555 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
9556 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
9557 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
9558 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
9559 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
9561 /* Capture mixer control */
9562 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
9563 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
9565 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9566 .name
= "Capture Source",
9568 .info
= alc_mux_enum_info
,
9569 .get
= alc_mux_enum_get
,
9570 .put
= alc_mux_enum_put
,
9573 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9574 .name
= "Channel Mode",
9575 .info
= alc_ch_mode_info
,
9576 .get
= alc_ch_mode_get
,
9577 .put
= alc_ch_mode_put
,
9578 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
9583 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
9584 /* output mixer control */
9585 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
9586 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
9587 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
9589 /*Capture mixer control */
9590 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
9591 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
9593 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9594 .name
= "Capture Source",
9596 .info
= alc_mux_enum_info
,
9597 .get
= alc_mux_enum_get
,
9598 .put
= alc_mux_enum_put
,
9604 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
9605 /* output mixer control */
9606 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
9607 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
9608 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
9609 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
9610 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
9612 /* Input mixer control */
9613 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
9614 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
9615 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
9616 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
9617 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
9618 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
9619 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
9620 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
9621 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
9622 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
9624 /* Capture mixer control */
9625 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
9626 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
9628 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9629 .name
= "Capture Source",
9631 .info
= alc_mux_enum_info
,
9632 .get
= alc_mux_enum_get
,
9633 .put
= alc_mux_enum_put
,
9636 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9637 .name
= "Channel Mode",
9638 .info
= alc_ch_mode_info
,
9639 .get
= alc_ch_mode_get
,
9640 .put
= alc_ch_mode_put
,
9641 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
9646 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
9647 /* output mixer control */
9648 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
9649 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
9650 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
9651 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
9652 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
9654 /* Input mixer control */
9655 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
9656 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9657 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
9658 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
9659 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
9660 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
9661 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
9662 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
9663 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
9664 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
9666 /* Capture mixer control */
9667 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
9668 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
9670 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9671 .name
= "Capture Source",
9673 .info
= alc_mux_enum_info
,
9674 .get
= alc_mux_enum_get
,
9675 .put
= alc_mux_enum_put
,
9678 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9679 .name
= "Channel Mode",
9680 .info
= alc_ch_mode_info
,
9681 .get
= alc_ch_mode_get
,
9682 .put
= alc_ch_mode_put
,
9683 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
9688 /* additional mixer */
9689 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
9690 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
9691 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
9692 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT
),
9693 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT
),
9698 * generic initialization of ADC, input mixers and output mixers
9700 static struct hda_verb alc861_base_init_verbs
[] = {
9702 * Unmute ADC0 and set the default input to mic-in
9704 /* port-A for surround (rear panel) */
9705 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9706 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9707 /* port-B for mic-in (rear panel) with vref */
9708 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9709 /* port-C for line-in (rear panel) */
9710 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9711 /* port-D for Front */
9712 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9713 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9714 /* port-E for HP out (front panel) */
9715 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
9716 /* route front PCM to HP */
9717 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9718 /* port-F for mic-in (front panel) with vref */
9719 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9720 /* port-G for CLFE (rear panel) */
9721 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9722 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9723 /* port-H for side (rear panel) */
9724 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9725 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9727 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9728 /* route front mic to ADC1*/
9729 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9730 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9732 /* Unmute DAC0~3 & spdif out*/
9733 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9734 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9735 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9736 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9739 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9740 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9741 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9742 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9743 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9745 /* Unmute Stereo Mixer 15 */
9746 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9747 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9748 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9749 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
9751 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9752 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9753 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9754 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9755 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9756 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9757 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9758 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9759 /* hp used DAC 3 (Front) */
9760 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
9761 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9766 static struct hda_verb alc861_threestack_init_verbs
[] = {
9768 * Unmute ADC0 and set the default input to mic-in
9770 /* port-A for surround (rear panel) */
9771 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
9772 /* port-B for mic-in (rear panel) with vref */
9773 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9774 /* port-C for line-in (rear panel) */
9775 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9776 /* port-D for Front */
9777 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9778 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9779 /* port-E for HP out (front panel) */
9780 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
9781 /* route front PCM to HP */
9782 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9783 /* port-F for mic-in (front panel) with vref */
9784 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9785 /* port-G for CLFE (rear panel) */
9786 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
9787 /* port-H for side (rear panel) */
9788 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
9790 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9791 /* route front mic to ADC1*/
9792 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9793 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9794 /* Unmute DAC0~3 & spdif out*/
9795 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9796 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9797 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9798 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9799 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9801 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9802 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9803 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9804 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9805 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9807 /* Unmute Stereo Mixer 15 */
9808 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9809 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9810 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9811 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
9813 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9814 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9815 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9816 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9817 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9818 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9820 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9821 /* hp used DAC 3 (Front) */
9822 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
9823 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9827 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
9829 * Unmute ADC0 and set the default input to mic-in
9831 /* port-A for surround (rear panel) */
9832 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
9833 /* port-B for mic-in (rear panel) with vref */
9834 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9835 /* port-C for line-in (rear panel) */
9836 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9837 /* port-D for Front */
9838 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9839 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9840 /* port-E for HP out (front panel) */
9841 /* this has to be set to VREF80 */
9842 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9843 /* route front PCM to HP */
9844 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9845 /* port-F for mic-in (front panel) with vref */
9846 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9847 /* port-G for CLFE (rear panel) */
9848 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
9849 /* port-H for side (rear panel) */
9850 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
9852 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9853 /* route front mic to ADC1*/
9854 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9855 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9856 /* Unmute DAC0~3 & spdif out*/
9857 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9858 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9859 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9860 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9861 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9863 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9864 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9865 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9866 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9867 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9869 /* Unmute Stereo Mixer 15 */
9870 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9871 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9872 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9873 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
9875 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9876 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9877 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9878 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9879 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9880 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9881 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9882 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9883 /* hp used DAC 3 (Front) */
9884 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
9885 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9889 static struct hda_verb alc861_asus_init_verbs
[] = {
9891 * Unmute ADC0 and set the default input to mic-in
9893 /* port-A for surround (rear panel)
9894 * according to codec#0 this is the HP jack
9896 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
9897 /* route front PCM to HP */
9898 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
9899 /* port-B for mic-in (rear panel) with vref */
9900 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9901 /* port-C for line-in (rear panel) */
9902 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9903 /* port-D for Front */
9904 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9905 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9906 /* port-E for HP out (front panel) */
9907 /* this has to be set to VREF80 */
9908 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9909 /* route front PCM to HP */
9910 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
9911 /* port-F for mic-in (front panel) with vref */
9912 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
9913 /* port-G for CLFE (rear panel) */
9914 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9915 /* port-H for side (rear panel) */
9916 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
9918 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
9919 /* route front mic to ADC1*/
9920 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9921 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9922 /* Unmute DAC0~3 & spdif out*/
9923 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9924 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9925 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9926 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9927 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9928 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9929 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9930 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9931 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9932 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9934 /* Unmute Stereo Mixer 15 */
9935 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9937 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9938 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
9940 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9941 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9942 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9943 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9944 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9945 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9946 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9947 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9948 /* hp used DAC 3 (Front) */
9949 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
9950 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9954 /* additional init verbs for ASUS laptops */
9955 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
9956 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
9957 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
9962 * generic initialization of ADC, input mixers and output mixers
9964 static struct hda_verb alc861_auto_init_verbs
[] = {
9966 * Unmute ADC0 and set the default input to mic-in
9968 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
9969 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9971 /* Unmute DAC0~3 & spdif out*/
9972 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9973 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9974 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9975 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9976 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9978 /* Unmute Mixer 14 (mic) 1c (Line in)*/
9979 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9980 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9981 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9982 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9984 /* Unmute Stereo Mixer 15 */
9985 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9986 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9987 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
9988 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
9990 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9991 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9992 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9993 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9994 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9995 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9996 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9997 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9999 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10000 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10001 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
10002 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
10003 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10004 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10005 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
10006 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
10008 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
10013 static struct hda_verb alc861_toshiba_init_verbs
[] = {
10014 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10019 /* toggle speaker-output according to the hp-jack state */
10020 static void alc861_toshiba_automute(struct hda_codec
*codec
)
10022 unsigned int present
;
10024 present
= snd_hda_codec_read(codec
, 0x0f, 0,
10025 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
10026 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
10027 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
10028 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
10029 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
10032 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
10035 if ((res
>> 26) == ALC880_HP_EVENT
)
10036 alc861_toshiba_automute(codec
);
10039 /* pcm configuration: identiacal with ALC880 */
10040 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
10041 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
10042 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
10043 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
10046 #define ALC861_DIGOUT_NID 0x07
10048 static struct hda_channel_mode alc861_8ch_modes
[1] = {
10052 static hda_nid_t alc861_dac_nids
[4] = {
10053 /* front, surround, clfe, side */
10054 0x03, 0x06, 0x05, 0x04
10057 static hda_nid_t alc660_dac_nids
[3] = {
10058 /* front, clfe, surround */
10062 static hda_nid_t alc861_adc_nids
[1] = {
10067 static struct hda_input_mux alc861_capture_source
= {
10071 { "Front Mic", 0x3 },
10078 /* fill in the dac_nids table from the parsed pin configuration */
10079 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
,
10080 const struct auto_pin_cfg
*cfg
)
10085 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
10086 for (i
= 0; i
< cfg
->line_outs
; i
++) {
10087 nid
= cfg
->line_out_pins
[i
];
10089 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
10091 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
10094 spec
->multiout
.num_dacs
= cfg
->line_outs
;
10098 /* add playback controls from the parsed DAC table */
10099 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
10100 const struct auto_pin_cfg
*cfg
)
10103 static const char *chname
[4] = {
10104 "Front", "Surround", NULL
/*CLFE*/, "Side"
10109 for (i
= 0; i
< cfg
->line_outs
; i
++) {
10110 nid
= spec
->multiout
.dac_nids
[i
];
10115 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
10116 "Center Playback Switch",
10117 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
10121 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
10122 "LFE Playback Switch",
10123 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
10128 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1;
10130 if (nid
== alc861_dac_nids
[idx
])
10132 sprintf(name
, "%s Playback Switch", chname
[idx
]);
10133 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
10134 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
10143 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
10151 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
10153 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10154 "Headphone Playback Switch",
10155 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
10158 spec
->multiout
.hp_nid
= nid
;
10163 /* create playback/capture controls for input pins */
10164 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
,
10165 const struct auto_pin_cfg
*cfg
)
10167 struct hda_input_mux
*imux
= &spec
->private_imux
;
10168 int i
, err
, idx
, idx1
;
10170 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
10171 switch (cfg
->input_pins
[i
]) {
10174 idx
= 2; /* Line In */
10178 idx
= 2; /* Line In */
10182 idx
= 1; /* Mic In */
10186 idx
= 1; /* Mic In */
10196 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
10197 auto_pin_cfg_labels
[i
], idx
, 0x15);
10201 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
10202 imux
->items
[imux
->num_items
].index
= idx1
;
10208 static struct snd_kcontrol_new alc861_capture_mixer
[] = {
10209 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
10210 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
10213 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10214 /* The multiple "Capture Source" controls confuse alsamixer
10215 * So call somewhat different..
10216 *FIXME: the controls appear in the "playback" view!
10218 /* .name = "Capture Source", */
10219 .name
= "Input Source",
10221 .info
= alc_mux_enum_info
,
10222 .get
= alc_mux_enum_get
,
10223 .put
= alc_mux_enum_put
,
10228 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
10230 int pin_type
, int dac_idx
)
10232 /* set as output */
10234 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
10236 snd_hda_codec_write(codec
, dac_idx
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
10241 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
10243 struct alc_spec
*spec
= codec
->spec
;
10246 alc_subsystem_id(codec
, 0x0e, 0x0f, 0x0b);
10247 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
10248 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
10249 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
10251 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
10252 spec
->multiout
.dac_nids
[i
]);
10256 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
10258 struct alc_spec
*spec
= codec
->spec
;
10261 pin
= spec
->autocfg
.hp_pins
[0];
10262 if (pin
) /* connect to front */
10263 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
10264 spec
->multiout
.dac_nids
[0]);
10267 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
10269 struct alc_spec
*spec
= codec
->spec
;
10272 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
10273 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
10274 if (nid
>= 0x0c && nid
<= 0x11) {
10275 snd_hda_codec_write(codec
, nid
, 0,
10276 AC_VERB_SET_PIN_WIDGET_CONTROL
,
10277 i
<= AUTO_PIN_FRONT_MIC
?
10278 PIN_VREF80
: PIN_IN
);
10283 /* parse the BIOS configuration and set up the alc_spec */
10284 /* return 1 if successful, 0 if the proper config is not found,
10285 * or a negative error code
10287 static int alc861_parse_auto_config(struct hda_codec
*codec
)
10289 struct alc_spec
*spec
= codec
->spec
;
10291 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
10293 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10297 if (!spec
->autocfg
.line_outs
)
10298 return 0; /* can't find valid BIOS pin config */
10300 err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
);
10303 err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
10306 err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pins
[0]);
10309 err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
10313 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
10315 if (spec
->autocfg
.dig_out_pin
)
10316 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
10318 if (spec
->kctl_alloc
)
10319 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
10321 spec
->init_verbs
[spec
->num_init_verbs
++] = alc861_auto_init_verbs
;
10323 spec
->num_mux_defs
= 1;
10324 spec
->input_mux
= &spec
->private_imux
;
10326 spec
->adc_nids
= alc861_adc_nids
;
10327 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
10328 spec
->mixers
[spec
->num_mixers
] = alc861_capture_mixer
;
10329 spec
->num_mixers
++;
10334 /* additional initialization for auto-configuration model */
10335 static void alc861_auto_init(struct hda_codec
*codec
)
10337 alc861_auto_init_multi_out(codec
);
10338 alc861_auto_init_hp_out(codec
);
10339 alc861_auto_init_analog_input(codec
);
10342 #ifdef CONFIG_SND_HDA_POWER_SAVE
10343 static struct hda_amp_list alc861_loopbacks
[] = {
10344 { 0x15, HDA_INPUT
, 0 },
10345 { 0x15, HDA_INPUT
, 1 },
10346 { 0x15, HDA_INPUT
, 2 },
10347 { 0x15, HDA_INPUT
, 3 },
10354 * configuration and preset
10356 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
10357 [ALC861_3ST
] = "3stack",
10358 [ALC660_3ST
] = "3stack-660",
10359 [ALC861_3ST_DIG
] = "3stack-dig",
10360 [ALC861_6ST_DIG
] = "6stack-dig",
10361 [ALC861_UNIWILL_M31
] = "uniwill-m31",
10362 [ALC861_TOSHIBA
] = "toshiba",
10363 [ALC861_ASUS
] = "asus",
10364 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
10365 [ALC861_AUTO
] = "auto",
10368 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
10369 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
10370 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
10371 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
10372 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
10373 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
10374 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
10375 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
10376 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
10377 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
10378 * Any other models that need this preset?
10380 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
10381 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
10382 SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31
),
10383 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
10384 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
10385 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
10386 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
10387 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
10391 static struct alc_config_preset alc861_presets
[] = {
10393 .mixers
= { alc861_3ST_mixer
},
10394 .init_verbs
= { alc861_threestack_init_verbs
},
10395 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10396 .dac_nids
= alc861_dac_nids
,
10397 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
10398 .channel_mode
= alc861_threestack_modes
,
10400 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10401 .adc_nids
= alc861_adc_nids
,
10402 .input_mux
= &alc861_capture_source
,
10404 [ALC861_3ST_DIG
] = {
10405 .mixers
= { alc861_base_mixer
},
10406 .init_verbs
= { alc861_threestack_init_verbs
},
10407 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10408 .dac_nids
= alc861_dac_nids
,
10409 .dig_out_nid
= ALC861_DIGOUT_NID
,
10410 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
10411 .channel_mode
= alc861_threestack_modes
,
10413 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10414 .adc_nids
= alc861_adc_nids
,
10415 .input_mux
= &alc861_capture_source
,
10417 [ALC861_6ST_DIG
] = {
10418 .mixers
= { alc861_base_mixer
},
10419 .init_verbs
= { alc861_base_init_verbs
},
10420 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10421 .dac_nids
= alc861_dac_nids
,
10422 .dig_out_nid
= ALC861_DIGOUT_NID
,
10423 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
10424 .channel_mode
= alc861_8ch_modes
,
10425 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10426 .adc_nids
= alc861_adc_nids
,
10427 .input_mux
= &alc861_capture_source
,
10430 .mixers
= { alc861_3ST_mixer
},
10431 .init_verbs
= { alc861_threestack_init_verbs
},
10432 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
10433 .dac_nids
= alc660_dac_nids
,
10434 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
10435 .channel_mode
= alc861_threestack_modes
,
10437 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10438 .adc_nids
= alc861_adc_nids
,
10439 .input_mux
= &alc861_capture_source
,
10441 [ALC861_UNIWILL_M31
] = {
10442 .mixers
= { alc861_uniwill_m31_mixer
},
10443 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
10444 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10445 .dac_nids
= alc861_dac_nids
,
10446 .dig_out_nid
= ALC861_DIGOUT_NID
,
10447 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
10448 .channel_mode
= alc861_uniwill_m31_modes
,
10450 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10451 .adc_nids
= alc861_adc_nids
,
10452 .input_mux
= &alc861_capture_source
,
10454 [ALC861_TOSHIBA
] = {
10455 .mixers
= { alc861_toshiba_mixer
},
10456 .init_verbs
= { alc861_base_init_verbs
,
10457 alc861_toshiba_init_verbs
},
10458 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10459 .dac_nids
= alc861_dac_nids
,
10460 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10461 .channel_mode
= alc883_3ST_2ch_modes
,
10462 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10463 .adc_nids
= alc861_adc_nids
,
10464 .input_mux
= &alc861_capture_source
,
10465 .unsol_event
= alc861_toshiba_unsol_event
,
10466 .init_hook
= alc861_toshiba_automute
,
10469 .mixers
= { alc861_asus_mixer
},
10470 .init_verbs
= { alc861_asus_init_verbs
},
10471 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10472 .dac_nids
= alc861_dac_nids
,
10473 .dig_out_nid
= ALC861_DIGOUT_NID
,
10474 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
10475 .channel_mode
= alc861_asus_modes
,
10478 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10479 .adc_nids
= alc861_adc_nids
,
10480 .input_mux
= &alc861_capture_source
,
10482 [ALC861_ASUS_LAPTOP
] = {
10483 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
10484 .init_verbs
= { alc861_asus_init_verbs
,
10485 alc861_asus_laptop_init_verbs
},
10486 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
10487 .dac_nids
= alc861_dac_nids
,
10488 .dig_out_nid
= ALC861_DIGOUT_NID
,
10489 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
10490 .channel_mode
= alc883_3ST_2ch_modes
,
10492 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
10493 .adc_nids
= alc861_adc_nids
,
10494 .input_mux
= &alc861_capture_source
,
10499 static int patch_alc861(struct hda_codec
*codec
)
10501 struct alc_spec
*spec
;
10505 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
10509 codec
->spec
= spec
;
10511 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
10515 if (board_config
< 0) {
10516 printk(KERN_INFO
"hda_codec: Unknown model for ALC861, "
10517 "trying auto-probe from BIOS...\n");
10518 board_config
= ALC861_AUTO
;
10521 if (board_config
== ALC861_AUTO
) {
10522 /* automatic parse from the BIOS config */
10523 err
= alc861_parse_auto_config(codec
);
10529 "hda_codec: Cannot set up configuration "
10530 "from BIOS. Using base mode...\n");
10531 board_config
= ALC861_3ST_DIG
;
10535 if (board_config
!= ALC861_AUTO
)
10536 setup_preset(spec
, &alc861_presets
[board_config
]);
10538 spec
->stream_name_analog
= "ALC861 Analog";
10539 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
10540 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
10542 spec
->stream_name_digital
= "ALC861 Digital";
10543 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
10544 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
10546 codec
->patch_ops
= alc_patch_ops
;
10547 if (board_config
== ALC861_AUTO
)
10548 spec
->init_hook
= alc861_auto_init
;
10549 #ifdef CONFIG_SND_HDA_POWER_SAVE
10550 if (!spec
->loopback
.amplist
)
10551 spec
->loopback
.amplist
= alc861_loopbacks
;
10558 * ALC861-VD support
10562 * In addition, an independent DAC
10564 #define ALC861VD_DIGOUT_NID 0x06
10566 static hda_nid_t alc861vd_dac_nids
[4] = {
10567 /* front, surr, clfe, side surr */
10568 0x02, 0x03, 0x04, 0x05
10571 /* dac_nids for ALC660vd are in a different order - according to
10572 * Realtek's driver.
10573 * This should probably tesult in a different mixer for 6stack models
10574 * of ALC660vd codecs, but for now there is only 3stack mixer
10575 * - and it is the same as in 861vd.
10576 * adc_nids in ALC660vd are (is) the same as in 861vd
10578 static hda_nid_t alc660vd_dac_nids
[3] = {
10579 /* front, rear, clfe, rear_surr */
10583 static hda_nid_t alc861vd_adc_nids
[1] = {
10589 /* FIXME: should be a matrix-type input source selection */
10590 static struct hda_input_mux alc861vd_capture_source
= {
10594 { "Front Mic", 0x1 },
10600 static struct hda_input_mux alc861vd_dallas_capture_source
= {
10603 { "Front Mic", 0x0 },
10604 { "ATAPI Mic", 0x1 },
10605 { "Line In", 0x5 },
10609 static struct hda_input_mux alc861vd_hp_capture_source
= {
10612 { "Front Mic", 0x0 },
10613 { "ATAPI Mic", 0x1 },
10617 #define alc861vd_mux_enum_info alc_mux_enum_info
10618 #define alc861vd_mux_enum_get alc_mux_enum_get
10620 static int alc861vd_mux_enum_put(struct snd_kcontrol
*kcontrol
,
10621 struct snd_ctl_elem_value
*ucontrol
)
10623 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
10624 struct alc_spec
*spec
= codec
->spec
;
10625 const struct hda_input_mux
*imux
= spec
->input_mux
;
10626 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
10627 static hda_nid_t capture_mixers
[1] = { 0x22 };
10628 hda_nid_t nid
= capture_mixers
[adc_idx
];
10629 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
10630 unsigned int i
, idx
;
10632 idx
= ucontrol
->value
.enumerated
.item
[0];
10633 if (idx
>= imux
->num_items
)
10634 idx
= imux
->num_items
- 1;
10635 if (*cur_val
== idx
)
10637 for (i
= 0; i
< imux
->num_items
; i
++) {
10638 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
10639 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
10640 imux
->items
[i
].index
,
10650 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
10657 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
10658 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
10659 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10660 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10661 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10668 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
10669 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10670 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10671 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10672 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10676 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
10677 { 6, alc861vd_6stack_ch6_init
},
10678 { 8, alc861vd_6stack_ch8_init
},
10681 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
10683 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10684 .name
= "Channel Mode",
10685 .info
= alc_ch_mode_info
,
10686 .get
= alc_ch_mode_get
,
10687 .put
= alc_ch_mode_put
,
10692 static struct snd_kcontrol_new alc861vd_capture_mixer
[] = {
10693 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
10694 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
10697 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10698 /* The multiple "Capture Source" controls confuse alsamixer
10699 * So call somewhat different..
10700 *FIXME: the controls appear in the "playback" view!
10702 /* .name = "Capture Source", */
10703 .name
= "Input Source",
10705 .info
= alc861vd_mux_enum_info
,
10706 .get
= alc861vd_mux_enum_get
,
10707 .put
= alc861vd_mux_enum_put
,
10712 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
10713 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
10715 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
10716 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10717 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
10719 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10720 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
10722 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
10724 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
10726 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
10727 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
10729 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
10730 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
10732 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
10734 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10735 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10736 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10738 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10739 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10740 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10742 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10743 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10745 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10746 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10748 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
10749 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
10754 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
10755 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10756 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
10758 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
10760 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10761 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10762 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10764 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10765 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10766 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10768 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10769 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10771 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10772 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10774 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
10775 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
10780 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
10781 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10782 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
10783 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10785 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
10787 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10788 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10789 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10791 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10792 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10793 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10795 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
10796 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
10801 /* Pin assignment: Front=0x14, HP = 0x15,
10802 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
10804 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
10805 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10806 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
10807 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10808 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
10809 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10810 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10811 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10812 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10813 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT
),
10814 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT
),
10818 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
10819 * Front Mic=0x18, ATAPI Mic = 0x19,
10821 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
10822 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10823 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
10824 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
10825 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
10826 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10827 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10828 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
10829 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
10835 * generic initialization of ADC, input mixers and output mixers
10837 static struct hda_verb alc861vd_volume_init_verbs
[] = {
10839 * Unmute ADC0 and set the default input to mic-in
10841 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
10842 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10844 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
10845 * the analog-loopback mixer widget
10847 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10848 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10849 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10850 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10851 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10852 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10854 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
10855 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10856 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10857 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
10858 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
10861 * Set up output mixers (0x02 - 0x05)
10863 /* set vol=0 to output mixers */
10864 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10865 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10866 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10867 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10869 /* set up input amps for analog loopback */
10870 /* Amp Indices: DAC = 0, mixer = 1 */
10871 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10872 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10873 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10874 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10875 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10876 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10877 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10878 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10884 * 3-stack pin configuration:
10885 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
10887 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
10889 * Set pin mode and muting
10891 /* set front pin widgets 0x14 for output */
10892 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10893 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10894 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
10896 /* Mic (rear) pin: input vref at 80% */
10897 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10898 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10899 /* Front Mic pin: input vref at 80% */
10900 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10901 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10902 /* Line In pin: input */
10903 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10904 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10905 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10906 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10907 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10908 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
10909 /* CD pin widget for input */
10910 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10916 * 6-stack pin configuration:
10918 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
10920 * Set pin mode and muting
10922 /* set front pin widgets 0x14 for output */
10923 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10924 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10925 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
10927 /* Rear Pin: output 1 (0x0d) */
10928 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10929 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10930 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
10931 /* CLFE Pin: output 2 (0x0e) */
10932 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10933 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10934 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
10935 /* Side Pin: output 3 (0x0f) */
10936 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10937 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10938 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
10940 /* Mic (rear) pin: input vref at 80% */
10941 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10942 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10943 /* Front Mic pin: input vref at 80% */
10944 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10945 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10946 /* Line In pin: input */
10947 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10948 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10949 /* Line-2 In: Headphone output (output 0 - 0x0c) */
10950 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10951 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10952 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
10953 /* CD pin widget for input */
10954 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10959 static struct hda_verb alc861vd_eapd_verbs
[] = {
10960 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10964 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
10965 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10966 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10967 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
10968 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
10969 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
10973 /* toggle speaker-output according to the hp-jack state */
10974 static void alc861vd_lenovo_hp_automute(struct hda_codec
*codec
)
10976 unsigned int present
;
10977 unsigned char bits
;
10979 present
= snd_hda_codec_read(codec
, 0x1b, 0,
10980 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
10981 bits
= present
? HDA_AMP_MUTE
: 0;
10982 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
10983 HDA_AMP_MUTE
, bits
);
10986 static void alc861vd_lenovo_mic_automute(struct hda_codec
*codec
)
10988 unsigned int present
;
10989 unsigned char bits
;
10991 present
= snd_hda_codec_read(codec
, 0x18, 0,
10992 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
10993 bits
= present
? HDA_AMP_MUTE
: 0;
10994 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
10995 HDA_AMP_MUTE
, bits
);
10998 static void alc861vd_lenovo_automute(struct hda_codec
*codec
)
11000 alc861vd_lenovo_hp_automute(codec
);
11001 alc861vd_lenovo_mic_automute(codec
);
11004 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
11007 switch (res
>> 26) {
11008 case ALC880_HP_EVENT
:
11009 alc861vd_lenovo_hp_automute(codec
);
11011 case ALC880_MIC_EVENT
:
11012 alc861vd_lenovo_mic_automute(codec
);
11017 static struct hda_verb alc861vd_dallas_verbs
[] = {
11018 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11019 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11020 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11021 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11023 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11025 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11026 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11027 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11028 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11029 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11030 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11032 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11033 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11034 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11035 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11036 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11037 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11038 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11039 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11041 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
11042 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11043 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
11044 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11045 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11046 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11047 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11048 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11050 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11051 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11052 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11053 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11055 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11056 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11057 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11062 /* toggle speaker-output according to the hp-jack state */
11063 static void alc861vd_dallas_automute(struct hda_codec
*codec
)
11065 unsigned int present
;
11067 present
= snd_hda_codec_read(codec
, 0x15, 0,
11068 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11069 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11070 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
11073 static void alc861vd_dallas_unsol_event(struct hda_codec
*codec
, unsigned int res
)
11075 if ((res
>> 26) == ALC880_HP_EVENT
)
11076 alc861vd_dallas_automute(codec
);
11079 #ifdef CONFIG_SND_HDA_POWER_SAVE
11080 #define alc861vd_loopbacks alc880_loopbacks
11083 /* pcm configuration: identiacal with ALC880 */
11084 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
11085 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
11086 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
11087 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
11090 * configuration and preset
11092 static const char *alc861vd_models
[ALC861VD_MODEL_LAST
] = {
11093 [ALC660VD_3ST
] = "3stack-660",
11094 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
11095 [ALC861VD_3ST
] = "3stack",
11096 [ALC861VD_3ST_DIG
] = "3stack-digout",
11097 [ALC861VD_6ST_DIG
] = "6stack-digout",
11098 [ALC861VD_LENOVO
] = "lenovo",
11099 [ALC861VD_DALLAS
] = "dallas",
11100 [ALC861VD_HP
] = "hp",
11101 [ALC861VD_AUTO
] = "auto",
11104 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
11105 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
11106 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST
),
11107 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
11108 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
11109 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
11111 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
11112 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS
),
11113 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO
),
11114 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO
),
11115 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
11116 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
11117 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
11118 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
11119 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
11123 static struct alc_config_preset alc861vd_presets
[] = {
11125 .mixers
= { alc861vd_3st_mixer
},
11126 .init_verbs
= { alc861vd_volume_init_verbs
,
11127 alc861vd_3stack_init_verbs
},
11128 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
11129 .dac_nids
= alc660vd_dac_nids
,
11130 .num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
),
11131 .adc_nids
= alc861vd_adc_nids
,
11132 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11133 .channel_mode
= alc861vd_3stack_2ch_modes
,
11134 .input_mux
= &alc861vd_capture_source
,
11136 [ALC660VD_3ST_DIG
] = {
11137 .mixers
= { alc861vd_3st_mixer
},
11138 .init_verbs
= { alc861vd_volume_init_verbs
,
11139 alc861vd_3stack_init_verbs
},
11140 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
11141 .dac_nids
= alc660vd_dac_nids
,
11142 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
11143 .num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
),
11144 .adc_nids
= alc861vd_adc_nids
,
11145 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11146 .channel_mode
= alc861vd_3stack_2ch_modes
,
11147 .input_mux
= &alc861vd_capture_source
,
11150 .mixers
= { alc861vd_3st_mixer
},
11151 .init_verbs
= { alc861vd_volume_init_verbs
,
11152 alc861vd_3stack_init_verbs
},
11153 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
11154 .dac_nids
= alc861vd_dac_nids
,
11155 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11156 .channel_mode
= alc861vd_3stack_2ch_modes
,
11157 .input_mux
= &alc861vd_capture_source
,
11159 [ALC861VD_3ST_DIG
] = {
11160 .mixers
= { alc861vd_3st_mixer
},
11161 .init_verbs
= { alc861vd_volume_init_verbs
,
11162 alc861vd_3stack_init_verbs
},
11163 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
11164 .dac_nids
= alc861vd_dac_nids
,
11165 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
11166 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11167 .channel_mode
= alc861vd_3stack_2ch_modes
,
11168 .input_mux
= &alc861vd_capture_source
,
11170 [ALC861VD_6ST_DIG
] = {
11171 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
11172 .init_verbs
= { alc861vd_volume_init_verbs
,
11173 alc861vd_6stack_init_verbs
},
11174 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
11175 .dac_nids
= alc861vd_dac_nids
,
11176 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
11177 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
11178 .channel_mode
= alc861vd_6stack_modes
,
11179 .input_mux
= &alc861vd_capture_source
,
11181 [ALC861VD_LENOVO
] = {
11182 .mixers
= { alc861vd_lenovo_mixer
},
11183 .init_verbs
= { alc861vd_volume_init_verbs
,
11184 alc861vd_3stack_init_verbs
,
11185 alc861vd_eapd_verbs
,
11186 alc861vd_lenovo_unsol_verbs
},
11187 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
11188 .dac_nids
= alc660vd_dac_nids
,
11189 .num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
),
11190 .adc_nids
= alc861vd_adc_nids
,
11191 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11192 .channel_mode
= alc861vd_3stack_2ch_modes
,
11193 .input_mux
= &alc861vd_capture_source
,
11194 .unsol_event
= alc861vd_lenovo_unsol_event
,
11195 .init_hook
= alc861vd_lenovo_automute
,
11197 [ALC861VD_DALLAS
] = {
11198 .mixers
= { alc861vd_dallas_mixer
},
11199 .init_verbs
= { alc861vd_dallas_verbs
},
11200 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
11201 .dac_nids
= alc861vd_dac_nids
,
11202 .num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
),
11203 .adc_nids
= alc861vd_adc_nids
,
11204 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11205 .channel_mode
= alc861vd_3stack_2ch_modes
,
11206 .input_mux
= &alc861vd_dallas_capture_source
,
11207 .unsol_event
= alc861vd_dallas_unsol_event
,
11208 .init_hook
= alc861vd_dallas_automute
,
11211 .mixers
= { alc861vd_hp_mixer
},
11212 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
11213 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
11214 .dac_nids
= alc861vd_dac_nids
,
11215 .num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
),
11216 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
11217 .adc_nids
= alc861vd_adc_nids
,
11218 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
11219 .channel_mode
= alc861vd_3stack_2ch_modes
,
11220 .input_mux
= &alc861vd_hp_capture_source
,
11221 .unsol_event
= alc861vd_dallas_unsol_event
,
11222 .init_hook
= alc861vd_dallas_automute
,
11227 * BIOS auto configuration
11229 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
11230 hda_nid_t nid
, int pin_type
, int dac_idx
)
11232 /* set as output */
11233 snd_hda_codec_write(codec
, nid
, 0,
11234 AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
11235 snd_hda_codec_write(codec
, nid
, 0,
11236 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
11239 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
11241 struct alc_spec
*spec
= codec
->spec
;
11244 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
11245 for (i
= 0; i
<= HDA_SIDE
; i
++) {
11246 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
11247 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
11249 alc861vd_auto_set_output_and_unmute(codec
, nid
,
11255 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
11257 struct alc_spec
*spec
= codec
->spec
;
11260 pin
= spec
->autocfg
.hp_pins
[0];
11261 if (pin
) /* connect to front and use dac 0 */
11262 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
11265 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
11266 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
11268 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
11270 struct alc_spec
*spec
= codec
->spec
;
11273 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
11274 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
11275 if (alc861vd_is_input_pin(nid
)) {
11276 snd_hda_codec_write(codec
, nid
, 0,
11277 AC_VERB_SET_PIN_WIDGET_CONTROL
,
11278 i
<= AUTO_PIN_FRONT_MIC
?
11279 PIN_VREF80
: PIN_IN
);
11280 if (nid
!= ALC861VD_PIN_CD_NID
)
11281 snd_hda_codec_write(codec
, nid
, 0,
11282 AC_VERB_SET_AMP_GAIN_MUTE
,
11288 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
11289 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
11291 /* add playback controls from the parsed DAC table */
11292 /* Based on ALC880 version. But ALC861VD has separate,
11293 * different NIDs for mute/unmute switch and volume control */
11294 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
11295 const struct auto_pin_cfg
*cfg
)
11298 static const char *chname
[4] = {"Front", "Surround", "CLFE", "Side"};
11299 hda_nid_t nid_v
, nid_s
;
11302 for (i
= 0; i
< cfg
->line_outs
; i
++) {
11303 if (!spec
->multiout
.dac_nids
[i
])
11305 nid_v
= alc861vd_idx_to_mixer_vol(
11307 spec
->multiout
.dac_nids
[i
]));
11308 nid_s
= alc861vd_idx_to_mixer_switch(
11310 spec
->multiout
.dac_nids
[i
]));
11314 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11315 "Center Playback Volume",
11316 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
11320 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
11321 "LFE Playback Volume",
11322 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
11326 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
11327 "Center Playback Switch",
11328 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
11332 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
11333 "LFE Playback Switch",
11334 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
11339 sprintf(name
, "%s Playback Volume", chname
[i
]);
11340 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
11341 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
11345 sprintf(name
, "%s Playback Switch", chname
[i
]);
11346 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
11347 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
11356 /* add playback controls for speaker and HP outputs */
11357 /* Based on ALC880 version. But ALC861VD has separate,
11358 * different NIDs for mute/unmute switch and volume control */
11359 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
11360 hda_nid_t pin
, const char *pfx
)
11362 hda_nid_t nid_v
, nid_s
;
11369 if (alc880_is_fixed_pin(pin
)) {
11370 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
11371 /* specify the DAC as the extra output */
11372 if (!spec
->multiout
.hp_nid
)
11373 spec
->multiout
.hp_nid
= nid_v
;
11375 spec
->multiout
.extra_out_nid
[0] = nid_v
;
11376 /* control HP volume/switch on the output mixer amp */
11377 nid_v
= alc861vd_idx_to_mixer_vol(
11378 alc880_fixed_pin_idx(pin
));
11379 nid_s
= alc861vd_idx_to_mixer_switch(
11380 alc880_fixed_pin_idx(pin
));
11382 sprintf(name
, "%s Playback Volume", pfx
);
11383 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
11384 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
11387 sprintf(name
, "%s Playback Switch", pfx
);
11388 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
11389 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
11392 } else if (alc880_is_multi_pin(pin
)) {
11393 /* set manual connection */
11394 /* we have only a switch on HP-out PIN */
11395 sprintf(name
, "%s Playback Switch", pfx
);
11396 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
11397 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
11404 /* parse the BIOS configuration and set up the alc_spec
11405 * return 1 if successful, 0 if the proper config is not found,
11406 * or a negative error code
11407 * Based on ALC880 version - had to change it to override
11408 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
11409 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
11411 struct alc_spec
*spec
= codec
->spec
;
11413 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
11415 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
11419 if (!spec
->autocfg
.line_outs
)
11420 return 0; /* can't find valid BIOS pin config */
11422 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
11425 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
11428 err
= alc861vd_auto_create_extra_out(spec
,
11429 spec
->autocfg
.speaker_pins
[0],
11433 err
= alc861vd_auto_create_extra_out(spec
,
11434 spec
->autocfg
.hp_pins
[0],
11438 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
11442 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
11444 if (spec
->autocfg
.dig_out_pin
)
11445 spec
->multiout
.dig_out_nid
= ALC861VD_DIGOUT_NID
;
11447 if (spec
->kctl_alloc
)
11448 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
11450 spec
->init_verbs
[spec
->num_init_verbs
++]
11451 = alc861vd_volume_init_verbs
;
11453 spec
->num_mux_defs
= 1;
11454 spec
->input_mux
= &spec
->private_imux
;
11456 err
= alc_auto_add_mic_boost(codec
);
11463 /* additional initialization for auto-configuration model */
11464 static void alc861vd_auto_init(struct hda_codec
*codec
)
11466 alc861vd_auto_init_multi_out(codec
);
11467 alc861vd_auto_init_hp_out(codec
);
11468 alc861vd_auto_init_analog_input(codec
);
11471 static int patch_alc861vd(struct hda_codec
*codec
)
11473 struct alc_spec
*spec
;
11474 int err
, board_config
;
11476 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
11480 codec
->spec
= spec
;
11482 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
11486 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
11487 printk(KERN_INFO
"hda_codec: Unknown model for ALC660VD/"
11488 "ALC861VD, trying auto-probe from BIOS...\n");
11489 board_config
= ALC861VD_AUTO
;
11492 if (board_config
== ALC861VD_AUTO
) {
11493 /* automatic parse from the BIOS config */
11494 err
= alc861vd_parse_auto_config(codec
);
11500 "hda_codec: Cannot set up configuration "
11501 "from BIOS. Using base mode...\n");
11502 board_config
= ALC861VD_3ST
;
11506 if (board_config
!= ALC861VD_AUTO
)
11507 setup_preset(spec
, &alc861vd_presets
[board_config
]);
11509 spec
->stream_name_analog
= "ALC861VD Analog";
11510 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
11511 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
11513 spec
->stream_name_digital
= "ALC861VD Digital";
11514 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
11515 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
11517 spec
->adc_nids
= alc861vd_adc_nids
;
11518 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
11520 spec
->mixers
[spec
->num_mixers
] = alc861vd_capture_mixer
;
11521 spec
->num_mixers
++;
11523 codec
->patch_ops
= alc_patch_ops
;
11525 if (board_config
== ALC861VD_AUTO
)
11526 spec
->init_hook
= alc861vd_auto_init
;
11527 #ifdef CONFIG_SND_HDA_POWER_SAVE
11528 if (!spec
->loopback
.amplist
)
11529 spec
->loopback
.amplist
= alc861vd_loopbacks
;
11538 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
11539 * configuration. Each pin widget can choose any input DACs and a mixer.
11540 * Each ADC is connected from a mixer of all inputs. This makes possible
11541 * 6-channel independent captures.
11543 * In addition, an independent DAC for the multi-playback (not used in this
11546 #define ALC662_DIGOUT_NID 0x06
11547 #define ALC662_DIGIN_NID 0x0a
11549 static hda_nid_t alc662_dac_nids
[4] = {
11550 /* front, rear, clfe, rear_surr */
11554 static hda_nid_t alc662_adc_nids
[1] = {
11559 /* FIXME: should be a matrix-type input source selection */
11561 static struct hda_input_mux alc662_capture_source
= {
11565 { "Front Mic", 0x1 },
11571 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
11579 static struct hda_input_mux alc662_eeepc_capture_source
= {
11587 #define alc662_mux_enum_info alc_mux_enum_info
11588 #define alc662_mux_enum_get alc_mux_enum_get
11590 static int alc662_mux_enum_put(struct snd_kcontrol
*kcontrol
,
11591 struct snd_ctl_elem_value
*ucontrol
)
11593 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
11594 struct alc_spec
*spec
= codec
->spec
;
11595 const struct hda_input_mux
*imux
= spec
->input_mux
;
11596 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
11597 static hda_nid_t capture_mixers
[2] = { 0x23, 0x22 };
11598 hda_nid_t nid
= capture_mixers
[adc_idx
];
11599 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
11600 unsigned int i
, idx
;
11602 idx
= ucontrol
->value
.enumerated
.item
[0];
11603 if (idx
>= imux
->num_items
)
11604 idx
= imux
->num_items
- 1;
11605 if (*cur_val
== idx
)
11607 for (i
= 0; i
< imux
->num_items
; i
++) {
11608 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
11609 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
11610 imux
->items
[i
].index
,
11619 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
11626 static struct hda_verb alc662_3ST_ch2_init
[] = {
11627 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11628 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11629 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11630 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11637 static struct hda_verb alc662_3ST_ch6_init
[] = {
11638 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11639 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11640 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
11641 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11642 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11643 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
11647 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
11648 { 2, alc662_3ST_ch2_init
},
11649 { 6, alc662_3ST_ch6_init
},
11655 static struct hda_verb alc662_sixstack_ch6_init
[] = {
11656 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11657 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11658 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11665 static struct hda_verb alc662_sixstack_ch8_init
[] = {
11666 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11667 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11668 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11672 static struct hda_channel_mode alc662_5stack_modes
[2] = {
11673 { 2, alc662_sixstack_ch6_init
},
11674 { 6, alc662_sixstack_ch8_init
},
11677 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
11678 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
11681 static struct snd_kcontrol_new alc662_base_mixer
[] = {
11682 /* output mixer control */
11683 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
11684 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT
),
11685 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
11686 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11687 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
11688 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
11689 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT
),
11690 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT
),
11691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11693 /*Input mixer control */
11694 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
11695 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
11696 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
11697 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
11698 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
11699 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
11700 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
11701 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
11703 /* Capture mixer control */
11704 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
11705 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
11707 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11708 .name
= "Capture Source",
11710 .info
= alc_mux_enum_info
,
11711 .get
= alc_mux_enum_get
,
11712 .put
= alc_mux_enum_put
,
11717 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
11718 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11719 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
11720 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11721 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11722 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11723 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11724 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11725 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11726 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11727 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11728 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11729 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
11730 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
11731 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
11732 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
11734 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11735 /* .name = "Capture Source", */
11736 .name
= "Input Source",
11738 .info
= alc662_mux_enum_info
,
11739 .get
= alc662_mux_enum_get
,
11740 .put
= alc662_mux_enum_put
,
11745 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
11746 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11747 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
11748 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
11749 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT
),
11750 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
11751 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
11752 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT
),
11753 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT
),
11754 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11755 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
11756 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
11757 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11758 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11760 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11761 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11762 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11763 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
11764 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
11765 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
11766 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
11768 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11769 /* .name = "Capture Source", */
11770 .name
= "Input Source",
11772 .info
= alc662_mux_enum_info
,
11773 .get
= alc662_mux_enum_get
,
11774 .put
= alc662_mux_enum_put
,
11779 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
11780 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11781 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
11782 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
11783 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x03, 2, HDA_INPUT
),
11784 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11785 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
11786 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
11787 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11788 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11789 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
11790 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
11792 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11793 /* .name = "Capture Source", */
11794 .name
= "Input Source",
11796 .info
= alc662_mux_enum_info
,
11797 .get
= alc662_mux_enum_get
,
11798 .put
= alc662_mux_enum_put
,
11803 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
11804 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
11806 HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
11807 HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
11809 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT
),
11810 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
11811 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
11813 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
11814 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
11815 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
11819 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
11821 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11822 .name
= "Channel Mode",
11823 .info
= alc_ch_mode_info
,
11824 .get
= alc_ch_mode_get
,
11825 .put
= alc_ch_mode_put
,
11830 static struct hda_verb alc662_init_verbs
[] = {
11831 /* ADC: mute amp left and right */
11832 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11833 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11834 /* Front mixer: unmute input/output amp left and right (volume = 0) */
11836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11840 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11842 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11843 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11844 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11845 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11847 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11849 /* Front Pin: output 0 (0x0c) */
11850 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11851 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11853 /* Rear Pin: output 1 (0x0d) */
11854 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11855 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11857 /* CLFE Pin: output 2 (0x0e) */
11858 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
11859 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11861 /* Mic (rear) pin: input vref at 80% */
11862 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11863 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11864 /* Front Mic pin: input vref at 80% */
11865 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
11866 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11867 /* Line In pin: input */
11868 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11869 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11870 /* Line-2 In: Headphone output (output 0 - 0x0c) */
11871 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
11872 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11873 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
11874 /* CD pin widget for input */
11875 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
11877 /* FIXME: use matrix-type input source selection */
11878 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11880 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11881 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11882 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11883 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
11885 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11886 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11887 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11888 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
11892 static struct hda_verb alc662_sue_init_verbs
[] = {
11893 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
11894 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
11898 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
11899 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
11900 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11905 * generic initialization of ADC, input mixers and output mixers
11907 static struct hda_verb alc662_auto_init_verbs
[] = {
11909 * Unmute ADC and set the default input to mic-in
11911 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
11912 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11914 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11916 * Note: PASD motherboards uses the Line In 2 as the input for front
11917 * panel mic (mic 2)
11919 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11920 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11921 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11922 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
11923 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
11924 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
11927 * Set up output mixers (0x0c - 0x0f)
11929 /* set vol=0 to output mixers */
11930 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11931 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11932 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
11934 /* set up input amps for analog loopback */
11935 /* Amp Indices: DAC = 0, mixer = 1 */
11936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11938 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11939 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11940 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11941 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11944 /* FIXME: use matrix-type input source selection */
11945 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11947 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11948 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11952 /* capture mixer elements */
11953 static struct snd_kcontrol_new alc662_capture_mixer
[] = {
11954 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
11955 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
11957 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11958 /* The multiple "Capture Source" controls confuse alsamixer
11959 * So call somewhat different..
11960 * FIXME: the controls appear in the "playback" view!
11962 /* .name = "Capture Source", */
11963 .name
= "Input Source",
11965 .info
= alc882_mux_enum_info
,
11966 .get
= alc882_mux_enum_get
,
11967 .put
= alc882_mux_enum_put
,
11972 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
11974 unsigned int present
;
11975 unsigned char bits
;
11977 present
= snd_hda_codec_read(codec
, 0x14, 0,
11978 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11979 bits
= present
? HDA_AMP_MUTE
: 0;
11980 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
11981 HDA_AMP_MUTE
, bits
);
11984 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
11986 unsigned int present
;
11987 unsigned char bits
;
11989 present
= snd_hda_codec_read(codec
, 0x1b, 0,
11990 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11991 bits
= present
? HDA_AMP_MUTE
: 0;
11992 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
11993 HDA_AMP_MUTE
, bits
);
11994 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
11995 HDA_AMP_MUTE
, bits
);
11998 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
12001 if ((res
>> 26) == ALC880_HP_EVENT
)
12002 alc662_lenovo_101e_all_automute(codec
);
12003 if ((res
>> 26) == ALC880_FRONT_EVENT
)
12004 alc662_lenovo_101e_ispeaker_automute(codec
);
12007 static void alc662_eeepc_mic_automute(struct hda_codec
*codec
)
12009 unsigned int present
;
12011 present
= snd_hda_codec_read(codec
, 0x18, 0,
12012 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12013 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12014 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
12015 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12016 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
12017 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12018 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
12019 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
12020 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
12023 /* unsolicited event for HP jack sensing */
12024 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
12027 if ((res
>> 26) == ALC880_HP_EVENT
)
12028 alc262_hippo1_automute( codec
);
12030 if ((res
>> 26) == ALC880_MIC_EVENT
)
12031 alc662_eeepc_mic_automute(codec
);
12034 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
12036 alc262_hippo1_automute( codec
);
12037 alc662_eeepc_mic_automute(codec
);
12040 #ifdef CONFIG_SND_HDA_POWER_SAVE
12041 #define alc662_loopbacks alc880_loopbacks
12045 /* pcm configuration: identiacal with ALC880 */
12046 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
12047 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
12048 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
12049 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
12052 * configuration and preset
12054 static const char *alc662_models
[ALC662_MODEL_LAST
] = {
12055 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
12056 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
12057 [ALC662_3ST_6ch
] = "3stack-6ch",
12058 [ALC662_5ST_DIG
] = "6stack-dig",
12059 [ALC662_LENOVO_101E
] = "lenovo-101e",
12060 [ALC662_AUTO
] = "auto",
12063 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
12064 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
12065 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
12069 static struct alc_config_preset alc662_presets
[] = {
12070 [ALC662_3ST_2ch_DIG
] = {
12071 .mixers
= { alc662_3ST_2ch_mixer
, alc662_capture_mixer
},
12072 .init_verbs
= { alc662_init_verbs
},
12073 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
12074 .dac_nids
= alc662_dac_nids
,
12075 .dig_out_nid
= ALC662_DIGOUT_NID
,
12076 .num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
),
12077 .adc_nids
= alc662_adc_nids
,
12078 .dig_in_nid
= ALC662_DIGIN_NID
,
12079 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
12080 .channel_mode
= alc662_3ST_2ch_modes
,
12081 .input_mux
= &alc662_capture_source
,
12083 [ALC662_3ST_6ch_DIG
] = {
12084 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
12085 alc662_capture_mixer
},
12086 .init_verbs
= { alc662_init_verbs
},
12087 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
12088 .dac_nids
= alc662_dac_nids
,
12089 .dig_out_nid
= ALC662_DIGOUT_NID
,
12090 .num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
),
12091 .adc_nids
= alc662_adc_nids
,
12092 .dig_in_nid
= ALC662_DIGIN_NID
,
12093 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
12094 .channel_mode
= alc662_3ST_6ch_modes
,
12096 .input_mux
= &alc662_capture_source
,
12098 [ALC662_3ST_6ch
] = {
12099 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
12100 alc662_capture_mixer
},
12101 .init_verbs
= { alc662_init_verbs
},
12102 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
12103 .dac_nids
= alc662_dac_nids
,
12104 .num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
),
12105 .adc_nids
= alc662_adc_nids
,
12106 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
12107 .channel_mode
= alc662_3ST_6ch_modes
,
12109 .input_mux
= &alc662_capture_source
,
12111 [ALC662_5ST_DIG
] = {
12112 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
,
12113 alc662_capture_mixer
},
12114 .init_verbs
= { alc662_init_verbs
},
12115 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
12116 .dac_nids
= alc662_dac_nids
,
12117 .dig_out_nid
= ALC662_DIGOUT_NID
,
12118 .num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
),
12119 .adc_nids
= alc662_adc_nids
,
12120 .dig_in_nid
= ALC662_DIGIN_NID
,
12121 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
12122 .channel_mode
= alc662_5stack_modes
,
12123 .input_mux
= &alc662_capture_source
,
12125 [ALC662_LENOVO_101E
] = {
12126 .mixers
= { alc662_lenovo_101e_mixer
, alc662_capture_mixer
},
12127 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
12128 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
12129 .dac_nids
= alc662_dac_nids
,
12130 .num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
),
12131 .adc_nids
= alc662_adc_nids
,
12132 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
12133 .channel_mode
= alc662_3ST_2ch_modes
,
12134 .input_mux
= &alc662_lenovo_101e_capture_source
,
12135 .unsol_event
= alc662_lenovo_101e_unsol_event
,
12136 .init_hook
= alc662_lenovo_101e_all_automute
,
12138 [ALC662_ASUS_EEEPC_P701
] = {
12139 .mixers
= { alc662_eeepc_p701_mixer
, alc662_capture_mixer
},
12140 .init_verbs
= { alc662_init_verbs
,
12141 alc662_eeepc_sue_init_verbs
},
12142 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
12143 .dac_nids
= alc662_dac_nids
,
12144 .num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
),
12145 .adc_nids
= alc662_adc_nids
,
12146 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
12147 .channel_mode
= alc662_3ST_2ch_modes
,
12148 .input_mux
= &alc662_eeepc_capture_source
,
12149 .unsol_event
= alc662_eeepc_unsol_event
,
12150 .init_hook
= alc662_eeepc_inithook
,
12157 * BIOS auto configuration
12160 /* add playback controls from the parsed DAC table */
12161 static int alc662_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12162 const struct auto_pin_cfg
*cfg
)
12165 static const char *chname
[4] = {
12166 "Front", "Surround", NULL
/*CLFE*/, "Side"
12171 for (i
= 0; i
< cfg
->line_outs
; i
++) {
12172 if (!spec
->multiout
.dac_nids
[i
])
12174 nid
= alc880_idx_to_dac(i
);
12177 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12178 "Center Playback Volume",
12179 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
12183 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12184 "LFE Playback Volume",
12185 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
12189 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
12190 "Center Playback Switch",
12191 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
12195 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
12196 "LFE Playback Switch",
12197 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
12202 sprintf(name
, "%s Playback Volume", chname
[i
]);
12203 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
12204 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
12208 sprintf(name
, "%s Playback Switch", chname
[i
]);
12209 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
12210 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
12219 /* add playback controls for speaker and HP outputs */
12220 static int alc662_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
12230 if (alc880_is_fixed_pin(pin
)) {
12231 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
12232 /* printk("DAC nid=%x\n",nid); */
12233 /* specify the DAC as the extra output */
12234 if (!spec
->multiout
.hp_nid
)
12235 spec
->multiout
.hp_nid
= nid
;
12237 spec
->multiout
.extra_out_nid
[0] = nid
;
12238 /* control HP volume/switch on the output mixer amp */
12239 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
12240 sprintf(name
, "%s Playback Volume", pfx
);
12241 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
12242 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
12245 sprintf(name
, "%s Playback Switch", pfx
);
12246 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
12247 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
12250 } else if (alc880_is_multi_pin(pin
)) {
12251 /* set manual connection */
12252 /* we have only a switch on HP-out PIN */
12253 sprintf(name
, "%s Playback Switch", pfx
);
12254 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
12255 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
12262 /* create playback/capture controls for input pins */
12263 static int alc662_auto_create_analog_input_ctls(struct alc_spec
*spec
,
12264 const struct auto_pin_cfg
*cfg
)
12266 struct hda_input_mux
*imux
= &spec
->private_imux
;
12269 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12270 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
12271 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
12272 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
12273 auto_pin_cfg_labels
[i
],
12277 imux
->items
[imux
->num_items
].label
=
12278 auto_pin_cfg_labels
[i
];
12279 imux
->items
[imux
->num_items
].index
=
12280 alc880_input_pin_idx(cfg
->input_pins
[i
]);
12287 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
12288 hda_nid_t nid
, int pin_type
,
12291 /* set as output */
12292 snd_hda_codec_write(codec
, nid
, 0,
12293 AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
12294 snd_hda_codec_write(codec
, nid
, 0,
12295 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
12296 /* need the manual connection? */
12297 if (alc880_is_multi_pin(nid
)) {
12298 struct alc_spec
*spec
= codec
->spec
;
12299 int idx
= alc880_multi_pin_idx(nid
);
12300 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
12301 AC_VERB_SET_CONNECT_SEL
,
12302 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
12306 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
12308 struct alc_spec
*spec
= codec
->spec
;
12311 for (i
= 0; i
<= HDA_SIDE
; i
++) {
12312 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
12313 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
12315 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
12320 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
12322 struct alc_spec
*spec
= codec
->spec
;
12325 pin
= spec
->autocfg
.hp_pins
[0];
12326 if (pin
) /* connect to front */
12328 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
12331 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
12332 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
12334 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
12336 struct alc_spec
*spec
= codec
->spec
;
12339 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12340 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
12341 if (alc662_is_input_pin(nid
)) {
12342 snd_hda_codec_write(codec
, nid
, 0,
12343 AC_VERB_SET_PIN_WIDGET_CONTROL
,
12344 (i
<= AUTO_PIN_FRONT_MIC
?
12345 PIN_VREF80
: PIN_IN
));
12346 if (nid
!= ALC662_PIN_CD_NID
)
12347 snd_hda_codec_write(codec
, nid
, 0,
12348 AC_VERB_SET_AMP_GAIN_MUTE
,
12354 static int alc662_parse_auto_config(struct hda_codec
*codec
)
12356 struct alc_spec
*spec
= codec
->spec
;
12358 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
12360 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12364 if (!spec
->autocfg
.line_outs
)
12365 return 0; /* can't find valid BIOS pin config */
12367 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
12370 err
= alc662_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12373 err
= alc662_auto_create_extra_out(spec
,
12374 spec
->autocfg
.speaker_pins
[0],
12378 err
= alc662_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
12382 err
= alc662_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
12386 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12388 if (spec
->autocfg
.dig_out_pin
)
12389 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
12391 if (spec
->kctl_alloc
)
12392 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
12394 spec
->num_mux_defs
= 1;
12395 spec
->input_mux
= &spec
->private_imux
;
12397 spec
->init_verbs
[spec
->num_init_verbs
++] = alc662_auto_init_verbs
;
12398 spec
->mixers
[spec
->num_mixers
] = alc662_capture_mixer
;
12399 spec
->num_mixers
++;
12403 /* additional initialization for auto-configuration model */
12404 static void alc662_auto_init(struct hda_codec
*codec
)
12406 alc662_auto_init_multi_out(codec
);
12407 alc662_auto_init_hp_out(codec
);
12408 alc662_auto_init_analog_input(codec
);
12411 static int patch_alc662(struct hda_codec
*codec
)
12413 struct alc_spec
*spec
;
12414 int err
, board_config
;
12416 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
12420 codec
->spec
= spec
;
12422 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
12425 if (board_config
< 0) {
12426 printk(KERN_INFO
"hda_codec: Unknown model for ALC662, "
12427 "trying auto-probe from BIOS...\n");
12428 board_config
= ALC662_AUTO
;
12431 if (board_config
== ALC662_AUTO
) {
12432 /* automatic parse from the BIOS config */
12433 err
= alc662_parse_auto_config(codec
);
12439 "hda_codec: Cannot set up configuration "
12440 "from BIOS. Using base mode...\n");
12441 board_config
= ALC662_3ST_2ch_DIG
;
12445 if (board_config
!= ALC662_AUTO
)
12446 setup_preset(spec
, &alc662_presets
[board_config
]);
12448 spec
->stream_name_analog
= "ALC662 Analog";
12449 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
12450 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
12452 spec
->stream_name_digital
= "ALC662 Digital";
12453 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
12454 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
12456 if (!spec
->adc_nids
&& spec
->input_mux
) {
12457 spec
->adc_nids
= alc662_adc_nids
;
12458 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
12461 codec
->patch_ops
= alc_patch_ops
;
12462 if (board_config
== ALC662_AUTO
)
12463 spec
->init_hook
= alc662_auto_init
;
12464 #ifdef CONFIG_SND_HDA_POWER_SAVE
12465 if (!spec
->loopback
.amplist
)
12466 spec
->loopback
.amplist
= alc662_loopbacks
;
12475 struct hda_codec_preset snd_hda_preset_realtek
[] = {
12476 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
12477 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
12478 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
12479 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
12480 .patch
= patch_alc861
},
12481 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
12482 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
12483 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
12484 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
12485 .patch
= patch_alc883
},
12486 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
12487 .patch
= patch_alc662
},
12488 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
12489 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
12490 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
12491 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
12492 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
12493 {} /* terminator */