2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
33 #include "hda_patch.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
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
,
102 ALC262_MODEL_LAST
/* last tag */
112 #ifdef CONFIG_SND_DEBUG
116 ALC268_MODEL_LAST
/* last tag */
123 ALC269_MODEL_LAST
/* last tag */
140 /* ALC861-VD models */
161 ALC662_ASUS_EEEPC_P701
,
162 ALC662_ASUS_EEEPC_EP20
,
190 ALC883_TARGA_2ch_DIG
,
196 ALC883_LENOVO_101E_2ch
,
197 ALC883_LENOVO_NB0763
,
198 ALC888_LENOVO_MS7195_DIG
,
205 ALC883_FUJITSU_PI2515
,
211 #define GPIO_MASK 0x03
214 /* codec parameterization */
215 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
216 unsigned int num_mixers
;
218 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
222 unsigned int num_init_verbs
;
224 char *stream_name_analog
; /* analog PCM stream */
225 struct hda_pcm_stream
*stream_analog_playback
;
226 struct hda_pcm_stream
*stream_analog_capture
;
227 struct hda_pcm_stream
*stream_analog_alt_playback
;
228 struct hda_pcm_stream
*stream_analog_alt_capture
;
230 char *stream_name_digital
; /* digital PCM stream */
231 struct hda_pcm_stream
*stream_digital_playback
;
232 struct hda_pcm_stream
*stream_digital_capture
;
235 struct hda_multi_out multiout
; /* playback set-up
236 * max_channels, dacs must be set
237 * dig_out_nid and hp_nid are optional
239 hda_nid_t alt_dac_nid
;
242 unsigned int num_adc_nids
;
244 hda_nid_t
*capsrc_nids
;
245 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
248 unsigned int num_mux_defs
;
249 const struct hda_input_mux
*input_mux
;
250 unsigned int cur_mux
[3];
253 const struct hda_channel_mode
*channel_mode
;
254 int num_channel_mode
;
257 /* PCM information */
258 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
260 /* dynamic controls, init_verbs and input_mux */
261 struct auto_pin_cfg autocfg
;
262 unsigned int num_kctl_alloc
, num_kctl_used
;
263 struct snd_kcontrol_new
*kctl_alloc
;
264 struct hda_input_mux private_imux
;
265 hda_nid_t private_dac_nids
[AUTO_CFG_MAX_OUTS
];
268 void (*init_hook
)(struct hda_codec
*codec
);
269 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
271 /* for pin sensing */
272 unsigned int sense_updated
: 1;
273 unsigned int jack_present
: 1;
274 unsigned int master_sw
: 1;
276 /* for virtual master */
277 hda_nid_t vmaster_nid
;
278 #ifdef CONFIG_SND_HDA_POWER_SAVE
279 struct hda_loopback_check loopback
;
284 * configuration template - to be copied to the spec instance
286 struct alc_config_preset
{
287 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
290 const struct hda_verb
*init_verbs
[5];
291 unsigned int num_dacs
;
293 hda_nid_t dig_out_nid
; /* optional */
294 hda_nid_t hp_nid
; /* optional */
295 unsigned int num_adc_nids
;
297 hda_nid_t
*capsrc_nids
;
298 hda_nid_t dig_in_nid
;
299 unsigned int num_channel_mode
;
300 const struct hda_channel_mode
*channel_mode
;
302 unsigned int num_mux_defs
;
303 const struct hda_input_mux
*input_mux
;
304 void (*unsol_event
)(struct hda_codec
*, unsigned int);
305 void (*init_hook
)(struct hda_codec
*);
306 #ifdef CONFIG_SND_HDA_POWER_SAVE
307 struct hda_amp_list
*loopbacks
;
315 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
316 struct snd_ctl_elem_info
*uinfo
)
318 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
319 struct alc_spec
*spec
= codec
->spec
;
320 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
321 if (mux_idx
>= spec
->num_mux_defs
)
323 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
326 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
327 struct snd_ctl_elem_value
*ucontrol
)
329 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
330 struct alc_spec
*spec
= codec
->spec
;
331 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
333 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
337 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
338 struct snd_ctl_elem_value
*ucontrol
)
340 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
341 struct alc_spec
*spec
= codec
->spec
;
342 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
343 unsigned int mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
344 hda_nid_t nid
= spec
->capsrc_nids
?
345 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
346 return snd_hda_input_mux_put(codec
, &spec
->input_mux
[mux_idx
], ucontrol
,
347 nid
, &spec
->cur_mux
[adc_idx
]);
352 * channel mode setting
354 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
355 struct snd_ctl_elem_info
*uinfo
)
357 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
358 struct alc_spec
*spec
= codec
->spec
;
359 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
360 spec
->num_channel_mode
);
363 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
364 struct snd_ctl_elem_value
*ucontrol
)
366 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
367 struct alc_spec
*spec
= codec
->spec
;
368 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
369 spec
->num_channel_mode
,
370 spec
->multiout
.max_channels
);
373 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
374 struct snd_ctl_elem_value
*ucontrol
)
376 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
377 struct alc_spec
*spec
= codec
->spec
;
378 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
379 spec
->num_channel_mode
,
380 &spec
->multiout
.max_channels
);
381 if (err
>= 0 && spec
->need_dac_fix
)
382 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
387 * Control the mode of pin widget settings via the mixer. "pc" is used
388 * instead of "%" to avoid consequences of accidently treating the % as
389 * being part of a format specifier. Maximum allowed length of a value is
390 * 63 characters plus NULL terminator.
392 * Note: some retasking pin complexes seem to ignore requests for input
393 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
394 * are requested. Therefore order this list so that this behaviour will not
395 * cause problems when mixer clients move through the enum sequentially.
396 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
399 static char *alc_pin_mode_names
[] = {
400 "Mic 50pc bias", "Mic 80pc bias",
401 "Line in", "Line out", "Headphone out",
403 static unsigned char alc_pin_mode_values
[] = {
404 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
406 /* The control can present all 5 options, or it can limit the options based
407 * in the pin being assumed to be exclusively an input or an output pin. In
408 * addition, "input" pins may or may not process the mic bias option
409 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
410 * accept requests for bias as of chip versions up to March 2006) and/or
411 * wiring in the computer.
413 #define ALC_PIN_DIR_IN 0x00
414 #define ALC_PIN_DIR_OUT 0x01
415 #define ALC_PIN_DIR_INOUT 0x02
416 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
417 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
419 /* Info about the pin modes supported by the different pin direction modes.
420 * For each direction the minimum and maximum values are given.
422 static signed char alc_pin_mode_dir_info
[5][2] = {
423 { 0, 2 }, /* ALC_PIN_DIR_IN */
424 { 3, 4 }, /* ALC_PIN_DIR_OUT */
425 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
426 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
427 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
429 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
430 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
431 #define alc_pin_mode_n_items(_dir) \
432 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
434 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
435 struct snd_ctl_elem_info
*uinfo
)
437 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
438 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
440 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
442 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
444 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
445 item_num
= alc_pin_mode_min(dir
);
446 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
450 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
451 struct snd_ctl_elem_value
*ucontrol
)
454 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
455 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
456 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
457 long *valp
= ucontrol
->value
.integer
.value
;
458 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
459 AC_VERB_GET_PIN_WIDGET_CONTROL
,
462 /* Find enumerated value for current pinctl setting */
463 i
= alc_pin_mode_min(dir
);
464 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
466 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
470 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
471 struct snd_ctl_elem_value
*ucontrol
)
474 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
475 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
476 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
477 long val
= *ucontrol
->value
.integer
.value
;
478 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
479 AC_VERB_GET_PIN_WIDGET_CONTROL
,
482 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
483 val
= alc_pin_mode_min(dir
);
485 change
= pinctl
!= alc_pin_mode_values
[val
];
487 /* Set pin mode to that requested */
488 snd_hda_codec_write_cache(codec
, nid
, 0,
489 AC_VERB_SET_PIN_WIDGET_CONTROL
,
490 alc_pin_mode_values
[val
]);
492 /* Also enable the retasking pin's input/output as required
493 * for the requested pin mode. Enum values of 2 or less are
496 * Dynamically switching the input/output buffers probably
497 * reduces noise slightly (particularly on input) so we'll
498 * do it. However, having both input and output buffers
499 * enabled simultaneously doesn't seem to be problematic if
500 * this turns out to be necessary in the future.
503 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
504 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
505 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
508 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
, 0,
509 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
510 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
517 #define ALC_PIN_MODE(xname, nid, dir) \
518 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
519 .info = alc_pin_mode_info, \
520 .get = alc_pin_mode_get, \
521 .put = alc_pin_mode_put, \
522 .private_value = nid | (dir<<16) }
524 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
525 * together using a mask with more than one bit set. This control is
526 * currently used only by the ALC260 test model. At this stage they are not
527 * needed for any "production" models.
529 #ifdef CONFIG_SND_DEBUG
530 #define alc_gpio_data_info snd_ctl_boolean_mono_info
532 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
533 struct snd_ctl_elem_value
*ucontrol
)
535 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
536 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
537 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
538 long *valp
= ucontrol
->value
.integer
.value
;
539 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
540 AC_VERB_GET_GPIO_DATA
, 0x00);
542 *valp
= (val
& mask
) != 0;
545 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
546 struct snd_ctl_elem_value
*ucontrol
)
549 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
550 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
551 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
552 long val
= *ucontrol
->value
.integer
.value
;
553 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
554 AC_VERB_GET_GPIO_DATA
,
557 /* Set/unset the masked GPIO bit(s) as needed */
558 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
563 snd_hda_codec_write_cache(codec
, nid
, 0,
564 AC_VERB_SET_GPIO_DATA
, gpio_data
);
568 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
569 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
570 .info = alc_gpio_data_info, \
571 .get = alc_gpio_data_get, \
572 .put = alc_gpio_data_put, \
573 .private_value = nid | (mask<<16) }
574 #endif /* CONFIG_SND_DEBUG */
576 /* A switch control to allow the enabling of the digital IO pins on the
577 * ALC260. This is incredibly simplistic; the intention of this control is
578 * to provide something in the test model allowing digital outputs to be
579 * identified if present. If models are found which can utilise these
580 * outputs a more complete mixer control can be devised for those models if
583 #ifdef CONFIG_SND_DEBUG
584 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
586 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
587 struct snd_ctl_elem_value
*ucontrol
)
589 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
590 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
591 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
592 long *valp
= ucontrol
->value
.integer
.value
;
593 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
594 AC_VERB_GET_DIGI_CONVERT_1
, 0x00);
596 *valp
= (val
& mask
) != 0;
599 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
600 struct snd_ctl_elem_value
*ucontrol
)
603 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
604 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
605 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
606 long val
= *ucontrol
->value
.integer
.value
;
607 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
608 AC_VERB_GET_DIGI_CONVERT_1
,
611 /* Set/unset the masked control bit(s) as needed */
612 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
617 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
622 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
623 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
624 .info = alc_spdif_ctrl_info, \
625 .get = alc_spdif_ctrl_get, \
626 .put = alc_spdif_ctrl_put, \
627 .private_value = nid | (mask<<16) }
628 #endif /* CONFIG_SND_DEBUG */
630 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
631 * Again, this is only used in the ALC26x test models to help identify when
632 * the EAPD line must be asserted for features to work.
634 #ifdef CONFIG_SND_DEBUG
635 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
637 static int alc_eapd_ctrl_get(struct snd_kcontrol
*kcontrol
,
638 struct snd_ctl_elem_value
*ucontrol
)
640 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
641 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
642 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
643 long *valp
= ucontrol
->value
.integer
.value
;
644 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
645 AC_VERB_GET_EAPD_BTLENABLE
, 0x00);
647 *valp
= (val
& mask
) != 0;
651 static int alc_eapd_ctrl_put(struct snd_kcontrol
*kcontrol
,
652 struct snd_ctl_elem_value
*ucontrol
)
655 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
656 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
657 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
658 long val
= *ucontrol
->value
.integer
.value
;
659 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
660 AC_VERB_GET_EAPD_BTLENABLE
,
663 /* Set/unset the masked control bit(s) as needed */
664 change
= (!val
? 0 : mask
) != (ctrl_data
& mask
);
669 snd_hda_codec_write_cache(codec
, nid
, 0, AC_VERB_SET_EAPD_BTLENABLE
,
675 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
676 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
677 .info = alc_eapd_ctrl_info, \
678 .get = alc_eapd_ctrl_get, \
679 .put = alc_eapd_ctrl_put, \
680 .private_value = nid | (mask<<16) }
681 #endif /* CONFIG_SND_DEBUG */
684 * set up from the preset table
686 static void setup_preset(struct alc_spec
*spec
,
687 const struct alc_config_preset
*preset
)
691 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
692 spec
->mixers
[spec
->num_mixers
++] = preset
->mixers
[i
];
693 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
695 spec
->init_verbs
[spec
->num_init_verbs
++] =
696 preset
->init_verbs
[i
];
698 spec
->channel_mode
= preset
->channel_mode
;
699 spec
->num_channel_mode
= preset
->num_channel_mode
;
700 spec
->need_dac_fix
= preset
->need_dac_fix
;
702 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
704 spec
->multiout
.num_dacs
= preset
->num_dacs
;
705 spec
->multiout
.dac_nids
= preset
->dac_nids
;
706 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
707 spec
->multiout
.hp_nid
= preset
->hp_nid
;
709 spec
->num_mux_defs
= preset
->num_mux_defs
;
710 if (!spec
->num_mux_defs
)
711 spec
->num_mux_defs
= 1;
712 spec
->input_mux
= preset
->input_mux
;
714 spec
->num_adc_nids
= preset
->num_adc_nids
;
715 spec
->adc_nids
= preset
->adc_nids
;
716 spec
->capsrc_nids
= preset
->capsrc_nids
;
717 spec
->dig_in_nid
= preset
->dig_in_nid
;
719 spec
->unsol_event
= preset
->unsol_event
;
720 spec
->init_hook
= preset
->init_hook
;
721 #ifdef CONFIG_SND_HDA_POWER_SAVE
722 spec
->loopback
.amplist
= preset
->loopbacks
;
726 /* Enable GPIO mask and set output */
727 static struct hda_verb alc_gpio1_init_verbs
[] = {
728 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
729 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
730 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
734 static struct hda_verb alc_gpio2_init_verbs
[] = {
735 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
736 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
737 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
741 static struct hda_verb alc_gpio3_init_verbs
[] = {
742 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
743 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
744 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
748 static void alc_sku_automute(struct hda_codec
*codec
)
750 struct alc_spec
*spec
= codec
->spec
;
751 unsigned int present
;
752 unsigned int hp_nid
= spec
->autocfg
.hp_pins
[0];
753 unsigned int sp_nid
= spec
->autocfg
.speaker_pins
[0];
755 /* need to execute and sync at first */
756 snd_hda_codec_read(codec
, hp_nid
, 0, AC_VERB_SET_PIN_SENSE
, 0);
757 present
= snd_hda_codec_read(codec
, hp_nid
, 0,
758 AC_VERB_GET_PIN_SENSE
, 0);
759 spec
->jack_present
= (present
& 0x80000000) != 0;
760 snd_hda_codec_write(codec
, sp_nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
761 spec
->jack_present
? 0 : PIN_OUT
);
764 /* unsolicited event for HP jack sensing */
765 static void alc_sku_unsol_event(struct hda_codec
*codec
, unsigned int res
)
767 if (codec
->vendor_id
== 0x10ec0880)
771 if (res
!= ALC880_HP_EVENT
)
774 alc_sku_automute(codec
);
777 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
778 * 31 ~ 16 : Manufacture ID
780 * 7 ~ 0 : Assembly ID
781 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
783 static void alc_subsystem_id(struct hda_codec
*codec
,
784 unsigned int porta
, unsigned int porte
,
787 unsigned int ass
, tmp
, i
;
789 struct alc_spec
*spec
= codec
->spec
;
791 ass
= codec
->subsystem_id
& 0xffff;
792 if ((ass
!= codec
->bus
->pci
->subsystem_device
) && (ass
& 1))
796 * 31~30 : port conetcivity
799 * 19~16 : Check sum (15:1)
804 if (codec
->vendor_id
== 0x10ec0260)
806 ass
= snd_hda_codec_read(codec
, nid
, 0,
807 AC_VERB_GET_CONFIG_DEFAULT
, 0);
808 if (!(ass
& 1) && !(ass
& 0x100000))
810 if ((ass
>> 30) != 1) /* no physical connection */
815 for (i
= 1; i
< 16; i
++) {
819 if (((ass
>> 16) & 0xf) != tmp
)
825 * 2 : 0 --> Desktop, 1 --> Laptop
826 * 3~5 : External Amplifier control
829 tmp
= (ass
& 0x38) >> 3; /* external Amp control */
832 snd_hda_sequence_write(codec
, alc_gpio1_init_verbs
);
835 snd_hda_sequence_write(codec
, alc_gpio2_init_verbs
);
838 snd_hda_sequence_write(codec
, alc_gpio3_init_verbs
);
840 case 5: /* set EAPD output high */
841 switch (codec
->vendor_id
) {
843 snd_hda_codec_write(codec
, 0x0f, 0,
844 AC_VERB_SET_EAPD_BTLENABLE
, 2);
845 snd_hda_codec_write(codec
, 0x10, 0,
846 AC_VERB_SET_EAPD_BTLENABLE
, 2);
854 snd_hda_codec_write(codec
, 0x14, 0,
855 AC_VERB_SET_EAPD_BTLENABLE
, 2);
856 snd_hda_codec_write(codec
, 0x15, 0,
857 AC_VERB_SET_EAPD_BTLENABLE
, 2);
860 switch (codec
->vendor_id
) {
862 snd_hda_codec_write(codec
, 0x1a, 0,
863 AC_VERB_SET_COEF_INDEX
, 7);
864 tmp
= snd_hda_codec_read(codec
, 0x1a, 0,
865 AC_VERB_GET_PROC_COEF
, 0);
866 snd_hda_codec_write(codec
, 0x1a, 0,
867 AC_VERB_SET_COEF_INDEX
, 7);
868 snd_hda_codec_write(codec
, 0x1a, 0,
869 AC_VERB_SET_PROC_COEF
,
878 snd_hda_codec_write(codec
, 0x20, 0,
879 AC_VERB_SET_COEF_INDEX
, 7);
880 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
881 AC_VERB_GET_PROC_COEF
, 0);
882 snd_hda_codec_write(codec
, 0x20, 0,
883 AC_VERB_SET_COEF_INDEX
, 7);
884 snd_hda_codec_write(codec
, 0x20, 0,
885 AC_VERB_SET_PROC_COEF
,
890 snd_hda_codec_write(codec
, 0x20, 0,
891 AC_VERB_SET_COEF_INDEX
, 7);
892 tmp
= snd_hda_codec_read(codec
, 0x20, 0,
893 AC_VERB_GET_PROC_COEF
, 0);
894 snd_hda_codec_write(codec
, 0x20, 0,
895 AC_VERB_SET_COEF_INDEX
, 7);
896 snd_hda_codec_write(codec
, 0x20, 0,
897 AC_VERB_SET_PROC_COEF
,
905 /* is laptop or Desktop and enable the function "Mute internal speaker
906 * when the external headphone out jack is plugged"
911 * 10~8 : Jack location
912 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
914 * 15 : 1 --> enable the function "Mute internal speaker
915 * when the external headphone out jack is plugged"
917 if (!spec
->autocfg
.speaker_pins
[0]) {
918 if (spec
->autocfg
.line_out_pins
[0])
919 spec
->autocfg
.speaker_pins
[0] =
920 spec
->autocfg
.line_out_pins
[0];
925 if (!spec
->autocfg
.hp_pins
[0]) {
926 tmp
= (ass
>> 11) & 0x3; /* HP to chassis */
928 spec
->autocfg
.hp_pins
[0] = porta
;
930 spec
->autocfg
.hp_pins
[0] = porte
;
932 spec
->autocfg
.hp_pins
[0] = portd
;
937 snd_hda_codec_write(codec
, spec
->autocfg
.hp_pins
[0], 0,
938 AC_VERB_SET_UNSOLICITED_ENABLE
,
939 AC_USRSP_EN
| ALC880_HP_EVENT
);
940 spec
->unsol_event
= alc_sku_unsol_event
;
941 spec
->init_hook
= alc_sku_automute
;
945 * Fix-up pin default configurations
953 static void alc_fix_pincfg(struct hda_codec
*codec
,
954 const struct snd_pci_quirk
*quirk
,
955 const struct alc_pincfg
**pinfix
)
957 const struct alc_pincfg
*cfg
;
959 quirk
= snd_pci_quirk_lookup(codec
->bus
->pci
, quirk
);
963 cfg
= pinfix
[quirk
->value
];
964 for (; cfg
->nid
; cfg
++) {
967 for (i
= 0; i
< 4; i
++) {
968 snd_hda_codec_write(codec
, cfg
->nid
, 0,
969 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
+ i
,
977 * ALC880 3-stack model
979 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
980 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
981 * F-Mic = 0x1b, HP = 0x19
984 static hda_nid_t alc880_dac_nids
[4] = {
985 /* front, rear, clfe, rear_surr */
986 0x02, 0x05, 0x04, 0x03
989 static hda_nid_t alc880_adc_nids
[3] = {
994 /* The datasheet says the node 0x07 is connected from inputs,
995 * but it shows zero connection in the real implementation on some devices.
996 * Note: this is a 915GAV bug, fixed on 915GLV
998 static hda_nid_t alc880_adc_nids_alt
[2] = {
1003 #define ALC880_DIGOUT_NID 0x06
1004 #define ALC880_DIGIN_NID 0x0a
1006 static struct hda_input_mux alc880_capture_source
= {
1010 { "Front Mic", 0x3 },
1016 /* channel source setting (2/6 channel selection for 3-stack) */
1018 static struct hda_verb alc880_threestack_ch2_init
[] = {
1019 /* set line-in to input, mute it */
1020 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1021 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1022 /* set mic-in to input vref 80%, mute it */
1023 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1024 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1029 static struct hda_verb alc880_threestack_ch6_init
[] = {
1030 /* set line-in to output, unmute it */
1031 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1032 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1033 /* set mic-in to output, unmute it */
1034 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1035 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1039 static struct hda_channel_mode alc880_threestack_modes
[2] = {
1040 { 2, alc880_threestack_ch2_init
},
1041 { 6, alc880_threestack_ch6_init
},
1044 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
1045 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1046 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1047 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1048 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
1049 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1050 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1051 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1052 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1053 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1054 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1055 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1056 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1057 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1058 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1059 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
1060 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
1061 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1062 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1063 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
1065 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1066 .name
= "Channel Mode",
1067 .info
= alc_ch_mode_info
,
1068 .get
= alc_ch_mode_get
,
1069 .put
= alc_ch_mode_put
,
1074 /* capture mixer elements */
1075 static struct snd_kcontrol_new alc880_capture_mixer
[] = {
1076 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
1077 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
1078 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
1079 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
1080 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
1081 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
1083 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1084 /* The multiple "Capture Source" controls confuse alsamixer
1085 * So call somewhat different..
1087 /* .name = "Capture Source", */
1088 .name
= "Input Source",
1090 .info
= alc_mux_enum_info
,
1091 .get
= alc_mux_enum_get
,
1092 .put
= alc_mux_enum_put
,
1097 /* capture mixer elements (in case NID 0x07 not available) */
1098 static struct snd_kcontrol_new alc880_capture_alt_mixer
[] = {
1099 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1100 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1101 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
1102 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
1104 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1105 /* The multiple "Capture Source" controls confuse alsamixer
1106 * So call somewhat different..
1108 /* .name = "Capture Source", */
1109 .name
= "Input Source",
1111 .info
= alc_mux_enum_info
,
1112 .get
= alc_mux_enum_get
,
1113 .put
= alc_mux_enum_put
,
1121 * ALC880 5-stack model
1123 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1125 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1126 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1129 /* additional mixers to alc880_three_stack_mixer */
1130 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
1131 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1132 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
1136 /* channel source setting (6/8 channel selection for 5-stack) */
1138 static struct hda_verb alc880_fivestack_ch6_init
[] = {
1139 /* set line-in to input, mute it */
1140 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1141 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1146 static struct hda_verb alc880_fivestack_ch8_init
[] = {
1147 /* set line-in to output, unmute it */
1148 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1149 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1153 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
1154 { 6, alc880_fivestack_ch6_init
},
1155 { 8, alc880_fivestack_ch8_init
},
1160 * ALC880 6-stack model
1162 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1163 * Side = 0x05 (0x0f)
1164 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1165 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1168 static hda_nid_t alc880_6st_dac_nids
[4] = {
1169 /* front, rear, clfe, rear_surr */
1170 0x02, 0x03, 0x04, 0x05
1173 static struct hda_input_mux alc880_6stack_capture_source
= {
1177 { "Front Mic", 0x1 },
1183 /* fixed 8-channels */
1184 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
1188 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
1189 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1190 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1191 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1192 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1193 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1194 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1195 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1196 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1197 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1198 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
1199 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1200 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1201 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1202 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1205 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1206 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1207 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1208 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1210 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1211 .name
= "Channel Mode",
1212 .info
= alc_ch_mode_info
,
1213 .get
= alc_ch_mode_get
,
1214 .put
= alc_ch_mode_put
,
1223 * W810 has rear IO for:
1226 * Center/LFE (DAC 04)
1229 * The system also has a pair of internal speakers, and a headphone jack.
1230 * These are both connected to Line2 on the codec, hence to DAC 02.
1232 * There is a variable resistor to control the speaker or headphone
1233 * volume. This is a hardware-only device without a software API.
1235 * Plugging headphones in will disable the internal speakers. This is
1236 * implemented in hardware, not via the driver using jack sense. In
1237 * a similar fashion, plugging into the rear socket marked "front" will
1238 * disable both the speakers and headphones.
1240 * For input, there's a microphone jack, and an "audio in" jack.
1241 * These may not do anything useful with this driver yet, because I
1242 * haven't setup any initialization verbs for these yet...
1245 static hda_nid_t alc880_w810_dac_nids
[3] = {
1246 /* front, rear/surround, clfe */
1250 /* fixed 6 channels */
1251 static struct hda_channel_mode alc880_w810_modes
[1] = {
1255 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1256 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
1257 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1258 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1259 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1260 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1261 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1262 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1263 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1264 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1265 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1273 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
1274 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
1278 static hda_nid_t alc880_z71v_dac_nids
[1] = {
1281 #define ALC880_Z71V_HP_DAC 0x03
1283 /* fixed 2 channels */
1284 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
1288 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
1289 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1290 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1291 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1292 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
1293 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1294 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1302 * ALC880 F1734 model
1304 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
1305 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
1308 static hda_nid_t alc880_f1734_dac_nids
[1] = {
1311 #define ALC880_F1734_HP_DAC 0x02
1313 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
1314 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1315 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1316 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1317 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1318 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1319 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1320 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1321 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1325 static struct hda_input_mux alc880_f1734_capture_source
= {
1337 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1338 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1339 * Mic = 0x18, Line = 0x1a
1342 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
1343 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
1345 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
1346 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1347 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
1348 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1349 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
1350 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1351 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1352 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1353 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1354 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1355 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1356 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1357 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1358 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1359 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1361 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1362 .name
= "Channel Mode",
1363 .info
= alc_ch_mode_info
,
1364 .get
= alc_ch_mode_get
,
1365 .put
= alc_ch_mode_put
,
1371 * ALC880 ASUS W1V model
1373 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
1374 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
1375 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
1378 /* additional mixers to alc880_asus_mixer */
1379 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
1380 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
1381 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
1385 /* additional mixers to alc880_asus_mixer */
1386 static struct snd_kcontrol_new alc880_pcbeep_mixer
[] = {
1387 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1388 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1393 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
1394 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1395 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1396 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
1397 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
1398 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
1399 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
1400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
1401 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1402 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1404 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1405 /* The multiple "Capture Source" controls confuse alsamixer
1406 * So call somewhat different..
1408 /* .name = "Capture Source", */
1409 .name
= "Input Source",
1411 .info
= alc_mux_enum_info
,
1412 .get
= alc_mux_enum_get
,
1413 .put
= alc_mux_enum_put
,
1419 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
1420 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1421 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1422 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1423 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1424 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1425 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1426 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1427 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1428 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1429 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1430 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1431 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1432 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1433 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1434 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1435 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1436 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1437 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1439 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1440 .name
= "Channel Mode",
1441 .info
= alc_ch_mode_info
,
1442 .get
= alc_ch_mode_get
,
1443 .put
= alc_ch_mode_put
,
1448 static struct snd_kcontrol_new alc880_fujitsu_mixer
[] = {
1449 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1450 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1451 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1452 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1453 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1454 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1455 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1456 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1457 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1458 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1462 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
1463 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1464 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
1465 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1466 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1467 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1468 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1473 * virtual master controls
1477 * slave controls for virtual master
1479 static const char *alc_slave_vols
[] = {
1480 "Front Playback Volume",
1481 "Surround Playback Volume",
1482 "Center Playback Volume",
1483 "LFE Playback Volume",
1484 "Side Playback Volume",
1485 "Headphone Playback Volume",
1486 "Speaker Playback Volume",
1487 "Mono Playback Volume",
1488 "Line-Out Playback Volume",
1492 static const char *alc_slave_sws
[] = {
1493 "Front Playback Switch",
1494 "Surround Playback Switch",
1495 "Center Playback Switch",
1496 "LFE Playback Switch",
1497 "Side Playback Switch",
1498 "Headphone Playback Switch",
1499 "Speaker Playback Switch",
1500 "Mono Playback Switch",
1501 "IEC958 Playback Switch",
1506 * build control elements
1508 static int alc_build_controls(struct hda_codec
*codec
)
1510 struct alc_spec
*spec
= codec
->spec
;
1514 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1515 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1520 if (spec
->multiout
.dig_out_nid
) {
1521 err
= snd_hda_create_spdif_out_ctls(codec
,
1522 spec
->multiout
.dig_out_nid
);
1525 err
= snd_hda_create_spdif_share_sw(codec
,
1529 spec
->multiout
.share_spdif
= 1;
1531 if (spec
->dig_in_nid
) {
1532 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1537 /* if we have no master control, let's create it */
1538 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Volume")) {
1539 unsigned int vmaster_tlv
[4];
1540 snd_hda_set_vmaster_tlv(codec
, spec
->vmaster_nid
,
1541 HDA_OUTPUT
, vmaster_tlv
);
1542 err
= snd_hda_add_vmaster(codec
, "Master Playback Volume",
1543 vmaster_tlv
, alc_slave_vols
);
1547 if (!snd_hda_find_mixer_ctl(codec
, "Master Playback Switch")) {
1548 err
= snd_hda_add_vmaster(codec
, "Master Playback Switch",
1549 NULL
, alc_slave_sws
);
1559 * initialize the codec volumes, etc
1563 * generic initialization of ADC, input mixers and output mixers
1565 static struct hda_verb alc880_volume_init_verbs
[] = {
1567 * Unmute ADC0-2 and set the default input to mic-in
1569 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
1570 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1571 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
1572 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1573 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
1574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1576 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1578 * Note: PASD motherboards uses the Line In 2 as the input for front
1581 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1582 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1583 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1584 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
1585 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
1586 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
1587 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
1588 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
1591 * Set up output mixers (0x0c - 0x0f)
1593 /* set vol=0 to output mixers */
1594 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1595 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1596 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1597 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1598 /* set up input amps for analog loopback */
1599 /* Amp Indices: DAC = 0, mixer = 1 */
1600 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1601 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1602 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1603 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1604 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1605 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1606 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1607 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1613 * 3-stack pin configuration:
1614 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1616 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
1618 * preset connection lists of input pins
1619 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1621 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
1622 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1623 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
1626 * Set pin mode and muting
1628 /* set front pin widgets 0x14 for output */
1629 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1630 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1631 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1632 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1633 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1634 /* Mic2 (as headphone out) for HP output */
1635 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1636 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1637 /* Line In pin widget for input */
1638 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1639 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1640 /* Line2 (as front mic) pin widget for input and vref at 80% */
1641 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1642 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1643 /* CD pin widget for input */
1644 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1650 * 5-stack pin configuration:
1651 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1652 * line-in/side = 0x1a, f-mic = 0x1b
1654 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
1656 * preset connection lists of input pins
1657 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1659 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1660 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
1663 * Set pin mode and muting
1665 /* set pin widgets 0x14-0x17 for output */
1666 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1667 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1668 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1669 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1670 /* unmute pins for output (no gain on this amp) */
1671 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1672 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1673 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1674 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1676 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1677 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1678 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1679 /* Mic2 (as headphone out) for HP output */
1680 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1681 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1682 /* Line In pin widget for input */
1683 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1684 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1685 /* Line2 (as front mic) pin widget for input and vref at 80% */
1686 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1687 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1688 /* CD pin widget for input */
1689 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1695 * W810 pin configuration:
1696 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1698 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
1699 /* hphone/speaker input selector: front DAC */
1700 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
1702 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1703 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1704 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1705 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1706 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1707 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1709 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1710 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1716 * Z71V pin configuration:
1717 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1719 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
1720 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1721 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1722 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1723 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1725 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1726 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1727 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1728 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1734 * 6-stack pin configuration:
1735 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1736 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1738 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
1739 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1741 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1742 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1743 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1745 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1746 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1747 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1748 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1750 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1751 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1752 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1753 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1754 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1755 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1756 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1757 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1758 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1764 * Uniwill pin configuration:
1765 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1768 static struct hda_verb alc880_uniwill_init_verbs
[] = {
1769 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1771 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1773 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1774 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1775 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1776 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1777 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1778 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1779 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1780 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1781 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1782 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1783 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1784 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1786 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1787 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1788 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1789 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1790 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1791 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1792 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1793 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1794 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1796 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1797 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
1804 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1806 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
1807 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1809 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1810 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1811 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1812 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1813 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1814 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1815 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1817 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1818 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1819 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1820 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1822 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1823 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1824 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1825 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1826 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1827 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1829 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1830 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
1835 static struct hda_verb alc880_beep_init_verbs
[] = {
1836 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5) },
1840 /* toggle speaker-output according to the hp-jack state */
1841 static void alc880_uniwill_hp_automute(struct hda_codec
*codec
)
1843 unsigned int present
;
1846 present
= snd_hda_codec_read(codec
, 0x14, 0,
1847 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1848 bits
= present
? HDA_AMP_MUTE
: 0;
1849 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
1850 HDA_AMP_MUTE
, bits
);
1851 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
1852 HDA_AMP_MUTE
, bits
);
1855 /* auto-toggle front mic */
1856 static void alc880_uniwill_mic_automute(struct hda_codec
*codec
)
1858 unsigned int present
;
1861 present
= snd_hda_codec_read(codec
, 0x18, 0,
1862 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1863 bits
= present
? HDA_AMP_MUTE
: 0;
1864 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1, HDA_AMP_MUTE
, bits
);
1867 static void alc880_uniwill_automute(struct hda_codec
*codec
)
1869 alc880_uniwill_hp_automute(codec
);
1870 alc880_uniwill_mic_automute(codec
);
1873 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
1876 /* Looks like the unsol event is incompatible with the standard
1877 * definition. 4bit tag is placed at 28 bit!
1879 switch (res
>> 28) {
1880 case ALC880_HP_EVENT
:
1881 alc880_uniwill_hp_automute(codec
);
1883 case ALC880_MIC_EVENT
:
1884 alc880_uniwill_mic_automute(codec
);
1889 static void alc880_uniwill_p53_hp_automute(struct hda_codec
*codec
)
1891 unsigned int present
;
1894 present
= snd_hda_codec_read(codec
, 0x14, 0,
1895 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1896 bits
= present
? HDA_AMP_MUTE
: 0;
1897 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_INPUT
, 0, HDA_AMP_MUTE
, bits
);
1900 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
1902 unsigned int present
;
1904 present
= snd_hda_codec_read(codec
, 0x21, 0,
1905 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0);
1906 present
&= HDA_AMP_VOLMASK
;
1907 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0,
1908 HDA_AMP_VOLMASK
, present
);
1909 snd_hda_codec_amp_stereo(codec
, 0x0d, HDA_OUTPUT
, 0,
1910 HDA_AMP_VOLMASK
, present
);
1913 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
1916 /* Looks like the unsol event is incompatible with the standard
1917 * definition. 4bit tag is placed at 28 bit!
1919 if ((res
>> 28) == ALC880_HP_EVENT
)
1920 alc880_uniwill_p53_hp_automute(codec
);
1921 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
1922 alc880_uniwill_p53_dcvol_automute(codec
);
1926 * F1734 pin configuration:
1927 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1929 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
1930 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1931 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1932 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
1933 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1935 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1936 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1937 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1938 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1940 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1941 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1942 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1943 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1944 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1945 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1946 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1947 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1948 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1950 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
1951 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_DCVOL_EVENT
},
1957 * ASUS pin configuration:
1958 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1960 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
1961 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1962 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1963 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
1964 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1966 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1967 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1968 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1969 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1970 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1971 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1972 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1973 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1975 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1976 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1977 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1978 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1979 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1980 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1981 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1982 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1983 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1988 /* Enable GPIO mask and set output */
1989 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
1990 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
1992 /* Clevo m520g init */
1993 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
1994 /* headphone output */
1995 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
1997 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1998 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2000 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2001 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2003 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2004 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2005 /* Mic1 (rear panel) */
2006 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2007 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2008 /* Mic2 (front panel) */
2009 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2010 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2012 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2013 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2014 /* change to EAPD mode */
2015 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2016 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2021 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
2022 /* change to EAPD mode */
2023 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2024 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
2026 /* Headphone output */
2027 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2029 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2030 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
2032 /* Line In pin widget for input */
2033 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2034 /* CD pin widget for input */
2035 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2036 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2037 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2039 /* change to EAPD mode */
2040 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
2041 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
2047 * LG m1 express dual
2050 * Rear Line-In/Out (blue): 0x14
2051 * Build-in Mic-In: 0x15
2053 * HP-Out (green): 0x1b
2054 * Mic-In/Out (red): 0x19
2058 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2059 static hda_nid_t alc880_lg_dac_nids
[3] = {
2063 /* seems analog CD is not working */
2064 static struct hda_input_mux alc880_lg_capture_source
= {
2069 { "Internal Mic", 0x6 },
2073 /* 2,4,6 channel modes */
2074 static struct hda_verb alc880_lg_ch2_init
[] = {
2075 /* set line-in and mic-in to input */
2076 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2077 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2081 static struct hda_verb alc880_lg_ch4_init
[] = {
2082 /* set line-in to out and mic-in to input */
2083 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2084 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2088 static struct hda_verb alc880_lg_ch6_init
[] = {
2089 /* set line-in and mic-in to output */
2090 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2091 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2095 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
2096 { 2, alc880_lg_ch2_init
},
2097 { 4, alc880_lg_ch4_init
},
2098 { 6, alc880_lg_ch6_init
},
2101 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
2102 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2103 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT
),
2104 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2105 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
2106 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
2107 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
2108 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
2109 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
2110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2112 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
2113 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
2114 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
2115 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
2117 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2118 .name
= "Channel Mode",
2119 .info
= alc_ch_mode_info
,
2120 .get
= alc_ch_mode_get
,
2121 .put
= alc_ch_mode_put
,
2126 static struct hda_verb alc880_lg_init_verbs
[] = {
2127 /* set capture source to mic-in */
2128 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2129 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2130 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2131 /* mute all amp mixer inputs */
2132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
2133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
2134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2135 /* line-in to input */
2136 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2137 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2139 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2140 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2142 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2143 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2144 /* mic-in to input */
2145 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
2146 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2147 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2149 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
2150 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2151 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2153 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2157 /* toggle speaker-output according to the hp-jack state */
2158 static void alc880_lg_automute(struct hda_codec
*codec
)
2160 unsigned int present
;
2163 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2164 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2165 bits
= present
? HDA_AMP_MUTE
: 0;
2166 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
2167 HDA_AMP_MUTE
, bits
);
2170 static void alc880_lg_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2172 /* Looks like the unsol event is incompatible with the standard
2173 * definition. 4bit tag is placed at 28 bit!
2175 if ((res
>> 28) == 0x01)
2176 alc880_lg_automute(codec
);
2185 * Built-in Mic-In: 0x19
2191 static struct hda_input_mux alc880_lg_lw_capture_source
= {
2195 { "Internal Mic", 0x1 },
2200 #define alc880_lg_lw_modes alc880_threestack_modes
2202 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
2203 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2204 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2205 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2206 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
2207 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
2208 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
2209 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
2210 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
2211 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
2212 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
2213 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2214 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2215 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
2216 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
2218 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2219 .name
= "Channel Mode",
2220 .info
= alc_ch_mode_info
,
2221 .get
= alc_ch_mode_get
,
2222 .put
= alc_ch_mode_put
,
2227 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
2228 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
2229 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
2230 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
2232 /* set capture source to mic-in */
2233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2234 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2235 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
2238 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2239 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2241 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
2242 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2243 /* mic-in to input */
2244 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2245 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2247 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2248 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2250 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
2254 /* toggle speaker-output according to the hp-jack state */
2255 static void alc880_lg_lw_automute(struct hda_codec
*codec
)
2257 unsigned int present
;
2260 present
= snd_hda_codec_read(codec
, 0x1b, 0,
2261 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
2262 bits
= present
? HDA_AMP_MUTE
: 0;
2263 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
2264 HDA_AMP_MUTE
, bits
);
2267 static void alc880_lg_lw_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2269 /* Looks like the unsol event is incompatible with the standard
2270 * definition. 4bit tag is placed at 28 bit!
2272 if ((res
>> 28) == 0x01)
2273 alc880_lg_lw_automute(codec
);
2276 #ifdef CONFIG_SND_HDA_POWER_SAVE
2277 static struct hda_amp_list alc880_loopbacks
[] = {
2278 { 0x0b, HDA_INPUT
, 0 },
2279 { 0x0b, HDA_INPUT
, 1 },
2280 { 0x0b, HDA_INPUT
, 2 },
2281 { 0x0b, HDA_INPUT
, 3 },
2282 { 0x0b, HDA_INPUT
, 4 },
2286 static struct hda_amp_list alc880_lg_loopbacks
[] = {
2287 { 0x0b, HDA_INPUT
, 1 },
2288 { 0x0b, HDA_INPUT
, 6 },
2289 { 0x0b, HDA_INPUT
, 7 },
2298 static int alc_init(struct hda_codec
*codec
)
2300 struct alc_spec
*spec
= codec
->spec
;
2303 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
2304 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
2306 if (spec
->init_hook
)
2307 spec
->init_hook(codec
);
2312 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
2314 struct alc_spec
*spec
= codec
->spec
;
2316 if (spec
->unsol_event
)
2317 spec
->unsol_event(codec
, res
);
2320 #ifdef CONFIG_SND_HDA_POWER_SAVE
2321 static int alc_check_power_status(struct hda_codec
*codec
, hda_nid_t nid
)
2323 struct alc_spec
*spec
= codec
->spec
;
2324 return snd_hda_check_amp_list_power(codec
, &spec
->loopback
, nid
);
2329 * Analog playback callbacks
2331 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2332 struct hda_codec
*codec
,
2333 struct snd_pcm_substream
*substream
)
2335 struct alc_spec
*spec
= codec
->spec
;
2336 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
,
2340 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2341 struct hda_codec
*codec
,
2342 unsigned int stream_tag
,
2343 unsigned int format
,
2344 struct snd_pcm_substream
*substream
)
2346 struct alc_spec
*spec
= codec
->spec
;
2347 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
2348 stream_tag
, format
, substream
);
2351 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2352 struct hda_codec
*codec
,
2353 struct snd_pcm_substream
*substream
)
2355 struct alc_spec
*spec
= codec
->spec
;
2356 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
2362 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
2363 struct hda_codec
*codec
,
2364 struct snd_pcm_substream
*substream
)
2366 struct alc_spec
*spec
= codec
->spec
;
2367 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
2370 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2371 struct hda_codec
*codec
,
2372 unsigned int stream_tag
,
2373 unsigned int format
,
2374 struct snd_pcm_substream
*substream
)
2376 struct alc_spec
*spec
= codec
->spec
;
2377 return snd_hda_multi_out_dig_prepare(codec
, &spec
->multiout
,
2378 stream_tag
, format
, substream
);
2381 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
2382 struct hda_codec
*codec
,
2383 struct snd_pcm_substream
*substream
)
2385 struct alc_spec
*spec
= codec
->spec
;
2386 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
2392 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
2393 struct hda_codec
*codec
,
2394 unsigned int stream_tag
,
2395 unsigned int format
,
2396 struct snd_pcm_substream
*substream
)
2398 struct alc_spec
*spec
= codec
->spec
;
2400 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
2401 stream_tag
, 0, format
);
2405 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
2406 struct hda_codec
*codec
,
2407 struct snd_pcm_substream
*substream
)
2409 struct alc_spec
*spec
= codec
->spec
;
2411 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
+ 1],
2419 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
2423 /* NID is set in alc_build_pcms */
2425 .open
= alc880_playback_pcm_open
,
2426 .prepare
= alc880_playback_pcm_prepare
,
2427 .cleanup
= alc880_playback_pcm_cleanup
2431 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
2435 /* NID is set in alc_build_pcms */
2438 static struct hda_pcm_stream alc880_pcm_analog_alt_playback
= {
2442 /* NID is set in alc_build_pcms */
2445 static struct hda_pcm_stream alc880_pcm_analog_alt_capture
= {
2446 .substreams
= 2, /* can be overridden */
2449 /* NID is set in alc_build_pcms */
2451 .prepare
= alc880_alt_capture_pcm_prepare
,
2452 .cleanup
= alc880_alt_capture_pcm_cleanup
2456 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
2460 /* NID is set in alc_build_pcms */
2462 .open
= alc880_dig_playback_pcm_open
,
2463 .close
= alc880_dig_playback_pcm_close
,
2464 .prepare
= alc880_dig_playback_pcm_prepare
2468 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
2472 /* NID is set in alc_build_pcms */
2475 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
2476 static struct hda_pcm_stream alc_pcm_null_stream
= {
2482 static int alc_build_pcms(struct hda_codec
*codec
)
2484 struct alc_spec
*spec
= codec
->spec
;
2485 struct hda_pcm
*info
= spec
->pcm_rec
;
2488 codec
->num_pcms
= 1;
2489 codec
->pcm_info
= info
;
2491 info
->name
= spec
->stream_name_analog
;
2492 if (spec
->stream_analog_playback
) {
2493 snd_assert(spec
->multiout
.dac_nids
, return -EINVAL
);
2494 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
2495 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
2497 if (spec
->stream_analog_capture
) {
2498 snd_assert(spec
->adc_nids
, return -EINVAL
);
2499 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
2500 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
2503 if (spec
->channel_mode
) {
2504 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
2505 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
2506 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
2507 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
2512 /* SPDIF for stream index #1 */
2513 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2514 codec
->num_pcms
= 2;
2515 info
= spec
->pcm_rec
+ 1;
2516 info
->name
= spec
->stream_name_digital
;
2517 info
->pcm_type
= HDA_PCM_TYPE_SPDIF
;
2518 if (spec
->multiout
.dig_out_nid
&&
2519 spec
->stream_digital_playback
) {
2520 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
2521 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2523 if (spec
->dig_in_nid
&&
2524 spec
->stream_digital_capture
) {
2525 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
2526 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2530 /* If the use of more than one ADC is requested for the current
2531 * model, configure a second analog capture-only PCM.
2533 /* Additional Analaog capture for index #2 */
2534 if ((spec
->alt_dac_nid
&& spec
->stream_analog_alt_playback
) ||
2535 (spec
->num_adc_nids
> 1 && spec
->stream_analog_alt_capture
)) {
2536 codec
->num_pcms
= 3;
2537 info
= spec
->pcm_rec
+ 2;
2538 info
->name
= spec
->stream_name_analog
;
2539 if (spec
->alt_dac_nid
) {
2540 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
2541 *spec
->stream_analog_alt_playback
;
2542 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
=
2545 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] =
2546 alc_pcm_null_stream
;
2547 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
2549 if (spec
->num_adc_nids
> 1) {
2550 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
2551 *spec
->stream_analog_alt_capture
;
2552 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
=
2554 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].substreams
=
2555 spec
->num_adc_nids
- 1;
2557 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] =
2558 alc_pcm_null_stream
;
2559 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= 0;
2566 static void alc_free(struct hda_codec
*codec
)
2568 struct alc_spec
*spec
= codec
->spec
;
2574 if (spec
->kctl_alloc
) {
2575 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
2576 kfree(spec
->kctl_alloc
[i
].name
);
2577 kfree(spec
->kctl_alloc
);
2584 static struct hda_codec_ops alc_patch_ops
= {
2585 .build_controls
= alc_build_controls
,
2586 .build_pcms
= alc_build_pcms
,
2589 .unsol_event
= alc_unsol_event
,
2590 #ifdef CONFIG_SND_HDA_POWER_SAVE
2591 .check_power_status
= alc_check_power_status
,
2597 * Test configuration for debugging
2599 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2602 #ifdef CONFIG_SND_DEBUG
2603 static hda_nid_t alc880_test_dac_nids
[4] = {
2604 0x02, 0x03, 0x04, 0x05
2607 static struct hda_input_mux alc880_test_capture_source
= {
2616 { "Surround", 0x6 },
2620 static struct hda_channel_mode alc880_test_modes
[4] = {
2627 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
2628 struct snd_ctl_elem_info
*uinfo
)
2630 static char *texts
[] = {
2631 "N/A", "Line Out", "HP Out",
2632 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2634 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2636 uinfo
->value
.enumerated
.items
= 8;
2637 if (uinfo
->value
.enumerated
.item
>= 8)
2638 uinfo
->value
.enumerated
.item
= 7;
2639 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2643 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
2644 struct snd_ctl_elem_value
*ucontrol
)
2646 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2647 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2648 unsigned int pin_ctl
, item
= 0;
2650 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2651 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2652 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
2653 if (pin_ctl
& AC_PINCTL_HP_EN
)
2657 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
2658 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
2659 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
2660 case AC_PINCTL_VREF_50
: item
= 4; break;
2661 case AC_PINCTL_VREF_GRD
: item
= 5; break;
2662 case AC_PINCTL_VREF_80
: item
= 6; break;
2663 case AC_PINCTL_VREF_100
: item
= 7; break;
2666 ucontrol
->value
.enumerated
.item
[0] = item
;
2670 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
2671 struct snd_ctl_elem_value
*ucontrol
)
2673 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2674 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2675 static unsigned int ctls
[] = {
2676 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
2677 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
2678 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
2679 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
2680 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
2681 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
2683 unsigned int old_ctl
, new_ctl
;
2685 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2686 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2687 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
2688 if (old_ctl
!= new_ctl
) {
2690 snd_hda_codec_write_cache(codec
, nid
, 0,
2691 AC_VERB_SET_PIN_WIDGET_CONTROL
,
2693 val
= ucontrol
->value
.enumerated
.item
[0] >= 3 ?
2695 snd_hda_codec_amp_stereo(codec
, nid
, HDA_OUTPUT
, 0,
2702 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
2703 struct snd_ctl_elem_info
*uinfo
)
2705 static char *texts
[] = {
2706 "Front", "Surround", "CLFE", "Side"
2708 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2710 uinfo
->value
.enumerated
.items
= 4;
2711 if (uinfo
->value
.enumerated
.item
>= 4)
2712 uinfo
->value
.enumerated
.item
= 3;
2713 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2717 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
2718 struct snd_ctl_elem_value
*ucontrol
)
2720 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2721 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2724 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
2725 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
2729 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
2730 struct snd_ctl_elem_value
*ucontrol
)
2732 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2733 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2736 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
2737 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
2738 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
2739 snd_hda_codec_write_cache(codec
, nid
, 0,
2740 AC_VERB_SET_CONNECT_SEL
, sel
);
2746 #define PIN_CTL_TEST(xname,nid) { \
2747 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2749 .info = alc_test_pin_ctl_info, \
2750 .get = alc_test_pin_ctl_get, \
2751 .put = alc_test_pin_ctl_put, \
2752 .private_value = nid \
2755 #define PIN_SRC_TEST(xname,nid) { \
2756 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2758 .info = alc_test_pin_src_info, \
2759 .get = alc_test_pin_src_get, \
2760 .put = alc_test_pin_src_put, \
2761 .private_value = nid \
2764 static struct snd_kcontrol_new alc880_test_mixer
[] = {
2765 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2766 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2767 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
2768 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2769 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2770 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2771 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
2772 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2773 PIN_CTL_TEST("Front Pin Mode", 0x14),
2774 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2775 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2776 PIN_CTL_TEST("Side Pin Mode", 0x17),
2777 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2778 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2779 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2780 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2781 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2782 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2783 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2784 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2785 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2786 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2787 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2788 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2789 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
2790 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
2791 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2792 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2793 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
2794 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
2796 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2797 .name
= "Channel Mode",
2798 .info
= alc_ch_mode_info
,
2799 .get
= alc_ch_mode_get
,
2800 .put
= alc_ch_mode_put
,
2805 static struct hda_verb alc880_test_init_verbs
[] = {
2806 /* Unmute inputs of 0x0c - 0x0f */
2807 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2808 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2809 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2810 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2811 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2812 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2813 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2814 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2815 /* Vol output for 0x0c-0x0f */
2816 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2817 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2818 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2819 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2820 /* Set output pins 0x14-0x17 */
2821 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2822 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2823 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2824 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2825 /* Unmute output pins 0x14-0x17 */
2826 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2827 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2828 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2829 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2830 /* Set input pins 0x18-0x1c */
2831 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2832 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2833 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2834 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2835 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2836 /* Mute input pins 0x18-0x1b */
2837 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2838 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2839 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2840 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2843 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2844 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2845 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2846 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2847 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2848 /* Analog input/passthru */
2849 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2850 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2851 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
2852 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
2853 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
2861 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
2862 [ALC880_3ST
] = "3stack",
2863 [ALC880_TCL_S700
] = "tcl",
2864 [ALC880_3ST_DIG
] = "3stack-digout",
2865 [ALC880_CLEVO
] = "clevo",
2866 [ALC880_5ST
] = "5stack",
2867 [ALC880_5ST_DIG
] = "5stack-digout",
2868 [ALC880_W810
] = "w810",
2869 [ALC880_Z71V
] = "z71v",
2870 [ALC880_6ST
] = "6stack",
2871 [ALC880_6ST_DIG
] = "6stack-digout",
2872 [ALC880_ASUS
] = "asus",
2873 [ALC880_ASUS_W1V
] = "asus-w1v",
2874 [ALC880_ASUS_DIG
] = "asus-dig",
2875 [ALC880_ASUS_DIG2
] = "asus-dig2",
2876 [ALC880_UNIWILL_DIG
] = "uniwill",
2877 [ALC880_UNIWILL_P53
] = "uniwill-p53",
2878 [ALC880_FUJITSU
] = "fujitsu",
2879 [ALC880_F1734
] = "F1734",
2881 [ALC880_LG_LW
] = "lg-lw",
2882 #ifdef CONFIG_SND_DEBUG
2883 [ALC880_TEST
] = "test",
2885 [ALC880_AUTO
] = "auto",
2888 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
2889 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810
),
2890 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
2891 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
2892 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
2893 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
2894 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
2895 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
2896 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
2897 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
2898 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
2899 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
2900 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
2901 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
2902 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
2903 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
2904 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
2905 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
2906 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
2907 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2908 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
2909 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
2910 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS
),
2911 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
2912 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
2913 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
2914 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS
), /* default ASUS */
2915 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
2916 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
2917 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
2918 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
2919 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
2920 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
2921 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
2922 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
2923 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
2924 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
2925 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
2926 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
2927 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
2928 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
2929 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
2930 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
2931 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
2932 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
2933 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
2934 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
2935 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
2936 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL
),
2937 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU
),
2938 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
2939 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
2940 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
2941 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
2942 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
2943 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
), /* broken BIOS */
2944 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
2945 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
2946 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
2947 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
2948 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
2949 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
2950 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
2951 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
2952 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
2953 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
2954 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
2955 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST
), /* default Intel */
2956 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
2957 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
2962 * ALC880 codec presets
2964 static struct alc_config_preset alc880_presets
[] = {
2966 .mixers
= { alc880_three_stack_mixer
},
2967 .init_verbs
= { alc880_volume_init_verbs
,
2968 alc880_pin_3stack_init_verbs
},
2969 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2970 .dac_nids
= alc880_dac_nids
,
2971 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2972 .channel_mode
= alc880_threestack_modes
,
2974 .input_mux
= &alc880_capture_source
,
2976 [ALC880_3ST_DIG
] = {
2977 .mixers
= { alc880_three_stack_mixer
},
2978 .init_verbs
= { alc880_volume_init_verbs
,
2979 alc880_pin_3stack_init_verbs
},
2980 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2981 .dac_nids
= alc880_dac_nids
,
2982 .dig_out_nid
= ALC880_DIGOUT_NID
,
2983 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2984 .channel_mode
= alc880_threestack_modes
,
2986 .input_mux
= &alc880_capture_source
,
2988 [ALC880_TCL_S700
] = {
2989 .mixers
= { alc880_tcl_s700_mixer
},
2990 .init_verbs
= { alc880_volume_init_verbs
,
2991 alc880_pin_tcl_S700_init_verbs
,
2992 alc880_gpio2_init_verbs
},
2993 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2994 .dac_nids
= alc880_dac_nids
,
2996 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2997 .channel_mode
= alc880_2_jack_modes
,
2998 .input_mux
= &alc880_capture_source
,
3001 .mixers
= { alc880_three_stack_mixer
,
3002 alc880_five_stack_mixer
},
3003 .init_verbs
= { alc880_volume_init_verbs
,
3004 alc880_pin_5stack_init_verbs
},
3005 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3006 .dac_nids
= alc880_dac_nids
,
3007 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3008 .channel_mode
= alc880_fivestack_modes
,
3009 .input_mux
= &alc880_capture_source
,
3011 [ALC880_5ST_DIG
] = {
3012 .mixers
= { alc880_three_stack_mixer
,
3013 alc880_five_stack_mixer
},
3014 .init_verbs
= { alc880_volume_init_verbs
,
3015 alc880_pin_5stack_init_verbs
},
3016 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3017 .dac_nids
= alc880_dac_nids
,
3018 .dig_out_nid
= ALC880_DIGOUT_NID
,
3019 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
3020 .channel_mode
= alc880_fivestack_modes
,
3021 .input_mux
= &alc880_capture_source
,
3024 .mixers
= { alc880_six_stack_mixer
},
3025 .init_verbs
= { alc880_volume_init_verbs
,
3026 alc880_pin_6stack_init_verbs
},
3027 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3028 .dac_nids
= alc880_6st_dac_nids
,
3029 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3030 .channel_mode
= alc880_sixstack_modes
,
3031 .input_mux
= &alc880_6stack_capture_source
,
3033 [ALC880_6ST_DIG
] = {
3034 .mixers
= { alc880_six_stack_mixer
},
3035 .init_verbs
= { alc880_volume_init_verbs
,
3036 alc880_pin_6stack_init_verbs
},
3037 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
3038 .dac_nids
= alc880_6st_dac_nids
,
3039 .dig_out_nid
= ALC880_DIGOUT_NID
,
3040 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
3041 .channel_mode
= alc880_sixstack_modes
,
3042 .input_mux
= &alc880_6stack_capture_source
,
3045 .mixers
= { alc880_w810_base_mixer
},
3046 .init_verbs
= { alc880_volume_init_verbs
,
3047 alc880_pin_w810_init_verbs
,
3048 alc880_gpio2_init_verbs
},
3049 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
3050 .dac_nids
= alc880_w810_dac_nids
,
3051 .dig_out_nid
= ALC880_DIGOUT_NID
,
3052 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3053 .channel_mode
= alc880_w810_modes
,
3054 .input_mux
= &alc880_capture_source
,
3057 .mixers
= { alc880_z71v_mixer
},
3058 .init_verbs
= { alc880_volume_init_verbs
,
3059 alc880_pin_z71v_init_verbs
},
3060 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
3061 .dac_nids
= alc880_z71v_dac_nids
,
3062 .dig_out_nid
= ALC880_DIGOUT_NID
,
3064 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3065 .channel_mode
= alc880_2_jack_modes
,
3066 .input_mux
= &alc880_capture_source
,
3069 .mixers
= { alc880_f1734_mixer
},
3070 .init_verbs
= { alc880_volume_init_verbs
,
3071 alc880_pin_f1734_init_verbs
},
3072 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
3073 .dac_nids
= alc880_f1734_dac_nids
,
3075 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3076 .channel_mode
= alc880_2_jack_modes
,
3077 .input_mux
= &alc880_f1734_capture_source
,
3078 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3079 .init_hook
= alc880_uniwill_p53_hp_automute
,
3082 .mixers
= { alc880_asus_mixer
},
3083 .init_verbs
= { alc880_volume_init_verbs
,
3084 alc880_pin_asus_init_verbs
,
3085 alc880_gpio1_init_verbs
},
3086 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3087 .dac_nids
= alc880_asus_dac_nids
,
3088 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3089 .channel_mode
= alc880_asus_modes
,
3091 .input_mux
= &alc880_capture_source
,
3093 [ALC880_ASUS_DIG
] = {
3094 .mixers
= { alc880_asus_mixer
},
3095 .init_verbs
= { alc880_volume_init_verbs
,
3096 alc880_pin_asus_init_verbs
,
3097 alc880_gpio1_init_verbs
},
3098 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3099 .dac_nids
= alc880_asus_dac_nids
,
3100 .dig_out_nid
= ALC880_DIGOUT_NID
,
3101 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3102 .channel_mode
= alc880_asus_modes
,
3104 .input_mux
= &alc880_capture_source
,
3106 [ALC880_ASUS_DIG2
] = {
3107 .mixers
= { alc880_asus_mixer
},
3108 .init_verbs
= { alc880_volume_init_verbs
,
3109 alc880_pin_asus_init_verbs
,
3110 alc880_gpio2_init_verbs
}, /* use GPIO2 */
3111 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3112 .dac_nids
= alc880_asus_dac_nids
,
3113 .dig_out_nid
= ALC880_DIGOUT_NID
,
3114 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3115 .channel_mode
= alc880_asus_modes
,
3117 .input_mux
= &alc880_capture_source
,
3119 [ALC880_ASUS_W1V
] = {
3120 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
3121 .init_verbs
= { alc880_volume_init_verbs
,
3122 alc880_pin_asus_init_verbs
,
3123 alc880_gpio1_init_verbs
},
3124 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3125 .dac_nids
= alc880_asus_dac_nids
,
3126 .dig_out_nid
= ALC880_DIGOUT_NID
,
3127 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3128 .channel_mode
= alc880_asus_modes
,
3130 .input_mux
= &alc880_capture_source
,
3132 [ALC880_UNIWILL_DIG
] = {
3133 .mixers
= { alc880_asus_mixer
, alc880_pcbeep_mixer
},
3134 .init_verbs
= { alc880_volume_init_verbs
,
3135 alc880_pin_asus_init_verbs
},
3136 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3137 .dac_nids
= alc880_asus_dac_nids
,
3138 .dig_out_nid
= ALC880_DIGOUT_NID
,
3139 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
3140 .channel_mode
= alc880_asus_modes
,
3142 .input_mux
= &alc880_capture_source
,
3144 [ALC880_UNIWILL
] = {
3145 .mixers
= { alc880_uniwill_mixer
},
3146 .init_verbs
= { alc880_volume_init_verbs
,
3147 alc880_uniwill_init_verbs
},
3148 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3149 .dac_nids
= alc880_asus_dac_nids
,
3150 .dig_out_nid
= ALC880_DIGOUT_NID
,
3151 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3152 .channel_mode
= alc880_threestack_modes
,
3154 .input_mux
= &alc880_capture_source
,
3155 .unsol_event
= alc880_uniwill_unsol_event
,
3156 .init_hook
= alc880_uniwill_automute
,
3158 [ALC880_UNIWILL_P53
] = {
3159 .mixers
= { alc880_uniwill_p53_mixer
},
3160 .init_verbs
= { alc880_volume_init_verbs
,
3161 alc880_uniwill_p53_init_verbs
},
3162 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
3163 .dac_nids
= alc880_asus_dac_nids
,
3164 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
3165 .channel_mode
= alc880_threestack_modes
,
3166 .input_mux
= &alc880_capture_source
,
3167 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3168 .init_hook
= alc880_uniwill_p53_hp_automute
,
3170 [ALC880_FUJITSU
] = {
3171 .mixers
= { alc880_fujitsu_mixer
,
3172 alc880_pcbeep_mixer
, },
3173 .init_verbs
= { alc880_volume_init_verbs
,
3174 alc880_uniwill_p53_init_verbs
,
3175 alc880_beep_init_verbs
},
3176 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3177 .dac_nids
= alc880_dac_nids
,
3178 .dig_out_nid
= ALC880_DIGOUT_NID
,
3179 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
3180 .channel_mode
= alc880_2_jack_modes
,
3181 .input_mux
= &alc880_capture_source
,
3182 .unsol_event
= alc880_uniwill_p53_unsol_event
,
3183 .init_hook
= alc880_uniwill_p53_hp_automute
,
3186 .mixers
= { alc880_three_stack_mixer
},
3187 .init_verbs
= { alc880_volume_init_verbs
,
3188 alc880_pin_clevo_init_verbs
},
3189 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3190 .dac_nids
= alc880_dac_nids
,
3192 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
3193 .channel_mode
= alc880_threestack_modes
,
3195 .input_mux
= &alc880_capture_source
,
3198 .mixers
= { alc880_lg_mixer
},
3199 .init_verbs
= { alc880_volume_init_verbs
,
3200 alc880_lg_init_verbs
},
3201 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
3202 .dac_nids
= alc880_lg_dac_nids
,
3203 .dig_out_nid
= ALC880_DIGOUT_NID
,
3204 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
3205 .channel_mode
= alc880_lg_ch_modes
,
3207 .input_mux
= &alc880_lg_capture_source
,
3208 .unsol_event
= alc880_lg_unsol_event
,
3209 .init_hook
= alc880_lg_automute
,
3210 #ifdef CONFIG_SND_HDA_POWER_SAVE
3211 .loopbacks
= alc880_lg_loopbacks
,
3215 .mixers
= { alc880_lg_lw_mixer
},
3216 .init_verbs
= { alc880_volume_init_verbs
,
3217 alc880_lg_lw_init_verbs
},
3218 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
3219 .dac_nids
= alc880_dac_nids
,
3220 .dig_out_nid
= ALC880_DIGOUT_NID
,
3221 .num_channel_mode
= ARRAY_SIZE(alc880_lg_lw_modes
),
3222 .channel_mode
= alc880_lg_lw_modes
,
3223 .input_mux
= &alc880_lg_lw_capture_source
,
3224 .unsol_event
= alc880_lg_lw_unsol_event
,
3225 .init_hook
= alc880_lg_lw_automute
,
3227 #ifdef CONFIG_SND_DEBUG
3229 .mixers
= { alc880_test_mixer
},
3230 .init_verbs
= { alc880_test_init_verbs
},
3231 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
3232 .dac_nids
= alc880_test_dac_nids
,
3233 .dig_out_nid
= ALC880_DIGOUT_NID
,
3234 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
3235 .channel_mode
= alc880_test_modes
,
3236 .input_mux
= &alc880_test_capture_source
,
3242 * Automatic parse of I/O pins from the BIOS configuration
3245 #define NUM_CONTROL_ALLOC 32
3246 #define NUM_VERB_ALLOC 32
3250 ALC_CTL_WIDGET_MUTE
,
3253 static struct snd_kcontrol_new alc880_control_templates
[] = {
3254 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
3255 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
3256 HDA_BIND_MUTE(NULL
, 0, 0, 0),
3259 /* add dynamic controls */
3260 static int add_control(struct alc_spec
*spec
, int type
, const char *name
,
3263 struct snd_kcontrol_new
*knew
;
3265 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
3266 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
3268 /* array + terminator */
3269 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
);
3272 if (spec
->kctl_alloc
) {
3273 memcpy(knew
, spec
->kctl_alloc
,
3274 sizeof(*knew
) * spec
->num_kctl_alloc
);
3275 kfree(spec
->kctl_alloc
);
3277 spec
->kctl_alloc
= knew
;
3278 spec
->num_kctl_alloc
= num
;
3281 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
3282 *knew
= alc880_control_templates
[type
];
3283 knew
->name
= kstrdup(name
, GFP_KERNEL
);
3286 knew
->private_value
= val
;
3287 spec
->num_kctl_used
++;
3291 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
3292 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
3293 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
3294 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
3295 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
3296 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
3297 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
3298 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
3299 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
3300 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
3301 #define ALC880_PIN_CD_NID 0x1c
3303 /* fill in the dac_nids table from the parsed pin configuration */
3304 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
,
3305 const struct auto_pin_cfg
*cfg
)
3311 memset(assigned
, 0, sizeof(assigned
));
3312 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
3314 /* check the pins hardwired to audio widget */
3315 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3316 nid
= cfg
->line_out_pins
[i
];
3317 if (alc880_is_fixed_pin(nid
)) {
3318 int idx
= alc880_fixed_pin_idx(nid
);
3319 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
3323 /* left pins can be connect to any audio widget */
3324 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3325 nid
= cfg
->line_out_pins
[i
];
3326 if (alc880_is_fixed_pin(nid
))
3328 /* search for an empty channel */
3329 for (j
= 0; j
< cfg
->line_outs
; j
++) {
3331 spec
->multiout
.dac_nids
[i
] =
3332 alc880_idx_to_dac(j
);
3338 spec
->multiout
.num_dacs
= cfg
->line_outs
;
3342 /* add playback controls from the parsed DAC table */
3343 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
3344 const struct auto_pin_cfg
*cfg
)
3347 static const char *chname
[4] = {
3348 "Front", "Surround", NULL
/*CLFE*/, "Side"
3353 for (i
= 0; i
< cfg
->line_outs
; i
++) {
3354 if (!spec
->multiout
.dac_nids
[i
])
3356 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
3359 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3360 "Center Playback Volume",
3361 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
3365 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
3366 "LFE Playback Volume",
3367 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
3371 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3372 "Center Playback Switch",
3373 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
3377 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
3378 "LFE Playback Switch",
3379 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
3384 sprintf(name
, "%s Playback Volume", chname
[i
]);
3385 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3386 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
3390 sprintf(name
, "%s Playback Switch", chname
[i
]);
3391 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3392 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
3401 /* add playback controls for speaker and HP outputs */
3402 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
3412 if (alc880_is_fixed_pin(pin
)) {
3413 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
3414 /* specify the DAC as the extra output */
3415 if (!spec
->multiout
.hp_nid
)
3416 spec
->multiout
.hp_nid
= nid
;
3418 spec
->multiout
.extra_out_nid
[0] = nid
;
3419 /* control HP volume/switch on the output mixer amp */
3420 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
3421 sprintf(name
, "%s Playback Volume", pfx
);
3422 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3423 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
3426 sprintf(name
, "%s Playback Switch", pfx
);
3427 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
3428 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
3431 } else if (alc880_is_multi_pin(pin
)) {
3432 /* set manual connection */
3433 /* we have only a switch on HP-out PIN */
3434 sprintf(name
, "%s Playback Switch", pfx
);
3435 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3436 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
3443 /* create input playback/capture controls for the given pin */
3444 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
,
3445 const char *ctlname
,
3446 int idx
, hda_nid_t mix_nid
)
3451 sprintf(name
, "%s Playback Volume", ctlname
);
3452 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
3453 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3456 sprintf(name
, "%s Playback Switch", ctlname
);
3457 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
3458 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
));
3464 /* create playback/capture controls for input pins */
3465 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
3466 const struct auto_pin_cfg
*cfg
)
3468 struct hda_input_mux
*imux
= &spec
->private_imux
;
3471 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3472 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
3473 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
3474 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
3475 auto_pin_cfg_labels
[i
],
3479 imux
->items
[imux
->num_items
].label
=
3480 auto_pin_cfg_labels
[i
];
3481 imux
->items
[imux
->num_items
].index
=
3482 alc880_input_pin_idx(cfg
->input_pins
[i
]);
3489 static void alc_set_pin_output(struct hda_codec
*codec
, hda_nid_t nid
,
3490 unsigned int pin_type
)
3492 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
3495 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
3499 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
3500 hda_nid_t nid
, int pin_type
,
3503 alc_set_pin_output(codec
, nid
, pin_type
);
3504 /* need the manual connection? */
3505 if (alc880_is_multi_pin(nid
)) {
3506 struct alc_spec
*spec
= codec
->spec
;
3507 int idx
= alc880_multi_pin_idx(nid
);
3508 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
3509 AC_VERB_SET_CONNECT_SEL
,
3510 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
3514 static int get_pin_type(int line_out_type
)
3516 if (line_out_type
== AUTO_PIN_HP_OUT
)
3522 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
3524 struct alc_spec
*spec
= codec
->spec
;
3527 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
3528 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
3529 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
3530 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
3531 alc880_auto_set_output_and_unmute(codec
, nid
, pin_type
, i
);
3535 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
3537 struct alc_spec
*spec
= codec
->spec
;
3540 pin
= spec
->autocfg
.speaker_pins
[0];
3541 if (pin
) /* connect to front */
3542 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
3543 pin
= spec
->autocfg
.hp_pins
[0];
3544 if (pin
) /* connect to front */
3545 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
3548 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
3550 struct alc_spec
*spec
= codec
->spec
;
3553 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3554 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
3555 if (alc880_is_input_pin(nid
)) {
3556 snd_hda_codec_write(codec
, nid
, 0,
3557 AC_VERB_SET_PIN_WIDGET_CONTROL
,
3558 i
<= AUTO_PIN_FRONT_MIC
?
3559 PIN_VREF80
: PIN_IN
);
3560 if (nid
!= ALC880_PIN_CD_NID
)
3561 snd_hda_codec_write(codec
, nid
, 0,
3562 AC_VERB_SET_AMP_GAIN_MUTE
,
3568 /* parse the BIOS configuration and set up the alc_spec */
3569 /* return 1 if successful, 0 if the proper config is not found,
3570 * or a negative error code
3572 static int alc880_parse_auto_config(struct hda_codec
*codec
)
3574 struct alc_spec
*spec
= codec
->spec
;
3576 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
3578 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
3582 if (!spec
->autocfg
.line_outs
)
3583 return 0; /* can't find valid BIOS pin config */
3585 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
3588 err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
3591 err
= alc880_auto_create_extra_out(spec
,
3592 spec
->autocfg
.speaker_pins
[0],
3596 err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
3600 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
3604 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
3606 if (spec
->autocfg
.dig_out_pin
)
3607 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
3608 if (spec
->autocfg
.dig_in_pin
)
3609 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
3611 if (spec
->kctl_alloc
)
3612 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3614 spec
->init_verbs
[spec
->num_init_verbs
++] = alc880_volume_init_verbs
;
3616 spec
->num_mux_defs
= 1;
3617 spec
->input_mux
= &spec
->private_imux
;
3622 /* additional initialization for auto-configuration model */
3623 static void alc880_auto_init(struct hda_codec
*codec
)
3625 struct alc_spec
*spec
= codec
->spec
;
3626 alc880_auto_init_multi_out(codec
);
3627 alc880_auto_init_extra_out(codec
);
3628 alc880_auto_init_analog_input(codec
);
3629 if (spec
->unsol_event
)
3630 alc_sku_automute(codec
);
3634 * OK, here we have finally the patch for ALC880
3637 static int patch_alc880(struct hda_codec
*codec
)
3639 struct alc_spec
*spec
;
3643 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3649 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
3652 if (board_config
< 0) {
3653 printk(KERN_INFO
"hda_codec: Unknown model for ALC880, "
3654 "trying auto-probe from BIOS...\n");
3655 board_config
= ALC880_AUTO
;
3658 if (board_config
== ALC880_AUTO
) {
3659 /* automatic parse from the BIOS config */
3660 err
= alc880_parse_auto_config(codec
);
3666 "hda_codec: Cannot set up configuration "
3667 "from BIOS. Using 3-stack mode...\n");
3668 board_config
= ALC880_3ST
;
3672 if (board_config
!= ALC880_AUTO
)
3673 setup_preset(spec
, &alc880_presets
[board_config
]);
3675 spec
->stream_name_analog
= "ALC880 Analog";
3676 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
3677 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
3678 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
3680 spec
->stream_name_digital
= "ALC880 Digital";
3681 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
3682 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
3684 if (!spec
->adc_nids
&& spec
->input_mux
) {
3685 /* check whether NID 0x07 is valid */
3686 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
3688 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
3689 if (wcap
!= AC_WID_AUD_IN
) {
3690 spec
->adc_nids
= alc880_adc_nids_alt
;
3691 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
3692 spec
->mixers
[spec
->num_mixers
] =
3693 alc880_capture_alt_mixer
;
3696 spec
->adc_nids
= alc880_adc_nids
;
3697 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
3698 spec
->mixers
[spec
->num_mixers
] = alc880_capture_mixer
;
3703 spec
->vmaster_nid
= 0x0c;
3705 codec
->patch_ops
= alc_patch_ops
;
3706 if (board_config
== ALC880_AUTO
)
3707 spec
->init_hook
= alc880_auto_init
;
3708 #ifdef CONFIG_SND_HDA_POWER_SAVE
3709 if (!spec
->loopback
.amplist
)
3710 spec
->loopback
.amplist
= alc880_loopbacks
;
3721 static hda_nid_t alc260_dac_nids
[1] = {
3726 static hda_nid_t alc260_adc_nids
[1] = {
3731 static hda_nid_t alc260_adc_nids_alt
[1] = {
3736 static hda_nid_t alc260_hp_adc_nids
[2] = {
3741 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3742 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3744 static hda_nid_t alc260_dual_adc_nids
[2] = {
3749 #define ALC260_DIGOUT_NID 0x03
3750 #define ALC260_DIGIN_NID 0x06
3752 static struct hda_input_mux alc260_capture_source
= {
3756 { "Front Mic", 0x1 },
3762 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3763 * headphone jack and the internal CD lines since these are the only pins at
3764 * which audio can appear. For flexibility, also allow the option of
3765 * recording the mixer output on the second ADC (ADC0 doesn't have a
3766 * connection to the mixer output).
3768 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
3772 { "Mic/Line", 0x0 },
3774 { "Headphone", 0x2 },
3780 { "Mic/Line", 0x0 },
3782 { "Headphone", 0x2 },
3789 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3790 * the Fujitsu S702x, but jacks are marked differently.
3792 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
3799 { "Headphone", 0x5 },
3808 { "Headphone", 0x6 },
3814 * This is just place-holder, so there's something for alc_build_pcms to look
3815 * at when it calculates the maximum number of channels. ALC260 has no mixer
3816 * element which allows changing the channel mode, so the verb list is
3819 static struct hda_channel_mode alc260_modes
[1] = {
3824 /* Mixer combinations
3826 * basic: base_output + input + pc_beep + capture
3827 * HP: base_output + input + capture_alt
3828 * HP_3013: hp_3013 + input + capture
3829 * fujitsu: fujitsu + capture
3830 * acer: acer + capture
3833 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
3834 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3835 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
3836 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3837 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
3838 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3839 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
3843 static struct snd_kcontrol_new alc260_input_mixer
[] = {
3844 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3845 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3846 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3847 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3848 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3849 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3850 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
3851 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
3855 static struct snd_kcontrol_new alc260_pc_beep_mixer
[] = {
3856 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT
),
3857 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT
),
3861 /* update HP, line and mono out pins according to the master switch */
3862 static void alc260_hp_master_update(struct hda_codec
*codec
,
3863 hda_nid_t hp
, hda_nid_t line
,
3866 struct alc_spec
*spec
= codec
->spec
;
3867 unsigned int val
= spec
->master_sw
? PIN_HP
: 0;
3868 /* change HP and line-out pins */
3869 snd_hda_codec_write(codec
, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
3871 snd_hda_codec_write(codec
, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
3873 /* mono (speaker) depending on the HP jack sense */
3874 val
= (val
&& !spec
->jack_present
) ? PIN_OUT
: 0;
3875 snd_hda_codec_write(codec
, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
3879 static int alc260_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
3880 struct snd_ctl_elem_value
*ucontrol
)
3882 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3883 struct alc_spec
*spec
= codec
->spec
;
3884 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
3888 static int alc260_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
3889 struct snd_ctl_elem_value
*ucontrol
)
3891 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
3892 struct alc_spec
*spec
= codec
->spec
;
3893 int val
= !!*ucontrol
->value
.integer
.value
;
3894 hda_nid_t hp
, line
, mono
;
3896 if (val
== spec
->master_sw
)
3898 spec
->master_sw
= val
;
3899 hp
= (kcontrol
->private_value
>> 16) & 0xff;
3900 line
= (kcontrol
->private_value
>> 8) & 0xff;
3901 mono
= kcontrol
->private_value
& 0xff;
3902 alc260_hp_master_update(codec
, hp
, line
, mono
);
3906 static struct snd_kcontrol_new alc260_hp_output_mixer
[] = {
3908 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3909 .name
= "Master Playback Switch",
3910 .info
= snd_ctl_boolean_mono_info
,
3911 .get
= alc260_hp_master_sw_get
,
3912 .put
= alc260_hp_master_sw_put
,
3913 .private_value
= (0x0f << 16) | (0x10 << 8) | 0x11
3915 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3916 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
3917 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3918 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
3919 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
3921 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
3925 static struct hda_verb alc260_hp_unsol_verbs
[] = {
3926 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3930 static void alc260_hp_automute(struct hda_codec
*codec
)
3932 struct alc_spec
*spec
= codec
->spec
;
3933 unsigned int present
;
3935 present
= snd_hda_codec_read(codec
, 0x10, 0,
3936 AC_VERB_GET_PIN_SENSE
, 0);
3937 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
3938 alc260_hp_master_update(codec
, 0x0f, 0x10, 0x11);
3941 static void alc260_hp_unsol_event(struct hda_codec
*codec
, unsigned int res
)
3943 if ((res
>> 26) == ALC880_HP_EVENT
)
3944 alc260_hp_automute(codec
);
3947 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
3949 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3950 .name
= "Master Playback Switch",
3951 .info
= snd_ctl_boolean_mono_info
,
3952 .get
= alc260_hp_master_sw_get
,
3953 .put
= alc260_hp_master_sw_put
,
3954 .private_value
= (0x10 << 16) | (0x15 << 8) | 0x11
3956 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3957 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
3958 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
3959 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
3960 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3961 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
3962 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3963 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
3967 static struct hda_verb alc260_hp_3013_unsol_verbs
[] = {
3968 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
3972 static void alc260_hp_3013_automute(struct hda_codec
*codec
)
3974 struct alc_spec
*spec
= codec
->spec
;
3975 unsigned int present
;
3977 present
= snd_hda_codec_read(codec
, 0x15, 0,
3978 AC_VERB_GET_PIN_SENSE
, 0);
3979 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
3980 alc260_hp_master_update(codec
, 0x10, 0x15, 0x11);
3983 static void alc260_hp_3013_unsol_event(struct hda_codec
*codec
,
3986 if ((res
>> 26) == ALC880_HP_EVENT
)
3987 alc260_hp_3013_automute(codec
);
3990 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3991 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3993 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
3994 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3995 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
3996 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3997 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3998 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3999 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
4000 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
4001 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4002 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4003 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4004 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4005 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
4009 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4010 * versions of the ALC260 don't act on requests to enable mic bias from NID
4011 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4012 * datasheet doesn't mention this restriction. At this stage it's not clear
4013 * whether this behaviour is intentional or is a hardware bug in chip
4014 * revisions available in early 2006. Therefore for now allow the
4015 * "Headphone Jack Mode" control to span all choices, but if it turns out
4016 * that the lack of mic bias for this NID is intentional we could change the
4017 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4019 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4020 * don't appear to make the mic bias available from the "line" jack, even
4021 * though the NID used for this jack (0x14) can supply it. The theory is
4022 * that perhaps Acer have included blocking capacitors between the ALC260
4023 * and the output jack. If this turns out to be the case for all such
4024 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4025 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4027 * The C20x Tablet series have a mono internal speaker which is controlled
4028 * via the chip's Mono sum widget and pin complex, so include the necessary
4029 * controls for such models. On models without a "mono speaker" the control
4030 * won't do anything.
4032 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
4033 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4034 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
4035 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
4036 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4038 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4040 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4041 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4042 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4043 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4044 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4045 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4046 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4047 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4048 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4049 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4053 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
4054 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
4056 static struct snd_kcontrol_new alc260_will_mixer
[] = {
4057 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4058 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
4059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4060 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4061 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4062 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4063 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4064 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4065 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4066 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4067 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4068 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4072 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
4073 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
4075 static struct snd_kcontrol_new alc260_replacer_672v_mixer
[] = {
4076 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4077 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT
),
4078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
4079 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
4080 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
4081 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT
),
4082 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT
),
4083 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
4084 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
4085 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
4089 /* capture mixer elements */
4090 static struct snd_kcontrol_new alc260_capture_mixer
[] = {
4091 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT
),
4092 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT
),
4093 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT
),
4094 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT
),
4096 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4097 /* The multiple "Capture Source" controls confuse alsamixer
4098 * So call somewhat different..
4100 /* .name = "Capture Source", */
4101 .name
= "Input Source",
4103 .info
= alc_mux_enum_info
,
4104 .get
= alc_mux_enum_get
,
4105 .put
= alc_mux_enum_put
,
4110 static struct snd_kcontrol_new alc260_capture_alt_mixer
[] = {
4111 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT
),
4112 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT
),
4114 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4115 /* The multiple "Capture Source" controls confuse alsamixer
4116 * So call somewhat different..
4118 /* .name = "Capture Source", */
4119 .name
= "Input Source",
4121 .info
= alc_mux_enum_info
,
4122 .get
= alc_mux_enum_get
,
4123 .put
= alc_mux_enum_put
,
4129 * initialization verbs
4131 static struct hda_verb alc260_init_verbs
[] = {
4132 /* Line In pin widget for input */
4133 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4134 /* CD pin widget for input */
4135 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4136 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4137 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4138 /* Mic2 (front panel) pin widget for input and vref at 80% */
4139 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4140 /* LINE-2 is used for line-out in rear */
4141 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4142 /* select line-out */
4143 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
4145 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4147 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4149 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4150 /* mute capture amp left and right */
4151 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4152 /* set connection select to line in (default select for this ADC) */
4153 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4154 /* mute capture amp left and right */
4155 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4156 /* set connection select to line in (default select for this ADC) */
4157 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
4158 /* set vol=0 Line-Out mixer amp left and right */
4159 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4160 /* unmute pin widget amp left and right (no gain on this amp) */
4161 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4162 /* set vol=0 HP mixer amp left and right */
4163 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4164 /* unmute pin widget amp left and right (no gain on this amp) */
4165 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4166 /* set vol=0 Mono mixer amp left and right */
4167 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4168 /* unmute pin widget amp left and right (no gain on this amp) */
4169 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4170 /* unmute LINE-2 out pin */
4171 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4172 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4175 /* mute analog inputs */
4176 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4177 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4178 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4179 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4180 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4181 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4182 /* mute Front out path */
4183 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4184 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4185 /* mute Headphone out path */
4186 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4187 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4188 /* mute Mono out path */
4189 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4190 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4194 #if 0 /* should be identical with alc260_init_verbs? */
4195 static struct hda_verb alc260_hp_init_verbs
[] = {
4196 /* Headphone and output */
4197 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
4199 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4200 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4201 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4202 /* Mic2 (front panel) pin widget for input and vref at 80% */
4203 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4204 /* Line In pin widget for input */
4205 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4206 /* Line-2 pin widget for output */
4207 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4208 /* CD pin widget for input */
4209 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4210 /* unmute amp left and right */
4211 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
4212 /* set connection select to line in (default select for this ADC) */
4213 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4214 /* unmute Line-Out mixer amp left and right (volume = 0) */
4215 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4216 /* mute pin widget amp left and right (no gain on this amp) */
4217 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4218 /* unmute HP mixer amp left and right (volume = 0) */
4219 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4220 /* mute pin widget amp left and right (no gain on this amp) */
4221 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4222 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4225 /* mute analog inputs */
4226 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4227 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4228 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4229 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4230 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4231 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4232 /* Unmute Front out path */
4233 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4234 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4235 /* Unmute Headphone out path */
4236 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4238 /* Unmute Mono out path */
4239 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4240 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4245 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
4246 /* Line out and output */
4247 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4249 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
4250 /* Mic1 (rear panel) pin widget for input and vref at 80% */
4251 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4252 /* Mic2 (front panel) pin widget for input and vref at 80% */
4253 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
4254 /* Line In pin widget for input */
4255 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4256 /* Headphone pin widget for output */
4257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
4258 /* CD pin widget for input */
4259 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
4260 /* unmute amp left and right */
4261 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
4262 /* set connection select to line in (default select for this ADC) */
4263 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
4264 /* unmute Line-Out mixer amp left and right (volume = 0) */
4265 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4266 /* mute pin widget amp left and right (no gain on this amp) */
4267 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4268 /* unmute HP mixer amp left and right (volume = 0) */
4269 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
4270 /* mute pin widget amp left and right (no gain on this amp) */
4271 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
4272 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
4275 /* mute analog inputs */
4276 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4280 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4281 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
4282 /* Unmute Front out path */
4283 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4284 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4285 /* Unmute Headphone out path */
4286 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4287 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4288 /* Unmute Mono out path */
4289 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4290 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
4294 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
4295 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
4296 * audio = 0x16, internal speaker = 0x10.
4298 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
4299 /* Disable all GPIOs */
4300 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
4301 /* Internal speaker is connected to headphone pin */
4302 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4303 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
4304 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4305 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
4306 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4307 /* Ensure all other unused pins are disabled and muted. */
4308 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4309 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4310 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4311 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4312 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4313 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4314 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4315 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4317 /* Disable digital (SPDIF) pins */
4318 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4319 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4321 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
4322 * when acting as an output.
4324 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4326 /* Start with output sum widgets muted and their output gains at min */
4327 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4328 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4329 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4330 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4331 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4332 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4333 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4334 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4335 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4337 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
4338 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4339 /* Unmute Line1 pin widget output buffer since it starts as an output.
4340 * If the pin mode is changed by the user the pin mode control will
4341 * take care of enabling the pin's input/output buffers as needed.
4342 * Therefore there's no need to enable the input buffer at this
4345 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4346 /* Unmute input buffer of pin widget used for Line-in (no equiv
4349 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4351 /* Mute capture amp left and right */
4352 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4353 /* Set ADC connection select to match default mixer setting - line
4356 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4358 /* Do the same for the second ADC: mute capture input amp and
4359 * set ADC connection to line in (on mic1 pin)
4361 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4362 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4364 /* Mute all inputs to mixer widget (even unconnected ones) */
4365 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4366 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4367 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4368 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4369 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4370 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4371 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4377 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
4378 * similar laptops (adapted from Fujitsu init verbs).
4380 static struct hda_verb alc260_acer_init_verbs
[] = {
4381 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
4382 * the headphone jack. Turn this on and rely on the standard mute
4383 * methods whenever the user wants to turn these outputs off.
4385 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4386 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4387 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
4388 /* Internal speaker/Headphone jack is connected to Line-out pin */
4389 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4390 /* Internal microphone/Mic jack is connected to Mic1 pin */
4391 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
4392 /* Line In jack is connected to Line1 pin */
4393 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4394 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
4395 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4396 /* Ensure all other unused pins are disabled and muted. */
4397 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4398 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4399 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4400 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4401 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
4402 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4403 /* Disable digital (SPDIF) pins */
4404 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4405 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4407 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
4408 * bus when acting as outputs.
4410 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4411 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4413 /* Start with output sum widgets muted and their output gains at min */
4414 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4415 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4416 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4417 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4418 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4419 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4420 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4421 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4422 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4424 /* Unmute Line-out pin widget amp left and right
4425 * (no equiv mixer ctrl)
4427 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4428 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
4429 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4430 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
4431 * inputs. If the pin mode is changed by the user the pin mode control
4432 * will take care of enabling the pin's input/output buffers as needed.
4433 * Therefore there's no need to enable the input buffer at this
4436 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4437 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4439 /* Mute capture amp left and right */
4440 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4441 /* Set ADC connection select to match default mixer setting - mic
4444 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4446 /* Do similar with the second ADC: mute capture input amp and
4447 * set ADC connection to mic to match ALSA's default state.
4449 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4450 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4452 /* Mute all inputs to mixer widget (even unconnected ones) */
4453 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4454 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4455 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4465 static struct hda_verb alc260_will_verbs
[] = {
4466 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4467 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00},
4468 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00},
4469 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4470 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4471 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3040},
4475 static struct hda_verb alc260_replacer_672v_verbs
[] = {
4476 {0x0f, AC_VERB_SET_EAPD_BTLENABLE
, 0x02},
4477 {0x1a, AC_VERB_SET_COEF_INDEX
, 0x07},
4478 {0x1a, AC_VERB_SET_PROC_COEF
, 0x3050},
4480 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
4481 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
4482 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4484 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
4488 /* toggle speaker-output according to the hp-jack state */
4489 static void alc260_replacer_672v_automute(struct hda_codec
*codec
)
4491 unsigned int present
;
4493 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
4494 present
= snd_hda_codec_read(codec
, 0x0f, 0,
4495 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
4497 snd_hda_codec_write_cache(codec
, 0x01, 0,
4498 AC_VERB_SET_GPIO_DATA
, 1);
4499 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4500 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4503 snd_hda_codec_write_cache(codec
, 0x01, 0,
4504 AC_VERB_SET_GPIO_DATA
, 0);
4505 snd_hda_codec_write_cache(codec
, 0x0f, 0,
4506 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4511 static void alc260_replacer_672v_unsol_event(struct hda_codec
*codec
,
4514 if ((res
>> 26) == ALC880_HP_EVENT
)
4515 alc260_replacer_672v_automute(codec
);
4518 /* Test configuration for debugging, modelled after the ALC880 test
4521 #ifdef CONFIG_SND_DEBUG
4522 static hda_nid_t alc260_test_dac_nids
[1] = {
4525 static hda_nid_t alc260_test_adc_nids
[2] = {
4528 /* For testing the ALC260, each input MUX needs its own definition since
4529 * the signal assignments are different. This assumes that the first ADC
4532 static struct hda_input_mux alc260_test_capture_sources
[2] = {
4536 { "MIC1 pin", 0x0 },
4537 { "MIC2 pin", 0x1 },
4538 { "LINE1 pin", 0x2 },
4539 { "LINE2 pin", 0x3 },
4541 { "LINE-OUT pin", 0x5 },
4542 { "HP-OUT pin", 0x6 },
4548 { "MIC1 pin", 0x0 },
4549 { "MIC2 pin", 0x1 },
4550 { "LINE1 pin", 0x2 },
4551 { "LINE2 pin", 0x3 },
4554 { "LINE-OUT pin", 0x6 },
4555 { "HP-OUT pin", 0x7 },
4559 static struct snd_kcontrol_new alc260_test_mixer
[] = {
4560 /* Output driver widgets */
4561 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
4562 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
4563 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
4564 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
4565 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
4566 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
4568 /* Modes for retasking pin widgets
4569 * Note: the ALC260 doesn't seem to act on requests to enable mic
4570 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
4571 * mention this restriction. At this stage it's not clear whether
4572 * this behaviour is intentional or is a hardware bug in chip
4573 * revisions available at least up until early 2006. Therefore for
4574 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
4575 * choices, but if it turns out that the lack of mic bias for these
4576 * NIDs is intentional we could change their modes from
4577 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4579 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
4580 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
4581 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
4582 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
4583 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
4584 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
4586 /* Loopback mixer controls */
4587 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
4588 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
4589 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
4590 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
4591 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
4592 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
4593 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
4594 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
4595 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
4596 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
4597 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
4598 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
4599 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
4600 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
4601 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
4602 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
4604 /* Controls for GPIO pins, assuming they are configured as outputs */
4605 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
4606 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
4607 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
4608 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
4610 /* Switches to allow the digital IO pins to be enabled. The datasheet
4611 * is ambigious as to which NID is which; testing on laptops which
4612 * make this output available should provide clarification.
4614 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
4615 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
4617 /* A switch allowing EAPD to be enabled. Some laptops seem to use
4618 * this output to turn on an external amplifier.
4620 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
4621 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
4625 static struct hda_verb alc260_test_init_verbs
[] = {
4626 /* Enable all GPIOs as outputs with an initial value of 0 */
4627 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
4628 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
4629 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
4631 /* Enable retasking pins as output, initially without power amp */
4632 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4633 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4634 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4635 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4636 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4637 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4639 /* Disable digital (SPDIF) pins initially, but users can enable
4640 * them via a mixer switch. In the case of SPDIF-out, this initverb
4641 * payload also sets the generation to 0, output to be in "consumer"
4642 * PCM format, copyright asserted, no pre-emphasis and no validity
4645 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4646 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
4648 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
4649 * OUT1 sum bus when acting as an output.
4651 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
4652 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
4653 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
4654 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
4656 /* Start with output sum widgets muted and their output gains at min */
4657 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4658 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4659 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4660 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4661 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4662 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4663 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4664 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4665 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4667 /* Unmute retasking pin widget output buffers since the default
4668 * state appears to be output. As the pin mode is changed by the
4669 * user the pin mode control will take care of enabling the pin's
4670 * input/output buffers as needed.
4672 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4673 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4674 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4675 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4676 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4677 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4678 /* Also unmute the mono-out pin widget */
4679 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4681 /* Mute capture amp left and right */
4682 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4683 /* Set ADC connection select to match default mixer setting (mic1
4686 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4688 /* Do the same for the second ADC: mute capture input amp and
4689 * set ADC connection to mic1 pin
4691 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4692 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4694 /* Mute all inputs to mixer widget (even unconnected ones) */
4695 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
4696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
4697 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
4698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
4699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
4700 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
4701 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
4702 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
4708 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
4709 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
4711 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
4712 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
4715 * for BIOS auto-configuration
4718 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
4722 unsigned long vol_val
, sw_val
;
4726 if (nid
>= 0x0f && nid
< 0x11) {
4727 nid_vol
= nid
- 0x7;
4728 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
4729 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4730 } else if (nid
== 0x11) {
4731 nid_vol
= nid
- 0x7;
4732 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
4733 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
4734 } else if (nid
>= 0x12 && nid
<= 0x15) {
4736 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
4737 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
4741 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
4742 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
);
4745 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
4746 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
);
4752 /* add playback controls from the parsed DAC table */
4753 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
4754 const struct auto_pin_cfg
*cfg
)
4759 spec
->multiout
.num_dacs
= 1;
4760 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
4761 spec
->multiout
.dac_nids
[0] = 0x02;
4763 nid
= cfg
->line_out_pins
[0];
4765 err
= alc260_add_playback_controls(spec
, nid
, "Front");
4770 nid
= cfg
->speaker_pins
[0];
4772 err
= alc260_add_playback_controls(spec
, nid
, "Speaker");
4777 nid
= cfg
->hp_pins
[0];
4779 err
= alc260_add_playback_controls(spec
, nid
, "Headphone");
4786 /* create playback/capture controls for input pins */
4787 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
4788 const struct auto_pin_cfg
*cfg
)
4790 struct hda_input_mux
*imux
= &spec
->private_imux
;
4793 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4794 if (cfg
->input_pins
[i
] >= 0x12) {
4795 idx
= cfg
->input_pins
[i
] - 0x12;
4796 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4797 auto_pin_cfg_labels
[i
], idx
,
4801 imux
->items
[imux
->num_items
].label
=
4802 auto_pin_cfg_labels
[i
];
4803 imux
->items
[imux
->num_items
].index
= idx
;
4806 if (cfg
->input_pins
[i
] >= 0x0f && cfg
->input_pins
[i
] <= 0x10){
4807 idx
= cfg
->input_pins
[i
] - 0x09;
4808 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4809 auto_pin_cfg_labels
[i
], idx
,
4813 imux
->items
[imux
->num_items
].label
=
4814 auto_pin_cfg_labels
[i
];
4815 imux
->items
[imux
->num_items
].index
= idx
;
4822 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
4823 hda_nid_t nid
, int pin_type
,
4826 alc_set_pin_output(codec
, nid
, pin_type
);
4827 /* need the manual connection? */
4829 int idx
= nid
- 0x12;
4830 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
4831 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
4835 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
4837 struct alc_spec
*spec
= codec
->spec
;
4840 alc_subsystem_id(codec
, 0x10, 0x15, 0x0f);
4841 nid
= spec
->autocfg
.line_out_pins
[0];
4843 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
4844 alc260_auto_set_output_and_unmute(codec
, nid
, pin_type
, 0);
4847 nid
= spec
->autocfg
.speaker_pins
[0];
4849 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
4851 nid
= spec
->autocfg
.hp_pins
[0];
4853 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_HP
, 0);
4856 #define ALC260_PIN_CD_NID 0x16
4857 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
4859 struct alc_spec
*spec
= codec
->spec
;
4862 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4863 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
4865 snd_hda_codec_write(codec
, nid
, 0,
4866 AC_VERB_SET_PIN_WIDGET_CONTROL
,
4867 i
<= AUTO_PIN_FRONT_MIC
?
4868 PIN_VREF80
: PIN_IN
);
4869 if (nid
!= ALC260_PIN_CD_NID
)
4870 snd_hda_codec_write(codec
, nid
, 0,
4871 AC_VERB_SET_AMP_GAIN_MUTE
,
4878 * generic initialization of ADC, input mixers and output mixers
4880 static struct hda_verb alc260_volume_init_verbs
[] = {
4882 * Unmute ADC0-1 and set the default input to mic-in
4884 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4885 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4886 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4887 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4889 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4891 * Note: PASD motherboards uses the Line In 2 as the input for
4892 * front panel mic (mic 2)
4894 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4895 /* mute analog inputs */
4896 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4897 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4898 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4899 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4900 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4903 * Set up output mixers (0x08 - 0x0a)
4905 /* set vol=0 to output mixers */
4906 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4907 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4908 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4909 /* set up input amps for analog loopback */
4910 /* Amp Indices: DAC = 0, mixer = 1 */
4911 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4912 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4913 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4914 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4915 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4916 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4921 static int alc260_parse_auto_config(struct hda_codec
*codec
)
4923 struct alc_spec
*spec
= codec
->spec
;
4926 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
4928 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
4932 err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
4935 if (!spec
->kctl_alloc
)
4936 return 0; /* can't find valid BIOS pin config */
4937 err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
4941 spec
->multiout
.max_channels
= 2;
4943 if (spec
->autocfg
.dig_out_pin
)
4944 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
4945 if (spec
->kctl_alloc
)
4946 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
4948 spec
->init_verbs
[spec
->num_init_verbs
++] = alc260_volume_init_verbs
;
4950 spec
->num_mux_defs
= 1;
4951 spec
->input_mux
= &spec
->private_imux
;
4953 /* check whether NID 0x04 is valid */
4954 wcap
= get_wcaps(codec
, 0x04);
4955 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
4956 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
4957 spec
->adc_nids
= alc260_adc_nids_alt
;
4958 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
4959 spec
->mixers
[spec
->num_mixers
] = alc260_capture_alt_mixer
;
4961 spec
->adc_nids
= alc260_adc_nids
;
4962 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
4963 spec
->mixers
[spec
->num_mixers
] = alc260_capture_mixer
;
4970 /* additional initialization for auto-configuration model */
4971 static void alc260_auto_init(struct hda_codec
*codec
)
4973 struct alc_spec
*spec
= codec
->spec
;
4974 alc260_auto_init_multi_out(codec
);
4975 alc260_auto_init_analog_input(codec
);
4976 if (spec
->unsol_event
)
4977 alc_sku_automute(codec
);
4980 #ifdef CONFIG_SND_HDA_POWER_SAVE
4981 static struct hda_amp_list alc260_loopbacks
[] = {
4982 { 0x07, HDA_INPUT
, 0 },
4983 { 0x07, HDA_INPUT
, 1 },
4984 { 0x07, HDA_INPUT
, 2 },
4985 { 0x07, HDA_INPUT
, 3 },
4986 { 0x07, HDA_INPUT
, 4 },
4992 * ALC260 configurations
4994 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
4995 [ALC260_BASIC
] = "basic",
4997 [ALC260_HP_3013
] = "hp-3013",
4998 [ALC260_FUJITSU_S702X
] = "fujitsu",
4999 [ALC260_ACER
] = "acer",
5000 [ALC260_WILL
] = "will",
5001 [ALC260_REPLACER_672V
] = "replacer",
5002 #ifdef CONFIG_SND_DEBUG
5003 [ALC260_TEST
] = "test",
5005 [ALC260_AUTO
] = "auto",
5008 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
5009 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
5010 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
5011 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013
),
5012 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013
),
5013 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
5014 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP
),
5015 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013
),
5016 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
5017 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
5018 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
5019 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
5020 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
5021 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
5022 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
5023 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
5024 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
5025 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V
),
5026 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL
),
5030 static struct alc_config_preset alc260_presets
[] = {
5032 .mixers
= { alc260_base_output_mixer
,
5034 alc260_pc_beep_mixer
,
5035 alc260_capture_mixer
},
5036 .init_verbs
= { alc260_init_verbs
},
5037 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5038 .dac_nids
= alc260_dac_nids
,
5039 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5040 .adc_nids
= alc260_adc_nids
,
5041 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5042 .channel_mode
= alc260_modes
,
5043 .input_mux
= &alc260_capture_source
,
5046 .mixers
= { alc260_hp_output_mixer
,
5048 alc260_capture_alt_mixer
},
5049 .init_verbs
= { alc260_init_verbs
,
5050 alc260_hp_unsol_verbs
},
5051 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5052 .dac_nids
= alc260_dac_nids
,
5053 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
5054 .adc_nids
= alc260_hp_adc_nids
,
5055 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5056 .channel_mode
= alc260_modes
,
5057 .input_mux
= &alc260_capture_source
,
5058 .unsol_event
= alc260_hp_unsol_event
,
5059 .init_hook
= alc260_hp_automute
,
5061 [ALC260_HP_3013
] = {
5062 .mixers
= { alc260_hp_3013_mixer
,
5064 alc260_capture_alt_mixer
},
5065 .init_verbs
= { alc260_hp_3013_init_verbs
,
5066 alc260_hp_3013_unsol_verbs
},
5067 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5068 .dac_nids
= alc260_dac_nids
,
5069 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
5070 .adc_nids
= alc260_hp_adc_nids
,
5071 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5072 .channel_mode
= alc260_modes
,
5073 .input_mux
= &alc260_capture_source
,
5074 .unsol_event
= alc260_hp_3013_unsol_event
,
5075 .init_hook
= alc260_hp_3013_automute
,
5077 [ALC260_FUJITSU_S702X
] = {
5078 .mixers
= { alc260_fujitsu_mixer
,
5079 alc260_capture_mixer
},
5080 .init_verbs
= { alc260_fujitsu_init_verbs
},
5081 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5082 .dac_nids
= alc260_dac_nids
,
5083 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5084 .adc_nids
= alc260_dual_adc_nids
,
5085 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5086 .channel_mode
= alc260_modes
,
5087 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
5088 .input_mux
= alc260_fujitsu_capture_sources
,
5091 .mixers
= { alc260_acer_mixer
,
5092 alc260_capture_mixer
},
5093 .init_verbs
= { alc260_acer_init_verbs
},
5094 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5095 .dac_nids
= alc260_dac_nids
,
5096 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
5097 .adc_nids
= alc260_dual_adc_nids
,
5098 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5099 .channel_mode
= alc260_modes
,
5100 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
5101 .input_mux
= alc260_acer_capture_sources
,
5104 .mixers
= { alc260_will_mixer
,
5105 alc260_capture_mixer
},
5106 .init_verbs
= { alc260_init_verbs
, alc260_will_verbs
},
5107 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5108 .dac_nids
= alc260_dac_nids
,
5109 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5110 .adc_nids
= alc260_adc_nids
,
5111 .dig_out_nid
= ALC260_DIGOUT_NID
,
5112 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5113 .channel_mode
= alc260_modes
,
5114 .input_mux
= &alc260_capture_source
,
5116 [ALC260_REPLACER_672V
] = {
5117 .mixers
= { alc260_replacer_672v_mixer
,
5118 alc260_capture_mixer
},
5119 .init_verbs
= { alc260_init_verbs
, alc260_replacer_672v_verbs
},
5120 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
5121 .dac_nids
= alc260_dac_nids
,
5122 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
5123 .adc_nids
= alc260_adc_nids
,
5124 .dig_out_nid
= ALC260_DIGOUT_NID
,
5125 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5126 .channel_mode
= alc260_modes
,
5127 .input_mux
= &alc260_capture_source
,
5128 .unsol_event
= alc260_replacer_672v_unsol_event
,
5129 .init_hook
= alc260_replacer_672v_automute
,
5131 #ifdef CONFIG_SND_DEBUG
5133 .mixers
= { alc260_test_mixer
,
5134 alc260_capture_mixer
},
5135 .init_verbs
= { alc260_test_init_verbs
},
5136 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
5137 .dac_nids
= alc260_test_dac_nids
,
5138 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
5139 .adc_nids
= alc260_test_adc_nids
,
5140 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
5141 .channel_mode
= alc260_modes
,
5142 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
5143 .input_mux
= alc260_test_capture_sources
,
5148 static int patch_alc260(struct hda_codec
*codec
)
5150 struct alc_spec
*spec
;
5151 int err
, board_config
;
5153 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5159 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
5162 if (board_config
< 0) {
5163 snd_printd(KERN_INFO
"hda_codec: Unknown model for ALC260, "
5164 "trying auto-probe from BIOS...\n");
5165 board_config
= ALC260_AUTO
;
5168 if (board_config
== ALC260_AUTO
) {
5169 /* automatic parse from the BIOS config */
5170 err
= alc260_parse_auto_config(codec
);
5176 "hda_codec: Cannot set up configuration "
5177 "from BIOS. Using base mode...\n");
5178 board_config
= ALC260_BASIC
;
5182 if (board_config
!= ALC260_AUTO
)
5183 setup_preset(spec
, &alc260_presets
[board_config
]);
5185 spec
->stream_name_analog
= "ALC260 Analog";
5186 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
5187 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
5189 spec
->stream_name_digital
= "ALC260 Digital";
5190 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
5191 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
5193 spec
->vmaster_nid
= 0x08;
5195 codec
->patch_ops
= alc_patch_ops
;
5196 if (board_config
== ALC260_AUTO
)
5197 spec
->init_hook
= alc260_auto_init
;
5198 #ifdef CONFIG_SND_HDA_POWER_SAVE
5199 if (!spec
->loopback
.amplist
)
5200 spec
->loopback
.amplist
= alc260_loopbacks
;
5210 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
5211 * configuration. Each pin widget can choose any input DACs and a mixer.
5212 * Each ADC is connected from a mixer of all inputs. This makes possible
5213 * 6-channel independent captures.
5215 * In addition, an independent DAC for the multi-playback (not used in this
5218 #define ALC882_DIGOUT_NID 0x06
5219 #define ALC882_DIGIN_NID 0x0a
5221 static struct hda_channel_mode alc882_ch_modes
[1] = {
5225 static hda_nid_t alc882_dac_nids
[4] = {
5226 /* front, rear, clfe, rear_surr */
5227 0x02, 0x03, 0x04, 0x05
5230 /* identical with ALC880 */
5231 #define alc882_adc_nids alc880_adc_nids
5232 #define alc882_adc_nids_alt alc880_adc_nids_alt
5234 static hda_nid_t alc882_capsrc_nids
[3] = { 0x24, 0x23, 0x22 };
5235 static hda_nid_t alc882_capsrc_nids_alt
[2] = { 0x23, 0x22 };
5238 /* FIXME: should be a matrix-type input source selection */
5240 static struct hda_input_mux alc882_capture_source
= {
5244 { "Front Mic", 0x1 },
5249 #define alc882_mux_enum_info alc_mux_enum_info
5250 #define alc882_mux_enum_get alc_mux_enum_get
5252 static int alc882_mux_enum_put(struct snd_kcontrol
*kcontrol
,
5253 struct snd_ctl_elem_value
*ucontrol
)
5255 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5256 struct alc_spec
*spec
= codec
->spec
;
5257 const struct hda_input_mux
*imux
= spec
->input_mux
;
5258 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
5259 hda_nid_t nid
= spec
->capsrc_nids
?
5260 spec
->capsrc_nids
[adc_idx
] : spec
->adc_nids
[adc_idx
];
5261 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
5262 unsigned int i
, idx
;
5264 idx
= ucontrol
->value
.enumerated
.item
[0];
5265 if (idx
>= imux
->num_items
)
5266 idx
= imux
->num_items
- 1;
5267 if (*cur_val
== idx
)
5269 for (i
= 0; i
< imux
->num_items
; i
++) {
5270 unsigned int v
= (i
== idx
) ? 0 : HDA_AMP_MUTE
;
5271 snd_hda_codec_amp_stereo(codec
, nid
, HDA_INPUT
,
5272 imux
->items
[i
].index
,
5282 static struct hda_verb alc882_3ST_ch2_init
[] = {
5283 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5284 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5285 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5286 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5293 static struct hda_verb alc882_3ST_ch6_init
[] = {
5294 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5295 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5296 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
5297 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5298 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5299 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5303 static struct hda_channel_mode alc882_3ST_6ch_modes
[2] = {
5304 { 2, alc882_3ST_ch2_init
},
5305 { 6, alc882_3ST_ch6_init
},
5311 static struct hda_verb alc882_sixstack_ch6_init
[] = {
5312 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
5313 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5314 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5315 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5322 static struct hda_verb alc882_sixstack_ch8_init
[] = {
5323 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5324 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5325 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5326 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5330 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
5331 { 6, alc882_sixstack_ch6_init
},
5332 { 8, alc882_sixstack_ch8_init
},
5336 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
5342 static struct hda_verb alc885_mbp_ch2_init
[] = {
5343 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5344 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5345 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5352 static struct hda_verb alc885_mbp_ch6_init
[] = {
5353 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5354 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5355 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5356 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5357 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5361 static struct hda_channel_mode alc885_mbp_6ch_modes
[2] = {
5362 { 2, alc885_mbp_ch2_init
},
5363 { 6, alc885_mbp_ch6_init
},
5367 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5368 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5370 static struct snd_kcontrol_new alc882_base_mixer
[] = {
5371 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5372 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5373 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5374 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5375 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5376 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5377 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5378 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5379 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
5380 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
5381 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5382 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5383 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5384 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5385 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5386 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5387 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5388 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5389 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5390 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5391 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5392 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5393 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5397 static struct snd_kcontrol_new alc885_mbp3_mixer
[] = {
5398 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
5399 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT
),
5400 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT
),
5401 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT
),
5402 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5403 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5404 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT
),
5405 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT
),
5406 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT
),
5407 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT
),
5410 static struct snd_kcontrol_new alc882_w2jc_mixer
[] = {
5411 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5412 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5413 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5414 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5415 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5416 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5417 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5418 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5419 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5420 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5421 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5425 static struct snd_kcontrol_new alc882_targa_mixer
[] = {
5426 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5427 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5428 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5429 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5430 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5431 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5432 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5435 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5436 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5437 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5438 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
5442 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
5443 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
5445 static struct snd_kcontrol_new alc882_asus_a7j_mixer
[] = {
5446 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5447 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5448 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5449 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
5450 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5451 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5452 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5453 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5454 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT
),
5455 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT
),
5456 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5457 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5458 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5462 static struct snd_kcontrol_new alc882_asus_a7m_mixer
[] = {
5463 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5464 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5465 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5466 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5467 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5468 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5469 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5470 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5471 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5472 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5473 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5474 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5478 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
5480 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5481 .name
= "Channel Mode",
5482 .info
= alc_ch_mode_info
,
5483 .get
= alc_ch_mode_get
,
5484 .put
= alc_ch_mode_put
,
5489 static struct hda_verb alc882_init_verbs
[] = {
5490 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5495 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5496 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5497 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5499 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5500 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5501 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5503 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5504 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5505 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5507 /* Front Pin: output 0 (0x0c) */
5508 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5509 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5510 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5511 /* Rear Pin: output 1 (0x0d) */
5512 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5513 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5514 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5515 /* CLFE Pin: output 2 (0x0e) */
5516 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5517 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5518 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
5519 /* Side Pin: output 3 (0x0f) */
5520 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5521 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5522 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
5523 /* Mic (rear) pin: input vref at 80% */
5524 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5525 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5526 /* Front Mic pin: input vref at 80% */
5527 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5528 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5529 /* Line In pin: input */
5530 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5531 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5532 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5533 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5534 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5535 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5536 /* CD pin widget for input */
5537 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5539 /* FIXME: use matrix-type input source selection */
5540 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5541 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5542 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5544 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5545 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5547 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5549 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5550 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5556 /* ADC1: mute amp left and right */
5557 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5558 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5559 /* ADC2: mute amp left and right */
5560 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5561 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5562 /* ADC3: mute amp left and right */
5563 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5564 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5569 static struct hda_verb alc882_eapd_verbs
[] = {
5570 /* change to EAPD mode */
5571 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
5572 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
5577 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
5578 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5579 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5580 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
5581 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5582 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5583 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5584 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5588 static struct hda_verb alc882_macpro_init_verbs
[] = {
5589 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5590 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5591 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5592 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5593 /* Front Pin: output 0 (0x0c) */
5594 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5595 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5596 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5597 /* Front Mic pin: input vref at 80% */
5598 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5599 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5600 /* Speaker: output */
5601 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5602 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5603 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
5604 /* Headphone output (output 0 - 0x0c) */
5605 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5606 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5607 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5609 /* FIXME: use matrix-type input source selection */
5610 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5611 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5614 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5615 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5617 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5618 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5619 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5620 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5626 /* ADC1: mute amp left and right */
5627 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5628 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5629 /* ADC2: mute amp left and right */
5630 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5631 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5632 /* ADC3: mute amp left and right */
5633 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5634 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5639 /* Macbook Pro rev3 */
5640 static struct hda_verb alc885_mbp3_init_verbs
[] = {
5641 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5646 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5647 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5648 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5649 /* Front Pin: output 0 (0x0c) */
5650 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5651 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5652 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5653 /* HP Pin: output 0 (0x0d) */
5654 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc4},
5655 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5656 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5657 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5658 /* Mic (rear) pin: input vref at 80% */
5659 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5660 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5661 /* Front Mic pin: input vref at 80% */
5662 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5663 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5664 /* Line In pin: use output 1 when in LineOut mode */
5665 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5666 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5667 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01},
5669 /* FIXME: use matrix-type input source selection */
5670 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5671 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5672 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5673 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5674 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5675 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5677 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5678 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5679 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5680 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5685 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5686 /* ADC1: mute amp left and right */
5687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5688 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5689 /* ADC2: mute amp left and right */
5690 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5691 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5692 /* ADC3: mute amp left and right */
5693 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5694 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5699 /* iMac 24 mixer. */
5700 static struct snd_kcontrol_new alc885_imac24_mixer
[] = {
5701 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT
),
5702 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT
),
5706 /* iMac 24 init verbs. */
5707 static struct hda_verb alc885_imac24_init_verbs
[] = {
5708 /* Internal speakers: output 0 (0x0c) */
5709 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5710 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5711 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
5712 /* Internal speakers: output 0 (0x0c) */
5713 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5714 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5715 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x00},
5716 /* Headphone: output 0 (0x0c) */
5717 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5718 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5719 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5720 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5721 /* Front Mic: input vref at 80% */
5722 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5723 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5727 /* Toggle speaker-output according to the hp-jack state */
5728 static void alc885_imac24_automute(struct hda_codec
*codec
)
5730 unsigned int present
;
5732 present
= snd_hda_codec_read(codec
, 0x14, 0,
5733 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5734 snd_hda_codec_amp_stereo(codec
, 0x18, HDA_OUTPUT
, 0,
5735 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5736 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_OUTPUT
, 0,
5737 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5740 /* Processes unsolicited events. */
5741 static void alc885_imac24_unsol_event(struct hda_codec
*codec
,
5744 /* Headphone insertion or removal. */
5745 if ((res
>> 26) == ALC880_HP_EVENT
)
5746 alc885_imac24_automute(codec
);
5749 static void alc885_mbp3_automute(struct hda_codec
*codec
)
5751 unsigned int present
;
5753 present
= snd_hda_codec_read(codec
, 0x15, 0,
5754 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5755 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
5756 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5757 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
5758 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
5761 static void alc885_mbp3_unsol_event(struct hda_codec
*codec
,
5764 /* Headphone insertion or removal. */
5765 if ((res
>> 26) == ALC880_HP_EVENT
)
5766 alc885_mbp3_automute(codec
);
5770 static struct hda_verb alc882_targa_verbs
[] = {
5771 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5772 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5774 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5775 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5777 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5778 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5779 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5781 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5782 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
5783 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
5784 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
5788 /* toggle speaker-output according to the hp-jack state */
5789 static void alc882_targa_automute(struct hda_codec
*codec
)
5791 unsigned int present
;
5793 present
= snd_hda_codec_read(codec
, 0x14, 0,
5794 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5795 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
5796 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
5797 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
5801 static void alc882_targa_unsol_event(struct hda_codec
*codec
, unsigned int res
)
5803 /* Looks like the unsol event is incompatible with the standard
5804 * definition. 4bit tag is placed at 26 bit!
5806 if (((res
>> 26) == ALC880_HP_EVENT
)) {
5807 alc882_targa_automute(codec
);
5811 static struct hda_verb alc882_asus_a7j_verbs
[] = {
5812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5815 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5816 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5817 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5819 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5820 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5821 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5823 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5824 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5825 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5829 static struct hda_verb alc882_asus_a7m_verbs
[] = {
5830 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5831 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5833 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5834 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5835 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5837 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5838 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5839 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front */
5841 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5842 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5843 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5847 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
5849 unsigned int gpiostate
, gpiomask
, gpiodir
;
5851 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5852 AC_VERB_GET_GPIO_DATA
, 0);
5855 gpiostate
|= (1 << pin
);
5857 gpiostate
&= ~(1 << pin
);
5859 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5860 AC_VERB_GET_GPIO_MASK
, 0);
5861 gpiomask
|= (1 << pin
);
5863 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
5864 AC_VERB_GET_GPIO_DIRECTION
, 0);
5865 gpiodir
|= (1 << pin
);
5868 snd_hda_codec_write(codec
, codec
->afg
, 0,
5869 AC_VERB_SET_GPIO_MASK
, gpiomask
);
5870 snd_hda_codec_write(codec
, codec
->afg
, 0,
5871 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
5875 snd_hda_codec_write(codec
, codec
->afg
, 0,
5876 AC_VERB_SET_GPIO_DATA
, gpiostate
);
5879 /* set up GPIO at initialization */
5880 static void alc885_macpro_init_hook(struct hda_codec
*codec
)
5882 alc882_gpio_mute(codec
, 0, 0);
5883 alc882_gpio_mute(codec
, 1, 0);
5886 /* set up GPIO and update auto-muting at initialization */
5887 static void alc885_imac24_init_hook(struct hda_codec
*codec
)
5889 alc885_macpro_init_hook(codec
);
5890 alc885_imac24_automute(codec
);
5894 * generic initialization of ADC, input mixers and output mixers
5896 static struct hda_verb alc882_auto_init_verbs
[] = {
5898 * Unmute ADC0-2 and set the default input to mic-in
5900 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5901 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5902 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5903 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5904 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5905 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5907 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5909 * Note: PASD motherboards uses the Line In 2 as the input for
5910 * front panel mic (mic 2)
5912 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5913 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5914 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5915 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
5916 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
5917 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
5920 * Set up output mixers (0x0c - 0x0f)
5922 /* set vol=0 to output mixers */
5923 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5924 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5925 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5926 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5927 /* set up input amps for analog loopback */
5928 /* Amp Indices: DAC = 0, mixer = 1 */
5929 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5930 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5931 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5932 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5933 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5934 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5935 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5936 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5937 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5938 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5940 /* FIXME: use matrix-type input source selection */
5941 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5942 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5943 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5944 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5945 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5946 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5948 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5949 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5950 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5951 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5954 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5955 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5956 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5961 /* capture mixer elements */
5962 static struct snd_kcontrol_new alc882_capture_alt_mixer
[] = {
5963 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5964 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5965 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5966 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5968 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5969 /* The multiple "Capture Source" controls confuse alsamixer
5970 * So call somewhat different..
5972 /* .name = "Capture Source", */
5973 .name
= "Input Source",
5975 .info
= alc882_mux_enum_info
,
5976 .get
= alc882_mux_enum_get
,
5977 .put
= alc882_mux_enum_put
,
5982 static struct snd_kcontrol_new alc882_capture_mixer
[] = {
5983 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
5984 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
5985 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
5986 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
5987 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
5988 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
5990 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5991 /* The multiple "Capture Source" controls confuse alsamixer
5992 * So call somewhat different..
5994 /* .name = "Capture Source", */
5995 .name
= "Input Source",
5997 .info
= alc882_mux_enum_info
,
5998 .get
= alc882_mux_enum_get
,
5999 .put
= alc882_mux_enum_put
,
6004 #ifdef CONFIG_SND_HDA_POWER_SAVE
6005 #define alc882_loopbacks alc880_loopbacks
6008 /* pcm configuration: identiacal with ALC880 */
6009 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
6010 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
6011 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
6012 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
6015 * configuration and preset
6017 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
6018 [ALC882_3ST_DIG
] = "3stack-dig",
6019 [ALC882_6ST_DIG
] = "6stack-dig",
6020 [ALC882_ARIMA
] = "arima",
6021 [ALC882_W2JC
] = "w2jc",
6022 [ALC882_TARGA
] = "targa",
6023 [ALC882_ASUS_A7J
] = "asus-a7j",
6024 [ALC882_ASUS_A7M
] = "asus-a7m",
6025 [ALC885_MACPRO
] = "macpro",
6026 [ALC885_MBP3
] = "mbp3",
6027 [ALC885_IMAC24
] = "imac24",
6028 [ALC882_AUTO
] = "auto",
6031 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
6032 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
6033 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J
),
6034 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J
),
6035 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M
),
6036 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC
),
6037 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG
),
6038 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG
),
6039 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
6040 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG
),
6041 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA
), /* MSI-1049 T8 */
6042 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
6043 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA
),
6047 static struct alc_config_preset alc882_presets
[] = {
6048 [ALC882_3ST_DIG
] = {
6049 .mixers
= { alc882_base_mixer
},
6050 .init_verbs
= { alc882_init_verbs
},
6051 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6052 .dac_nids
= alc882_dac_nids
,
6053 .dig_out_nid
= ALC882_DIGOUT_NID
,
6054 .dig_in_nid
= ALC882_DIGIN_NID
,
6055 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6056 .channel_mode
= alc882_ch_modes
,
6058 .input_mux
= &alc882_capture_source
,
6060 [ALC882_6ST_DIG
] = {
6061 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
6062 .init_verbs
= { alc882_init_verbs
},
6063 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6064 .dac_nids
= alc882_dac_nids
,
6065 .dig_out_nid
= ALC882_DIGOUT_NID
,
6066 .dig_in_nid
= ALC882_DIGIN_NID
,
6067 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
6068 .channel_mode
= alc882_sixstack_modes
,
6069 .input_mux
= &alc882_capture_source
,
6072 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
6073 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
},
6074 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6075 .dac_nids
= alc882_dac_nids
,
6076 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
6077 .channel_mode
= alc882_sixstack_modes
,
6078 .input_mux
= &alc882_capture_source
,
6081 .mixers
= { alc882_w2jc_mixer
, alc882_chmode_mixer
},
6082 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
6083 alc880_gpio1_init_verbs
},
6084 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6085 .dac_nids
= alc882_dac_nids
,
6086 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
6087 .channel_mode
= alc880_threestack_modes
,
6089 .input_mux
= &alc882_capture_source
,
6090 .dig_out_nid
= ALC882_DIGOUT_NID
,
6093 .mixers
= { alc885_mbp3_mixer
, alc882_chmode_mixer
},
6094 .init_verbs
= { alc885_mbp3_init_verbs
,
6095 alc880_gpio1_init_verbs
},
6096 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6097 .dac_nids
= alc882_dac_nids
,
6098 .channel_mode
= alc885_mbp_6ch_modes
,
6099 .num_channel_mode
= ARRAY_SIZE(alc885_mbp_6ch_modes
),
6100 .input_mux
= &alc882_capture_source
,
6101 .dig_out_nid
= ALC882_DIGOUT_NID
,
6102 .dig_in_nid
= ALC882_DIGIN_NID
,
6103 .unsol_event
= alc885_mbp3_unsol_event
,
6104 .init_hook
= alc885_mbp3_automute
,
6107 .mixers
= { alc882_macpro_mixer
},
6108 .init_verbs
= { alc882_macpro_init_verbs
},
6109 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6110 .dac_nids
= alc882_dac_nids
,
6111 .dig_out_nid
= ALC882_DIGOUT_NID
,
6112 .dig_in_nid
= ALC882_DIGIN_NID
,
6113 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6114 .channel_mode
= alc882_ch_modes
,
6115 .input_mux
= &alc882_capture_source
,
6116 .init_hook
= alc885_macpro_init_hook
,
6119 .mixers
= { alc885_imac24_mixer
},
6120 .init_verbs
= { alc885_imac24_init_verbs
},
6121 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6122 .dac_nids
= alc882_dac_nids
,
6123 .dig_out_nid
= ALC882_DIGOUT_NID
,
6124 .dig_in_nid
= ALC882_DIGIN_NID
,
6125 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
6126 .channel_mode
= alc882_ch_modes
,
6127 .input_mux
= &alc882_capture_source
,
6128 .unsol_event
= alc885_imac24_unsol_event
,
6129 .init_hook
= alc885_imac24_init_hook
,
6132 .mixers
= { alc882_targa_mixer
, alc882_chmode_mixer
,
6133 alc882_capture_mixer
},
6134 .init_verbs
= { alc882_init_verbs
, alc882_targa_verbs
},
6135 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6136 .dac_nids
= alc882_dac_nids
,
6137 .dig_out_nid
= ALC882_DIGOUT_NID
,
6138 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
6139 .adc_nids
= alc882_adc_nids
,
6140 .capsrc_nids
= alc882_capsrc_nids
,
6141 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
6142 .channel_mode
= alc882_3ST_6ch_modes
,
6144 .input_mux
= &alc882_capture_source
,
6145 .unsol_event
= alc882_targa_unsol_event
,
6146 .init_hook
= alc882_targa_automute
,
6148 [ALC882_ASUS_A7J
] = {
6149 .mixers
= { alc882_asus_a7j_mixer
, alc882_chmode_mixer
,
6150 alc882_capture_mixer
},
6151 .init_verbs
= { alc882_init_verbs
, alc882_asus_a7j_verbs
},
6152 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6153 .dac_nids
= alc882_dac_nids
,
6154 .dig_out_nid
= ALC882_DIGOUT_NID
,
6155 .num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
),
6156 .adc_nids
= alc882_adc_nids
,
6157 .capsrc_nids
= alc882_capsrc_nids
,
6158 .num_channel_mode
= ARRAY_SIZE(alc882_3ST_6ch_modes
),
6159 .channel_mode
= alc882_3ST_6ch_modes
,
6161 .input_mux
= &alc882_capture_source
,
6163 [ALC882_ASUS_A7M
] = {
6164 .mixers
= { alc882_asus_a7m_mixer
, alc882_chmode_mixer
},
6165 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
,
6166 alc880_gpio1_init_verbs
,
6167 alc882_asus_a7m_verbs
},
6168 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
6169 .dac_nids
= alc882_dac_nids
,
6170 .dig_out_nid
= ALC882_DIGOUT_NID
,
6171 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
6172 .channel_mode
= alc880_threestack_modes
,
6174 .input_mux
= &alc882_capture_source
,
6183 PINFIX_ABIT_AW9D_MAX
6186 static struct alc_pincfg alc882_abit_aw9d_pinfix
[] = {
6187 { 0x15, 0x01080104 }, /* side */
6188 { 0x16, 0x01011012 }, /* rear */
6189 { 0x17, 0x01016011 }, /* clfe */
6193 static const struct alc_pincfg
*alc882_pin_fixes
[] = {
6194 [PINFIX_ABIT_AW9D_MAX
] = alc882_abit_aw9d_pinfix
,
6197 static struct snd_pci_quirk alc882_pinfix_tbl
[] = {
6198 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX
),
6203 * BIOS auto configuration
6205 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
6206 hda_nid_t nid
, int pin_type
,
6210 struct alc_spec
*spec
= codec
->spec
;
6213 alc_set_pin_output(codec
, nid
, pin_type
);
6214 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
6217 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
6218 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
6222 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
6224 struct alc_spec
*spec
= codec
->spec
;
6227 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
6228 for (i
= 0; i
<= HDA_SIDE
; i
++) {
6229 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
6230 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
6232 alc882_auto_set_output_and_unmute(codec
, nid
, pin_type
,
6237 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
6239 struct alc_spec
*spec
= codec
->spec
;
6242 pin
= spec
->autocfg
.hp_pins
[0];
6243 if (pin
) /* connect to front */
6245 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
6246 pin
= spec
->autocfg
.speaker_pins
[0];
6248 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
6251 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
6252 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
6254 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
6256 struct alc_spec
*spec
= codec
->spec
;
6259 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
6260 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
6261 if (alc882_is_input_pin(nid
)) {
6262 snd_hda_codec_write(codec
, nid
, 0,
6263 AC_VERB_SET_PIN_WIDGET_CONTROL
,
6264 i
<= AUTO_PIN_FRONT_MIC
?
6265 PIN_VREF80
: PIN_IN
);
6266 if (nid
!= ALC882_PIN_CD_NID
)
6267 snd_hda_codec_write(codec
, nid
, 0,
6268 AC_VERB_SET_AMP_GAIN_MUTE
,
6274 /* add mic boosts if needed */
6275 static int alc_auto_add_mic_boost(struct hda_codec
*codec
)
6277 struct alc_spec
*spec
= codec
->spec
;
6281 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_MIC
];
6282 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
6283 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6285 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6289 nid
= spec
->autocfg
.input_pins
[AUTO_PIN_FRONT_MIC
];
6290 if (nid
&& (get_wcaps(codec
, nid
) & AC_WCAP_IN_AMP
)) {
6291 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
6293 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
6300 /* almost identical with ALC880 parser... */
6301 static int alc882_parse_auto_config(struct hda_codec
*codec
)
6303 struct alc_spec
*spec
= codec
->spec
;
6304 int err
= alc880_parse_auto_config(codec
);
6309 return 0; /* no config found */
6311 err
= alc_auto_add_mic_boost(codec
);
6315 /* hack - override the init verbs */
6316 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
6318 return 1; /* config found */
6321 /* additional initialization for auto-configuration model */
6322 static void alc882_auto_init(struct hda_codec
*codec
)
6324 struct alc_spec
*spec
= codec
->spec
;
6325 alc882_auto_init_multi_out(codec
);
6326 alc882_auto_init_hp_out(codec
);
6327 alc882_auto_init_analog_input(codec
);
6328 if (spec
->unsol_event
)
6329 alc_sku_automute(codec
);
6332 static int patch_alc882(struct hda_codec
*codec
)
6334 struct alc_spec
*spec
;
6335 int err
, board_config
;
6337 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
6343 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
6347 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
6348 /* Pick up systems that don't supply PCI SSID */
6349 switch (codec
->subsystem_id
) {
6350 case 0x106b0c00: /* Mac Pro */
6351 board_config
= ALC885_MACPRO
;
6353 case 0x106b1000: /* iMac 24 */
6354 board_config
= ALC885_IMAC24
;
6356 case 0x106b00a1: /* Macbook */
6357 case 0x106b2c00: /* Macbook Pro rev3 */
6358 board_config
= ALC885_MBP3
;
6361 printk(KERN_INFO
"hda_codec: Unknown model for ALC882, "
6362 "trying auto-probe from BIOS...\n");
6363 board_config
= ALC882_AUTO
;
6367 alc_fix_pincfg(codec
, alc882_pinfix_tbl
, alc882_pin_fixes
);
6369 if (board_config
== ALC882_AUTO
) {
6370 /* automatic parse from the BIOS config */
6371 err
= alc882_parse_auto_config(codec
);
6377 "hda_codec: Cannot set up configuration "
6378 "from BIOS. Using base mode...\n");
6379 board_config
= ALC882_3ST_DIG
;
6383 if (board_config
!= ALC882_AUTO
)
6384 setup_preset(spec
, &alc882_presets
[board_config
]);
6386 spec
->stream_name_analog
= "ALC882 Analog";
6387 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
6388 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
6389 /* FIXME: setup DAC5 */
6390 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
6391 spec
->stream_analog_alt_capture
= &alc880_pcm_analog_alt_capture
;
6393 spec
->stream_name_digital
= "ALC882 Digital";
6394 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
6395 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
6397 if (!spec
->adc_nids
&& spec
->input_mux
) {
6398 /* check whether NID 0x07 is valid */
6399 unsigned int wcap
= get_wcaps(codec
, 0x07);
6401 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
6402 if (wcap
!= AC_WID_AUD_IN
) {
6403 spec
->adc_nids
= alc882_adc_nids_alt
;
6404 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
6405 spec
->capsrc_nids
= alc882_capsrc_nids_alt
;
6406 spec
->mixers
[spec
->num_mixers
] =
6407 alc882_capture_alt_mixer
;
6410 spec
->adc_nids
= alc882_adc_nids
;
6411 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
6412 spec
->capsrc_nids
= alc882_capsrc_nids
;
6413 spec
->mixers
[spec
->num_mixers
] = alc882_capture_mixer
;
6418 spec
->vmaster_nid
= 0x0c;
6420 codec
->patch_ops
= alc_patch_ops
;
6421 if (board_config
== ALC882_AUTO
)
6422 spec
->init_hook
= alc882_auto_init
;
6423 #ifdef CONFIG_SND_HDA_POWER_SAVE
6424 if (!spec
->loopback
.amplist
)
6425 spec
->loopback
.amplist
= alc882_loopbacks
;
6434 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
6435 * configuration. Each pin widget can choose any input DACs and a mixer.
6436 * Each ADC is connected from a mixer of all inputs. This makes possible
6437 * 6-channel independent captures.
6439 * In addition, an independent DAC for the multi-playback (not used in this
6442 #define ALC883_DIGOUT_NID 0x06
6443 #define ALC883_DIGIN_NID 0x0a
6445 static hda_nid_t alc883_dac_nids
[4] = {
6446 /* front, rear, clfe, rear_surr */
6447 0x02, 0x04, 0x03, 0x05
6450 static hda_nid_t alc883_adc_nids
[2] = {
6455 static hda_nid_t alc883_capsrc_nids
[2] = { 0x23, 0x22 };
6458 /* FIXME: should be a matrix-type input source selection */
6460 static struct hda_input_mux alc883_capture_source
= {
6464 { "Front Mic", 0x1 },
6470 static struct hda_input_mux alc883_lenovo_101e_capture_source
= {
6478 static struct hda_input_mux alc883_lenovo_nb0763_capture_source
= {
6488 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source
= {
6496 #define alc883_mux_enum_info alc_mux_enum_info
6497 #define alc883_mux_enum_get alc_mux_enum_get
6498 /* ALC883 has the ALC882-type input selection */
6499 #define alc883_mux_enum_put alc882_mux_enum_put
6504 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
6511 static struct hda_verb alc883_3ST_ch2_init
[] = {
6512 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6513 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6514 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
6515 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6522 static struct hda_verb alc883_3ST_ch4_init
[] = {
6523 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
6524 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6525 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6526 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6527 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6534 static struct hda_verb alc883_3ST_ch6_init
[] = {
6535 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6536 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6537 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
6538 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6539 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6540 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6544 static struct hda_channel_mode alc883_3ST_6ch_modes
[3] = {
6545 { 2, alc883_3ST_ch2_init
},
6546 { 4, alc883_3ST_ch4_init
},
6547 { 6, alc883_3ST_ch6_init
},
6553 static struct hda_verb alc883_sixstack_ch6_init
[] = {
6554 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6555 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6556 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6557 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6564 static struct hda_verb alc883_sixstack_ch8_init
[] = {
6565 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6566 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6567 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6568 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6572 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
6573 { 6, alc883_sixstack_ch6_init
},
6574 { 8, alc883_sixstack_ch8_init
},
6577 static struct hda_verb alc883_medion_eapd_verbs
[] = {
6578 /* eanable EAPD on medion laptop */
6579 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
6580 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
6584 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6585 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6588 static struct snd_kcontrol_new alc883_base_mixer
[] = {
6589 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6590 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6591 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6592 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6593 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6594 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6595 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6596 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6597 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
6598 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
6599 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6600 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6601 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6602 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6603 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6604 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6605 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6606 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6607 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6608 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6609 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6610 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6611 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6612 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6613 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6614 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6615 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6617 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6618 /* .name = "Capture Source", */
6619 .name
= "Input Source",
6621 .info
= alc883_mux_enum_info
,
6622 .get
= alc883_mux_enum_get
,
6623 .put
= alc883_mux_enum_put
,
6628 static struct snd_kcontrol_new alc883_mitac_mixer
[] = {
6629 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6630 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6631 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6632 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6633 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6634 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6635 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6636 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6637 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6639 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6640 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6641 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6642 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6643 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6644 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6645 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6647 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6648 /* .name = "Capture Source", */
6649 .name
= "Input Source",
6651 .info
= alc883_mux_enum_info
,
6652 .get
= alc883_mux_enum_get
,
6653 .put
= alc883_mux_enum_put
,
6658 static struct snd_kcontrol_new alc883_clevo_m720r_mixer
[] = {
6659 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6660 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
6661 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6662 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
6663 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6664 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6665 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6666 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6667 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
6668 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6669 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6670 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6671 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6672 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6674 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6675 /* .name = "Capture Source", */
6676 .name
= "Input Source",
6678 .info
= alc883_mux_enum_info
,
6679 .get
= alc883_mux_enum_get
,
6680 .put
= alc883_mux_enum_put
,
6685 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer
[] = {
6686 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6687 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
6688 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6689 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
6690 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6691 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6693 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6694 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
6695 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6696 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6697 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6698 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6699 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6701 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6702 /* .name = "Capture Source", */
6703 .name
= "Input Source",
6705 .info
= alc883_mux_enum_info
,
6706 .get
= alc883_mux_enum_get
,
6707 .put
= alc883_mux_enum_put
,
6712 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
6713 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6714 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6715 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6716 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6717 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6718 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6719 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6720 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6721 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6722 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6723 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6724 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6725 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6726 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6727 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6728 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6729 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6730 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6731 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6733 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6734 /* .name = "Capture Source", */
6735 .name
= "Input Source",
6737 .info
= alc883_mux_enum_info
,
6738 .get
= alc883_mux_enum_get
,
6739 .put
= alc883_mux_enum_put
,
6744 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
6745 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6746 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6747 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6748 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6749 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6750 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6751 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6752 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6753 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6754 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6755 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6756 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6757 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6758 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6759 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6760 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6761 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6762 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6763 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6764 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6765 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6766 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6767 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6768 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6769 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6771 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6772 /* .name = "Capture Source", */
6773 .name
= "Input Source",
6775 .info
= alc883_mux_enum_info
,
6776 .get
= alc883_mux_enum_get
,
6777 .put
= alc883_mux_enum_put
,
6782 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
6783 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6784 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6785 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6786 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6787 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6788 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6789 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT
),
6790 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
6791 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6792 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6793 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6794 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6795 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6796 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6797 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6799 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6800 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6801 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6802 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6803 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6804 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6805 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6808 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6809 /* .name = "Capture Source", */
6810 .name
= "Input Source",
6812 .info
= alc883_mux_enum_info
,
6813 .get
= alc883_mux_enum_get
,
6814 .put
= alc883_mux_enum_put
,
6819 static struct snd_kcontrol_new alc883_tagra_mixer
[] = {
6820 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6821 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6822 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6823 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6824 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
6825 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
6826 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
6827 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
6828 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
6829 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6830 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6831 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6832 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6833 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6834 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6835 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6836 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6837 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6838 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6839 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6841 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6842 /* .name = "Capture Source", */
6843 .name
= "Input Source",
6845 .info
= alc883_mux_enum_info
,
6846 .get
= alc883_mux_enum_get
,
6847 .put
= alc883_mux_enum_put
,
6852 static struct snd_kcontrol_new alc883_tagra_2ch_mixer
[] = {
6853 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6854 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6855 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6856 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6857 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6858 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6859 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6861 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6862 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6863 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6864 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6866 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6867 /* .name = "Capture Source", */
6868 .name
= "Input Source",
6870 .info
= alc883_mux_enum_info
,
6871 .get
= alc883_mux_enum_get
,
6872 .put
= alc883_mux_enum_put
,
6877 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer
[] = {
6878 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6879 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6880 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
6881 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
6882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6883 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6884 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6885 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6886 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6887 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6889 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6890 /* .name = "Capture Source", */
6891 .name
= "Input Source",
6893 .info
= alc883_mux_enum_info
,
6894 .get
= alc883_mux_enum_get
,
6895 .put
= alc883_mux_enum_put
,
6900 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer
[] = {
6901 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6902 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT
),
6903 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6904 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6905 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6906 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6907 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6908 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6909 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6910 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6911 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6912 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6913 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6915 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6916 /* .name = "Capture Source", */
6917 .name
= "Input Source",
6919 .info
= alc883_mux_enum_info
,
6920 .get
= alc883_mux_enum_get
,
6921 .put
= alc883_mux_enum_put
,
6926 static struct snd_kcontrol_new alc883_medion_md2_mixer
[] = {
6927 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6928 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
6929 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6930 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6931 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6932 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6933 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6934 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6935 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6936 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6937 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6938 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6939 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6941 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6942 /* .name = "Capture Source", */
6943 .name
= "Input Source",
6945 .info
= alc883_mux_enum_info
,
6946 .get
= alc883_mux_enum_get
,
6947 .put
= alc883_mux_enum_put
,
6952 static struct snd_kcontrol_new alc888_6st_hp_mixer
[] = {
6953 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6954 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6955 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
6956 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
6957 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
6958 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
6959 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
6960 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
6961 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
6962 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
6963 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
6964 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6965 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6966 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
6967 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
6968 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6969 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6970 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6971 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
6972 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
6973 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
6974 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
6975 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
6976 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6977 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6978 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
6979 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
6981 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6982 /* .name = "Capture Source", */
6983 .name
= "Input Source",
6985 .info
= alc883_mux_enum_info
,
6986 .get
= alc883_mux_enum_get
,
6987 .put
= alc883_mux_enum_put
,
6992 static struct snd_kcontrol_new alc888_3st_hp_mixer
[] = {
6993 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
6994 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
6995 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
6996 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
6997 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
6998 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
6999 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
7000 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
7001 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7002 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7003 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7004 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7005 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7006 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7007 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7008 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7009 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7010 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7011 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7012 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7013 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7014 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7015 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7016 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7017 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7019 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7020 /* .name = "Capture Source", */
7021 .name
= "Input Source",
7023 .info
= alc883_mux_enum_info
,
7024 .get
= alc883_mux_enum_get
,
7025 .put
= alc883_mux_enum_put
,
7030 static struct snd_kcontrol_new alc888_6st_dell_mixer
[] = {
7031 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7032 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7033 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
7034 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT
),
7035 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
7036 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
7037 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
7038 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
7039 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
7040 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
7041 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
7042 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
7043 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
7044 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7045 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7046 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7047 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7048 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7049 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
7050 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
7051 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
7052 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
7053 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
7054 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7055 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7056 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7057 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7059 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7060 /* .name = "Capture Source", */
7061 .name
= "Input Source",
7063 .info
= alc883_mux_enum_info
,
7064 .get
= alc883_mux_enum_get
,
7065 .put
= alc883_mux_enum_put
,
7070 static struct snd_kcontrol_new alc883_acer_aspire_mixer
[] = {
7071 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
7072 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
7073 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
7074 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
7075 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
7076 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
7077 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
7078 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
7079 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7080 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7081 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7082 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7084 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7085 /* .name = "Capture Source", */
7086 .name
= "Input Source",
7088 .info
= alc883_mux_enum_info
,
7089 .get
= alc883_mux_enum_get
,
7090 .put
= alc883_mux_enum_put
,
7095 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
7097 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7098 .name
= "Channel Mode",
7099 .info
= alc_ch_mode_info
,
7100 .get
= alc_ch_mode_get
,
7101 .put
= alc_ch_mode_put
,
7106 static struct hda_verb alc883_init_verbs
[] = {
7107 /* ADC1: mute amp left and right */
7108 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7109 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7110 /* ADC2: mute amp left and right */
7111 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7112 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7113 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7114 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7115 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7118 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7119 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7120 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7122 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7123 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7124 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7126 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7127 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7128 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7130 /* mute analog input loopbacks */
7131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7137 /* Front Pin: output 0 (0x0c) */
7138 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7139 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7140 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7141 /* Rear Pin: output 1 (0x0d) */
7142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7143 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7144 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7145 /* CLFE Pin: output 2 (0x0e) */
7146 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7147 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7148 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
7149 /* Side Pin: output 3 (0x0f) */
7150 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7151 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7152 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
7153 /* Mic (rear) pin: input vref at 80% */
7154 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7155 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7156 /* Front Mic pin: input vref at 80% */
7157 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7158 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7159 /* Line In pin: input */
7160 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7161 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7162 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7163 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7164 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7165 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7166 /* CD pin widget for input */
7167 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7169 /* FIXME: use matrix-type input source selection */
7170 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7172 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7173 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7175 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7179 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7180 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7184 /* toggle speaker-output according to the hp-jack state */
7185 static void alc883_mitac_hp_automute(struct hda_codec
*codec
)
7187 unsigned int present
;
7189 present
= snd_hda_codec_read(codec
, 0x15, 0,
7190 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7191 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7192 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7193 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
7194 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7197 /* auto-toggle front mic */
7199 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7201 unsigned int present;
7204 present = snd_hda_codec_read(codec, 0x18, 0,
7205 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7206 bits = present ? HDA_AMP_MUTE : 0;
7207 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7211 static void alc883_mitac_automute(struct hda_codec
*codec
)
7213 alc883_mitac_hp_automute(codec
);
7214 /* alc883_mitac_mic_automute(codec); */
7217 static void alc883_mitac_unsol_event(struct hda_codec
*codec
,
7220 switch (res
>> 26) {
7221 case ALC880_HP_EVENT
:
7222 alc883_mitac_hp_automute(codec
);
7224 case ALC880_MIC_EVENT
:
7225 /* alc883_mitac_mic_automute(codec); */
7230 static struct hda_verb alc883_mitac_verbs
[] = {
7232 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7233 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7235 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x02},
7236 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7238 /* enable unsolicited event */
7239 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7240 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7245 static struct hda_verb alc883_clevo_m720r_verbs
[] = {
7247 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7248 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7250 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x01},
7251 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7253 /* enable unsolicited event */
7254 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7259 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs
[] = {
7261 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7262 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7264 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
7265 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7267 /* enable unsolicited event */
7268 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7273 static struct hda_verb alc883_tagra_verbs
[] = {
7274 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7275 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7277 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7278 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7280 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
7281 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
7282 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
7284 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7285 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
7286 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
7287 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
7292 static struct hda_verb alc883_lenovo_101e_verbs
[] = {
7293 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7294 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
|AC_USRSP_EN
},
7295 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
|AC_USRSP_EN
},
7299 static struct hda_verb alc883_lenovo_nb0763_verbs
[] = {
7300 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7301 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7302 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7307 static struct hda_verb alc888_lenovo_ms7195_verbs
[] = {
7308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7310 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7311 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_FRONT_EVENT
| AC_USRSP_EN
},
7312 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7316 static struct hda_verb alc883_haier_w66_verbs
[] = {
7317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7318 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7320 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7322 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
7323 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7324 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7325 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7329 static struct hda_verb alc888_6st_hp_verbs
[] = {
7330 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
7331 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* Rear : output 2 (0x0e) */
7332 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* CLFE : output 1 (0x0d) */
7333 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* Side : output 3 (0x0f) */
7337 static struct hda_verb alc888_3st_hp_verbs
[] = {
7338 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
7339 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* Rear : output 1 (0x0d) */
7340 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* CLFE : output 2 (0x0e) */
7344 static struct hda_verb alc888_6st_dell_verbs
[] = {
7345 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* Front: output 0 (0x0c) */
7346 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* Rear : output 1 (0x0e) */
7347 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* CLFE : output 2 (0x0d) */
7348 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* Side : output 3 (0x0f) */
7349 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7353 static struct hda_verb alc888_3st_hp_2ch_init
[] = {
7354 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
7355 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7356 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
7357 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7361 static struct hda_verb alc888_3st_hp_6ch_init
[] = {
7362 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7363 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7364 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7365 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7369 static struct hda_channel_mode alc888_3st_hp_modes
[2] = {
7370 { 2, alc888_3st_hp_2ch_init
},
7371 { 6, alc888_3st_hp_6ch_init
},
7374 /* toggle front-jack and RCA according to the hp-jack state */
7375 static void alc888_lenovo_ms7195_front_automute(struct hda_codec
*codec
)
7377 unsigned int present
;
7379 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7380 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7381 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7382 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7383 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7384 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7387 /* toggle RCA according to the front-jack state */
7388 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec
*codec
)
7390 unsigned int present
;
7392 present
= snd_hda_codec_read(codec
, 0x14, 0,
7393 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7394 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7395 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7398 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec
*codec
,
7401 if ((res
>> 26) == ALC880_HP_EVENT
)
7402 alc888_lenovo_ms7195_front_automute(codec
);
7403 if ((res
>> 26) == ALC880_FRONT_EVENT
)
7404 alc888_lenovo_ms7195_rca_automute(codec
);
7407 static struct hda_verb alc883_medion_md2_verbs
[] = {
7408 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7409 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7413 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7417 /* toggle speaker-output according to the hp-jack state */
7418 static void alc883_medion_md2_automute(struct hda_codec
*codec
)
7420 unsigned int present
;
7422 present
= snd_hda_codec_read(codec
, 0x14, 0,
7423 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7424 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7425 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7428 static void alc883_medion_md2_unsol_event(struct hda_codec
*codec
,
7431 if ((res
>> 26) == ALC880_HP_EVENT
)
7432 alc883_medion_md2_automute(codec
);
7435 /* toggle speaker-output according to the hp-jack state */
7436 static void alc883_tagra_automute(struct hda_codec
*codec
)
7438 unsigned int present
;
7441 present
= snd_hda_codec_read(codec
, 0x14, 0,
7442 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7443 bits
= present
? HDA_AMP_MUTE
: 0;
7444 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
7445 HDA_AMP_MUTE
, bits
);
7446 snd_hda_codec_write_cache(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
,
7450 static void alc883_tagra_unsol_event(struct hda_codec
*codec
, unsigned int res
)
7452 if ((res
>> 26) == ALC880_HP_EVENT
)
7453 alc883_tagra_automute(codec
);
7456 /* toggle speaker-output according to the hp-jack state */
7457 static void alc883_clevo_m720r_automute(struct hda_codec
*codec
)
7459 unsigned int present
;
7462 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0)
7463 & AC_PINSENSE_PRESENCE
;
7464 bits
= present
? HDA_AMP_MUTE
: 0;
7465 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7466 HDA_AMP_MUTE
, bits
);
7469 static void alc883_clevo_m720r_unsol_event(struct hda_codec
*codec
,
7472 if ((res
>> 26) == ALC880_HP_EVENT
)
7473 alc883_clevo_m720r_automute(codec
);
7476 /* toggle speaker-output according to the hp-jack state */
7477 static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec
*codec
)
7479 unsigned int present
;
7482 present
= snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_GET_PIN_SENSE
, 0)
7483 & AC_PINSENSE_PRESENCE
;
7484 bits
= present
? HDA_AMP_MUTE
: 0;
7485 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7486 HDA_AMP_MUTE
, bits
);
7489 static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec
*codec
,
7492 if ((res
>> 26) == ALC880_HP_EVENT
)
7493 alc883_2ch_fujitsu_pi2515_automute(codec
);
7496 static void alc883_haier_w66_automute(struct hda_codec
*codec
)
7498 unsigned int present
;
7501 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7502 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7503 bits
= present
? 0x80 : 0;
7504 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7508 static void alc883_haier_w66_unsol_event(struct hda_codec
*codec
,
7511 if ((res
>> 26) == ALC880_HP_EVENT
)
7512 alc883_haier_w66_automute(codec
);
7515 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
7517 unsigned int present
;
7520 present
= snd_hda_codec_read(codec
, 0x14, 0,
7521 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7522 bits
= present
? HDA_AMP_MUTE
: 0;
7523 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7524 HDA_AMP_MUTE
, bits
);
7527 static void alc883_lenovo_101e_all_automute(struct hda_codec
*codec
)
7529 unsigned int present
;
7532 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7533 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7534 bits
= present
? HDA_AMP_MUTE
: 0;
7535 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7536 HDA_AMP_MUTE
, bits
);
7537 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7538 HDA_AMP_MUTE
, bits
);
7541 static void alc883_lenovo_101e_unsol_event(struct hda_codec
*codec
,
7544 if ((res
>> 26) == ALC880_HP_EVENT
)
7545 alc883_lenovo_101e_all_automute(codec
);
7546 if ((res
>> 26) == ALC880_FRONT_EVENT
)
7547 alc883_lenovo_101e_ispeaker_automute(codec
);
7550 /* toggle speaker-output according to the hp-jack state */
7551 static void alc883_acer_aspire_automute(struct hda_codec
*codec
)
7553 unsigned int present
;
7555 present
= snd_hda_codec_read(codec
, 0x14, 0,
7556 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7557 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7558 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7559 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
7560 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7563 static void alc883_acer_aspire_unsol_event(struct hda_codec
*codec
,
7566 if ((res
>> 26) == ALC880_HP_EVENT
)
7567 alc883_acer_aspire_automute(codec
);
7570 static struct hda_verb alc883_acer_eapd_verbs
[] = {
7571 /* HP Pin: output 0 (0x0c) */
7572 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
7573 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7574 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
7575 /* Front Pin: output 0 (0x0c) */
7576 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7577 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
7578 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
7579 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x00},
7580 /* eanable EAPD on medion laptop */
7581 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
7582 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
7583 /* enable unsolicited event */
7584 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
7588 static void alc888_6st_dell_front_automute(struct hda_codec
*codec
)
7590 unsigned int present
;
7592 present
= snd_hda_codec_read(codec
, 0x1b, 0,
7593 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7594 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
7595 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7596 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
7597 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7598 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_OUTPUT
, 0,
7599 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7600 snd_hda_codec_amp_stereo(codec
, 0x17, HDA_OUTPUT
, 0,
7601 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
7604 static void alc888_6st_dell_unsol_event(struct hda_codec
*codec
,
7607 switch (res
>> 26) {
7608 case ALC880_HP_EVENT
:
7609 printk("hp_event\n");
7610 alc888_6st_dell_front_automute(codec
);
7616 * generic initialization of ADC, input mixers and output mixers
7618 static struct hda_verb alc883_auto_init_verbs
[] = {
7620 * Unmute ADC0-2 and set the default input to mic-in
7622 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7623 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7624 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
7625 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7627 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7629 * Note: PASD motherboards uses the Line In 2 as the input for
7630 * front panel mic (mic 2)
7632 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7633 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7634 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7635 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
7636 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
7637 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
7640 * Set up output mixers (0x0c - 0x0f)
7642 /* set vol=0 to output mixers */
7643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7644 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7646 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
7647 /* set up input amps for analog loopback */
7648 /* Amp Indices: DAC = 0, mixer = 1 */
7649 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7650 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7651 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7652 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7653 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7654 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7655 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7656 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7657 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7658 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7660 /* FIXME: use matrix-type input source selection */
7661 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7664 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7666 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7667 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7669 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7671 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7672 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
7673 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
7678 /* capture mixer elements */
7679 static struct snd_kcontrol_new alc883_capture_mixer
[] = {
7680 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7681 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7682 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
7683 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
7685 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7686 /* The multiple "Capture Source" controls confuse alsamixer
7687 * So call somewhat different..
7689 /* .name = "Capture Source", */
7690 .name
= "Input Source",
7692 .info
= alc882_mux_enum_info
,
7693 .get
= alc882_mux_enum_get
,
7694 .put
= alc882_mux_enum_put
,
7699 #ifdef CONFIG_SND_HDA_POWER_SAVE
7700 #define alc883_loopbacks alc880_loopbacks
7703 /* pcm configuration: identiacal with ALC880 */
7704 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
7705 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
7706 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
7707 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
7708 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
7711 * configuration and preset
7713 static const char *alc883_models
[ALC883_MODEL_LAST
] = {
7714 [ALC883_3ST_2ch_DIG
] = "3stack-dig",
7715 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
7716 [ALC883_3ST_6ch
] = "3stack-6ch",
7717 [ALC883_6ST_DIG
] = "6stack-dig",
7718 [ALC883_TARGA_DIG
] = "targa-dig",
7719 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
7720 [ALC883_ACER
] = "acer",
7721 [ALC883_ACER_ASPIRE
] = "acer-aspire",
7722 [ALC883_MEDION
] = "medion",
7723 [ALC883_MEDION_MD2
] = "medion-md2",
7724 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
7725 [ALC883_LENOVO_101E_2ch
] = "lenovo-101e",
7726 [ALC883_LENOVO_NB0763
] = "lenovo-nb0763",
7727 [ALC888_LENOVO_MS7195_DIG
] = "lenovo-ms7195-dig",
7728 [ALC883_HAIER_W66
] = "haier-w66",
7729 [ALC888_6ST_HP
] = "6stack-hp",
7730 [ALC888_3ST_HP
] = "3stack-hp",
7731 [ALC888_6ST_DELL
] = "6stack-dell",
7732 [ALC883_MITAC
] = "mitac",
7733 [ALC883_CLEVO_M720R
] = "clevo-m720r",
7734 [ALC883_FUJITSU_PI2515
] = "fujitsu-pi2515",
7735 [ALC883_AUTO
] = "auto",
7738 static struct snd_pci_quirk alc883_cfg_tbl
[] = {
7739 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG
),
7740 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE
),
7741 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE
),
7742 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE
),
7743 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER
), /* default Acer */
7744 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL
),
7745 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG
),
7746 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP
),
7747 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP
),
7748 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP
),
7749 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG
),
7750 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG
),
7751 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC
),
7752 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
7753 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
7754 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG
),
7755 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG
),
7756 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG
),
7757 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
7758 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG
),
7759 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG
),
7760 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
7761 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
7762 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
7763 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
7764 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
7765 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG
),
7766 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
7767 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
7768 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
7769 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
7770 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
7771 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG
),
7772 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG
),
7773 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG
),
7774 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
7775 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG
),
7776 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720R
),
7777 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD
),
7778 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch
),
7779 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
7780 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515
),
7781 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch
),
7782 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7783 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7784 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763
),
7785 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2
),
7786 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG
),
7787 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66
),
7788 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch
),
7792 static struct alc_config_preset alc883_presets
[] = {
7793 [ALC883_3ST_2ch_DIG
] = {
7794 .mixers
= { alc883_3ST_2ch_mixer
},
7795 .init_verbs
= { alc883_init_verbs
},
7796 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7797 .dac_nids
= alc883_dac_nids
,
7798 .dig_out_nid
= ALC883_DIGOUT_NID
,
7799 .dig_in_nid
= ALC883_DIGIN_NID
,
7800 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7801 .channel_mode
= alc883_3ST_2ch_modes
,
7802 .input_mux
= &alc883_capture_source
,
7804 [ALC883_3ST_6ch_DIG
] = {
7805 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
7806 .init_verbs
= { alc883_init_verbs
},
7807 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7808 .dac_nids
= alc883_dac_nids
,
7809 .dig_out_nid
= ALC883_DIGOUT_NID
,
7810 .dig_in_nid
= ALC883_DIGIN_NID
,
7811 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7812 .channel_mode
= alc883_3ST_6ch_modes
,
7814 .input_mux
= &alc883_capture_source
,
7816 [ALC883_3ST_6ch
] = {
7817 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
7818 .init_verbs
= { alc883_init_verbs
},
7819 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7820 .dac_nids
= alc883_dac_nids
,
7821 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7822 .channel_mode
= alc883_3ST_6ch_modes
,
7824 .input_mux
= &alc883_capture_source
,
7826 [ALC883_6ST_DIG
] = {
7827 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
7828 .init_verbs
= { alc883_init_verbs
},
7829 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7830 .dac_nids
= alc883_dac_nids
,
7831 .dig_out_nid
= ALC883_DIGOUT_NID
,
7832 .dig_in_nid
= ALC883_DIGIN_NID
,
7833 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
7834 .channel_mode
= alc883_sixstack_modes
,
7835 .input_mux
= &alc883_capture_source
,
7837 [ALC883_TARGA_DIG
] = {
7838 .mixers
= { alc883_tagra_mixer
, alc883_chmode_mixer
},
7839 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
7840 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7841 .dac_nids
= alc883_dac_nids
,
7842 .dig_out_nid
= ALC883_DIGOUT_NID
,
7843 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7844 .channel_mode
= alc883_3ST_6ch_modes
,
7846 .input_mux
= &alc883_capture_source
,
7847 .unsol_event
= alc883_tagra_unsol_event
,
7848 .init_hook
= alc883_tagra_automute
,
7850 [ALC883_TARGA_2ch_DIG
] = {
7851 .mixers
= { alc883_tagra_2ch_mixer
},
7852 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
7853 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7854 .dac_nids
= alc883_dac_nids
,
7855 .dig_out_nid
= ALC883_DIGOUT_NID
,
7856 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7857 .channel_mode
= alc883_3ST_2ch_modes
,
7858 .input_mux
= &alc883_capture_source
,
7859 .unsol_event
= alc883_tagra_unsol_event
,
7860 .init_hook
= alc883_tagra_automute
,
7863 .mixers
= { alc883_base_mixer
},
7864 /* On TravelMate laptops, GPIO 0 enables the internal speaker
7865 * and the headphone jack. Turn this on and rely on the
7866 * standard mute methods whenever the user wants to turn
7867 * these outputs off.
7869 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
7870 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7871 .dac_nids
= alc883_dac_nids
,
7872 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7873 .channel_mode
= alc883_3ST_2ch_modes
,
7874 .input_mux
= &alc883_capture_source
,
7876 [ALC883_ACER_ASPIRE
] = {
7877 .mixers
= { alc883_acer_aspire_mixer
},
7878 .init_verbs
= { alc883_init_verbs
, alc883_acer_eapd_verbs
},
7879 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7880 .dac_nids
= alc883_dac_nids
,
7881 .dig_out_nid
= ALC883_DIGOUT_NID
,
7882 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7883 .channel_mode
= alc883_3ST_2ch_modes
,
7884 .input_mux
= &alc883_capture_source
,
7885 .unsol_event
= alc883_acer_aspire_unsol_event
,
7886 .init_hook
= alc883_acer_aspire_automute
,
7889 .mixers
= { alc883_fivestack_mixer
,
7890 alc883_chmode_mixer
},
7891 .init_verbs
= { alc883_init_verbs
,
7892 alc883_medion_eapd_verbs
},
7893 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7894 .dac_nids
= alc883_dac_nids
,
7895 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
7896 .channel_mode
= alc883_sixstack_modes
,
7897 .input_mux
= &alc883_capture_source
,
7899 [ALC883_MEDION_MD2
] = {
7900 .mixers
= { alc883_medion_md2_mixer
},
7901 .init_verbs
= { alc883_init_verbs
, alc883_medion_md2_verbs
},
7902 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7903 .dac_nids
= alc883_dac_nids
,
7904 .dig_out_nid
= ALC883_DIGOUT_NID
,
7905 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7906 .channel_mode
= alc883_3ST_2ch_modes
,
7907 .input_mux
= &alc883_capture_source
,
7908 .unsol_event
= alc883_medion_md2_unsol_event
,
7909 .init_hook
= alc883_medion_md2_automute
,
7911 [ALC883_LAPTOP_EAPD
] = {
7912 .mixers
= { alc883_base_mixer
},
7913 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
7914 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7915 .dac_nids
= alc883_dac_nids
,
7916 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7917 .channel_mode
= alc883_3ST_2ch_modes
,
7918 .input_mux
= &alc883_capture_source
,
7920 [ALC883_CLEVO_M720R
] = {
7921 .mixers
= { alc883_clevo_m720r_mixer
},
7922 .init_verbs
= { alc883_init_verbs
, alc883_clevo_m720r_verbs
},
7923 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7924 .dac_nids
= alc883_dac_nids
,
7925 .dig_out_nid
= ALC883_DIGOUT_NID
,
7926 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7927 .channel_mode
= alc883_3ST_2ch_modes
,
7928 .input_mux
= &alc883_capture_source
,
7929 .unsol_event
= alc883_clevo_m720r_unsol_event
,
7930 .init_hook
= alc883_clevo_m720r_automute
,
7932 [ALC883_LENOVO_101E_2ch
] = {
7933 .mixers
= { alc883_lenovo_101e_2ch_mixer
},
7934 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_101e_verbs
},
7935 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7936 .dac_nids
= alc883_dac_nids
,
7937 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7938 .channel_mode
= alc883_3ST_2ch_modes
,
7939 .input_mux
= &alc883_lenovo_101e_capture_source
,
7940 .unsol_event
= alc883_lenovo_101e_unsol_event
,
7941 .init_hook
= alc883_lenovo_101e_all_automute
,
7943 [ALC883_LENOVO_NB0763
] = {
7944 .mixers
= { alc883_lenovo_nb0763_mixer
},
7945 .init_verbs
= { alc883_init_verbs
, alc883_lenovo_nb0763_verbs
},
7946 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7947 .dac_nids
= alc883_dac_nids
,
7948 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7949 .channel_mode
= alc883_3ST_2ch_modes
,
7951 .input_mux
= &alc883_lenovo_nb0763_capture_source
,
7952 .unsol_event
= alc883_medion_md2_unsol_event
,
7953 .init_hook
= alc883_medion_md2_automute
,
7955 [ALC888_LENOVO_MS7195_DIG
] = {
7956 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
7957 .init_verbs
= { alc883_init_verbs
, alc888_lenovo_ms7195_verbs
},
7958 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7959 .dac_nids
= alc883_dac_nids
,
7960 .dig_out_nid
= ALC883_DIGOUT_NID
,
7961 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
7962 .channel_mode
= alc883_3ST_6ch_modes
,
7964 .input_mux
= &alc883_capture_source
,
7965 .unsol_event
= alc883_lenovo_ms7195_unsol_event
,
7966 .init_hook
= alc888_lenovo_ms7195_front_automute
,
7968 [ALC883_HAIER_W66
] = {
7969 .mixers
= { alc883_tagra_2ch_mixer
},
7970 .init_verbs
= { alc883_init_verbs
, alc883_haier_w66_verbs
},
7971 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7972 .dac_nids
= alc883_dac_nids
,
7973 .dig_out_nid
= ALC883_DIGOUT_NID
,
7974 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7975 .channel_mode
= alc883_3ST_2ch_modes
,
7976 .input_mux
= &alc883_capture_source
,
7977 .unsol_event
= alc883_haier_w66_unsol_event
,
7978 .init_hook
= alc883_haier_w66_automute
,
7981 .mixers
= { alc888_6st_hp_mixer
, alc883_chmode_mixer
},
7982 .init_verbs
= { alc883_init_verbs
, alc888_6st_hp_verbs
},
7983 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7984 .dac_nids
= alc883_dac_nids
,
7985 .dig_out_nid
= ALC883_DIGOUT_NID
,
7986 .dig_in_nid
= ALC883_DIGIN_NID
,
7987 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
7988 .channel_mode
= alc883_sixstack_modes
,
7989 .input_mux
= &alc883_capture_source
,
7992 .mixers
= { alc888_3st_hp_mixer
, alc883_chmode_mixer
},
7993 .init_verbs
= { alc883_init_verbs
, alc888_3st_hp_verbs
},
7994 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
7995 .dac_nids
= alc883_dac_nids
,
7996 .num_channel_mode
= ARRAY_SIZE(alc888_3st_hp_modes
),
7997 .channel_mode
= alc888_3st_hp_modes
,
7999 .input_mux
= &alc883_capture_source
,
8001 [ALC888_6ST_DELL
] = {
8002 .mixers
= { alc888_6st_dell_mixer
, alc883_chmode_mixer
},
8003 .init_verbs
= { alc883_init_verbs
, alc888_6st_dell_verbs
},
8004 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8005 .dac_nids
= alc883_dac_nids
,
8006 .dig_out_nid
= ALC883_DIGOUT_NID
,
8007 .dig_in_nid
= ALC883_DIGIN_NID
,
8008 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
8009 .channel_mode
= alc883_sixstack_modes
,
8010 .input_mux
= &alc883_capture_source
,
8011 .unsol_event
= alc888_6st_dell_unsol_event
,
8012 .init_hook
= alc888_6st_dell_front_automute
,
8015 .mixers
= { alc883_mitac_mixer
},
8016 .init_verbs
= { alc883_init_verbs
, alc883_mitac_verbs
},
8017 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8018 .dac_nids
= alc883_dac_nids
,
8019 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8020 .channel_mode
= alc883_3ST_2ch_modes
,
8021 .input_mux
= &alc883_capture_source
,
8022 .unsol_event
= alc883_mitac_unsol_event
,
8023 .init_hook
= alc883_mitac_automute
,
8025 [ALC883_FUJITSU_PI2515
] = {
8026 .mixers
= { alc883_2ch_fujitsu_pi2515_mixer
},
8027 .init_verbs
= { alc883_init_verbs
,
8028 alc883_2ch_fujitsu_pi2515_verbs
},
8029 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
8030 .dac_nids
= alc883_dac_nids
,
8031 .dig_out_nid
= ALC883_DIGOUT_NID
,
8032 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
8033 .channel_mode
= alc883_3ST_2ch_modes
,
8034 .input_mux
= &alc883_fujitsu_pi2515_capture_source
,
8035 .unsol_event
= alc883_2ch_fujitsu_pi2515_unsol_event
,
8036 .init_hook
= alc883_2ch_fujitsu_pi2515_automute
,
8042 * BIOS auto configuration
8044 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
8045 hda_nid_t nid
, int pin_type
,
8049 struct alc_spec
*spec
= codec
->spec
;
8052 alc_set_pin_output(codec
, nid
, pin_type
);
8053 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
8056 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
8057 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
8061 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
8063 struct alc_spec
*spec
= codec
->spec
;
8066 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
8067 for (i
= 0; i
<= HDA_SIDE
; i
++) {
8068 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
8069 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
8071 alc883_auto_set_output_and_unmute(codec
, nid
, pin_type
,
8076 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
8078 struct alc_spec
*spec
= codec
->spec
;
8081 pin
= spec
->autocfg
.hp_pins
[0];
8082 if (pin
) /* connect to front */
8084 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
8085 pin
= spec
->autocfg
.speaker_pins
[0];
8087 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
8090 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
8091 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
8093 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
8095 struct alc_spec
*spec
= codec
->spec
;
8098 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
8099 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
8100 if (alc883_is_input_pin(nid
)) {
8101 snd_hda_codec_write(codec
, nid
, 0,
8102 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8103 (i
<= AUTO_PIN_FRONT_MIC
?
8104 PIN_VREF80
: PIN_IN
));
8105 if (nid
!= ALC883_PIN_CD_NID
)
8106 snd_hda_codec_write(codec
, nid
, 0,
8107 AC_VERB_SET_AMP_GAIN_MUTE
,
8113 /* almost identical with ALC880 parser... */
8114 static int alc883_parse_auto_config(struct hda_codec
*codec
)
8116 struct alc_spec
*spec
= codec
->spec
;
8117 int err
= alc880_parse_auto_config(codec
);
8122 return 0; /* no config found */
8124 err
= alc_auto_add_mic_boost(codec
);
8128 /* hack - override the init verbs */
8129 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
8130 spec
->mixers
[spec
->num_mixers
] = alc883_capture_mixer
;
8133 return 1; /* config found */
8136 /* additional initialization for auto-configuration model */
8137 static void alc883_auto_init(struct hda_codec
*codec
)
8139 struct alc_spec
*spec
= codec
->spec
;
8140 alc883_auto_init_multi_out(codec
);
8141 alc883_auto_init_hp_out(codec
);
8142 alc883_auto_init_analog_input(codec
);
8143 if (spec
->unsol_event
)
8144 alc_sku_automute(codec
);
8147 static int patch_alc883(struct hda_codec
*codec
)
8149 struct alc_spec
*spec
;
8150 int err
, board_config
;
8152 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
8158 board_config
= snd_hda_check_board_config(codec
, ALC883_MODEL_LAST
,
8161 if (board_config
< 0) {
8162 printk(KERN_INFO
"hda_codec: Unknown model for ALC883, "
8163 "trying auto-probe from BIOS...\n");
8164 board_config
= ALC883_AUTO
;
8167 if (board_config
== ALC883_AUTO
) {
8168 /* automatic parse from the BIOS config */
8169 err
= alc883_parse_auto_config(codec
);
8175 "hda_codec: Cannot set up configuration "
8176 "from BIOS. Using base mode...\n");
8177 board_config
= ALC883_3ST_2ch_DIG
;
8181 if (board_config
!= ALC883_AUTO
)
8182 setup_preset(spec
, &alc883_presets
[board_config
]);
8184 spec
->stream_name_analog
= "ALC883 Analog";
8185 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
8186 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
8187 spec
->stream_analog_alt_capture
= &alc883_pcm_analog_alt_capture
;
8189 spec
->stream_name_digital
= "ALC883 Digital";
8190 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
8191 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
8193 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
8194 spec
->adc_nids
= alc883_adc_nids
;
8195 spec
->capsrc_nids
= alc883_capsrc_nids
;
8197 spec
->vmaster_nid
= 0x0c;
8199 codec
->patch_ops
= alc_patch_ops
;
8200 if (board_config
== ALC883_AUTO
)
8201 spec
->init_hook
= alc883_auto_init
;
8202 #ifdef CONFIG_SND_HDA_POWER_SAVE
8203 if (!spec
->loopback
.amplist
)
8204 spec
->loopback
.amplist
= alc883_loopbacks
;
8214 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
8215 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
8217 #define alc262_dac_nids alc260_dac_nids
8218 #define alc262_adc_nids alc882_adc_nids
8219 #define alc262_adc_nids_alt alc882_adc_nids_alt
8220 #define alc262_capsrc_nids alc882_capsrc_nids
8221 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
8223 #define alc262_modes alc260_modes
8224 #define alc262_capture_source alc882_capture_source
8226 static struct snd_kcontrol_new alc262_base_mixer
[] = {
8227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8228 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8229 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8230 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8231 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8232 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8234 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8235 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8236 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8237 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8238 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8239 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8240 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8241 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
8242 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8243 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
8244 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
8248 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
8249 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8250 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8251 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8252 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8253 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8254 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8255 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8256 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8257 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8258 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8259 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8260 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8261 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
8262 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */
8263 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
8264 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8268 /* update HP, line and mono-out pins according to the master switch */
8269 static void alc262_hp_master_update(struct hda_codec
*codec
)
8271 struct alc_spec
*spec
= codec
->spec
;
8272 int val
= spec
->master_sw
;
8275 snd_hda_codec_write_cache(codec
, 0x1b, 0,
8276 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8278 snd_hda_codec_write_cache(codec
, 0x15, 0,
8279 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8281 /* mono (speaker) depending on the HP jack sense */
8282 val
= val
&& !spec
->jack_present
;
8283 snd_hda_codec_write_cache(codec
, 0x16, 0,
8284 AC_VERB_SET_PIN_WIDGET_CONTROL
,
8288 static void alc262_hp_bpc_automute(struct hda_codec
*codec
)
8290 struct alc_spec
*spec
= codec
->spec
;
8291 unsigned int presence
;
8292 presence
= snd_hda_codec_read(codec
, 0x1b, 0,
8293 AC_VERB_GET_PIN_SENSE
, 0);
8294 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
8295 alc262_hp_master_update(codec
);
8298 static void alc262_hp_bpc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
8300 if ((res
>> 26) != ALC880_HP_EVENT
)
8302 alc262_hp_bpc_automute(codec
);
8305 static void alc262_hp_wildwest_automute(struct hda_codec
*codec
)
8307 struct alc_spec
*spec
= codec
->spec
;
8308 unsigned int presence
;
8309 presence
= snd_hda_codec_read(codec
, 0x15, 0,
8310 AC_VERB_GET_PIN_SENSE
, 0);
8311 spec
->jack_present
= !!(presence
& AC_PINSENSE_PRESENCE
);
8312 alc262_hp_master_update(codec
);
8315 static void alc262_hp_wildwest_unsol_event(struct hda_codec
*codec
,
8318 if ((res
>> 26) != ALC880_HP_EVENT
)
8320 alc262_hp_wildwest_automute(codec
);
8323 static int alc262_hp_master_sw_get(struct snd_kcontrol
*kcontrol
,
8324 struct snd_ctl_elem_value
*ucontrol
)
8326 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8327 struct alc_spec
*spec
= codec
->spec
;
8328 *ucontrol
->value
.integer
.value
= spec
->master_sw
;
8332 static int alc262_hp_master_sw_put(struct snd_kcontrol
*kcontrol
,
8333 struct snd_ctl_elem_value
*ucontrol
)
8335 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8336 struct alc_spec
*spec
= codec
->spec
;
8337 int val
= !!*ucontrol
->value
.integer
.value
;
8339 if (val
== spec
->master_sw
)
8341 spec
->master_sw
= val
;
8342 alc262_hp_master_update(codec
);
8346 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
8348 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8349 .name
= "Master Playback Switch",
8350 .info
= snd_ctl_boolean_mono_info
,
8351 .get
= alc262_hp_master_sw_get
,
8352 .put
= alc262_hp_master_sw_put
,
8354 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8355 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8356 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8357 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8359 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8361 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8362 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8363 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8364 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8365 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8366 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
8367 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8368 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8369 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8370 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8371 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
8372 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
8373 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
8374 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
8378 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer
[] = {
8380 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8381 .name
= "Master Playback Switch",
8382 .info
= snd_ctl_boolean_mono_info
,
8383 .get
= alc262_hp_master_sw_get
,
8384 .put
= alc262_hp_master_sw_put
,
8386 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8387 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8388 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8389 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8390 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
8392 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
8394 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT
),
8395 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT
),
8396 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT
),
8397 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8398 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8399 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8400 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8401 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
8402 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
8406 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer
[] = {
8407 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8408 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8409 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT
),
8413 /* mute/unmute internal speaker according to the hp jack and mute state */
8414 static void alc262_hp_t5735_automute(struct hda_codec
*codec
, int force
)
8416 struct alc_spec
*spec
= codec
->spec
;
8418 if (force
|| !spec
->sense_updated
) {
8419 unsigned int present
;
8420 present
= snd_hda_codec_read(codec
, 0x15, 0,
8421 AC_VERB_GET_PIN_SENSE
, 0);
8422 spec
->jack_present
= (present
& AC_PINSENSE_PRESENCE
) != 0;
8423 spec
->sense_updated
= 1;
8425 snd_hda_codec_amp_stereo(codec
, 0x0c, HDA_OUTPUT
, 0, HDA_AMP_MUTE
,
8426 spec
->jack_present
? HDA_AMP_MUTE
: 0);
8429 static void alc262_hp_t5735_unsol_event(struct hda_codec
*codec
,
8432 if ((res
>> 26) != ALC880_HP_EVENT
)
8434 alc262_hp_t5735_automute(codec
, 1);
8437 static void alc262_hp_t5735_init_hook(struct hda_codec
*codec
)
8439 alc262_hp_t5735_automute(codec
, 1);
8442 static struct snd_kcontrol_new alc262_hp_t5735_mixer
[] = {
8443 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8444 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8445 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
8446 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8448 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8449 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8453 static struct hda_verb alc262_hp_t5735_verbs
[] = {
8454 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8455 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8457 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
8461 static struct snd_kcontrol_new alc262_hp_rp5700_mixer
[] = {
8462 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8463 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
8464 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
8465 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT
),
8466 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8467 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8471 static struct hda_verb alc262_hp_rp5700_verbs
[] = {
8472 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8473 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
8474 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8475 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
8476 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
8477 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8478 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8479 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8480 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
8481 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x00 << 8))},
8485 static struct hda_input_mux alc262_hp_rp5700_capture_source
= {
8492 /* bind hp and internal speaker mute (with plug check) */
8493 static int alc262_sony_master_sw_put(struct snd_kcontrol
*kcontrol
,
8494 struct snd_ctl_elem_value
*ucontrol
)
8496 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8497 long *valp
= ucontrol
->value
.integer
.value
;
8500 /* change hp mute */
8501 change
= snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
8503 valp
[0] ? 0 : HDA_AMP_MUTE
);
8504 change
|= snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
8506 valp
[1] ? 0 : HDA_AMP_MUTE
);
8508 /* change speaker according to HP jack state */
8509 struct alc_spec
*spec
= codec
->spec
;
8511 if (spec
->jack_present
)
8512 mute
= HDA_AMP_MUTE
;
8514 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0,
8516 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8517 HDA_AMP_MUTE
, mute
);
8522 static struct snd_kcontrol_new alc262_sony_mixer
[] = {
8523 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8525 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8526 .name
= "Master Playback Switch",
8527 .info
= snd_hda_mixer_amp_switch_info
,
8528 .get
= snd_hda_mixer_amp_switch_get
,
8529 .put
= alc262_sony_master_sw_put
,
8530 .private_value
= HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT
),
8532 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8533 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8534 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8535 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8539 static struct snd_kcontrol_new alc262_benq_t31_mixer
[] = {
8540 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8541 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8542 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8543 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8544 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8545 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8546 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8550 #define alc262_capture_mixer alc882_capture_mixer
8551 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
8554 * generic initialization of ADC, input mixers and output mixers
8556 static struct hda_verb alc262_init_verbs
[] = {
8558 * Unmute ADC0-2 and set the default input to mic-in
8560 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
8561 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8562 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
8563 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8564 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
8565 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8567 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8569 * Note: PASD motherboards uses the Line In 2 as the input for
8570 * front panel mic (mic 2)
8572 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
8574 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
8575 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
8576 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
8577 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
8580 * Set up output mixers (0x0c - 0x0e)
8582 /* set vol=0 to output mixers */
8583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8585 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
8586 /* set up input amps for analog loopback */
8587 /* Amp Indices: DAC = 0, mixer = 1 */
8588 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8589 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8590 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8591 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8592 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
8593 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
8595 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8596 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8597 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8598 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8599 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8600 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
8602 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8603 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8604 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8605 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8606 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8608 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
8609 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
8611 /* FIXME: use matrix-type input source selection */
8612 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8613 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8614 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8615 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8616 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8617 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8619 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8620 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8621 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8622 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
8625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
8626 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
8627 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
8632 static struct hda_verb alc262_hippo_unsol_verbs
[] = {
8633 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8634 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8638 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
8639 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8640 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
8641 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
8643 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8644 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8648 static struct hda_verb alc262_sony_unsol_verbs
[] = {
8649 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
8650 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8651 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24}, // Front Mic
8653 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8654 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8657 /* mute/unmute internal speaker according to the hp jack and mute state */
8658 static void alc262_hippo_automute(struct hda_codec
*codec
)
8660 struct alc_spec
*spec
= codec
->spec
;
8662 unsigned int present
;
8664 /* need to execute and sync at first */
8665 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
8666 present
= snd_hda_codec_read(codec
, 0x15, 0,
8667 AC_VERB_GET_PIN_SENSE
, 0);
8668 spec
->jack_present
= (present
& 0x80000000) != 0;
8669 if (spec
->jack_present
) {
8670 /* mute internal speaker */
8671 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8672 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8674 /* unmute internal speaker if necessary */
8675 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
8676 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8677 HDA_AMP_MUTE
, mute
);
8681 /* unsolicited event for HP jack sensing */
8682 static void alc262_hippo_unsol_event(struct hda_codec
*codec
,
8685 if ((res
>> 26) != ALC880_HP_EVENT
)
8687 alc262_hippo_automute(codec
);
8690 static void alc262_hippo1_automute(struct hda_codec
*codec
)
8693 unsigned int present
;
8695 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
8696 present
= snd_hda_codec_read(codec
, 0x1b, 0,
8697 AC_VERB_GET_PIN_SENSE
, 0);
8698 present
= (present
& 0x80000000) != 0;
8700 /* mute internal speaker */
8701 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8702 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8704 /* unmute internal speaker if necessary */
8705 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
8706 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8707 HDA_AMP_MUTE
, mute
);
8711 /* unsolicited event for HP jack sensing */
8712 static void alc262_hippo1_unsol_event(struct hda_codec
*codec
,
8715 if ((res
>> 26) != ALC880_HP_EVENT
)
8717 alc262_hippo1_automute(codec
);
8722 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
8725 #define ALC_HP_EVENT 0x37
8727 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
8728 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
8729 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8733 static struct hda_input_mux alc262_fujitsu_capture_source
= {
8742 static struct hda_input_mux alc262_HP_capture_source
= {
8746 { "Front Mic", 0x1 },
8753 static struct hda_input_mux alc262_HP_D7000_capture_source
= {
8757 { "Front Mic", 0x2 },
8763 /* mute/unmute internal speaker according to the hp jack and mute state */
8764 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
8766 struct alc_spec
*spec
= codec
->spec
;
8769 if (force
|| !spec
->sense_updated
) {
8770 unsigned int present
;
8771 /* need to execute and sync at first */
8772 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
8773 present
= snd_hda_codec_read(codec
, 0x14, 0,
8774 AC_VERB_GET_PIN_SENSE
, 0);
8775 spec
->jack_present
= (present
& 0x80000000) != 0;
8776 spec
->sense_updated
= 1;
8778 if (spec
->jack_present
) {
8779 /* mute internal speaker */
8780 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8781 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8783 /* unmute internal speaker if necessary */
8784 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
8785 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
8786 HDA_AMP_MUTE
, mute
);
8790 /* unsolicited event for HP jack sensing */
8791 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
8794 if ((res
>> 26) != ALC_HP_EVENT
)
8796 alc262_fujitsu_automute(codec
, 1);
8799 /* bind volumes of both NID 0x0c and 0x0d */
8800 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol
= {
8801 .ops
= &snd_hda_bind_vol
,
8803 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
8804 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT
),
8809 /* bind hp and internal speaker mute (with plug check) */
8810 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
8811 struct snd_ctl_elem_value
*ucontrol
)
8813 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
8814 long *valp
= ucontrol
->value
.integer
.value
;
8817 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
8819 valp
[0] ? 0 : HDA_AMP_MUTE
);
8820 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
8822 valp
[1] ? 0 : HDA_AMP_MUTE
);
8824 alc262_fujitsu_automute(codec
, 0);
8828 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
8829 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol
),
8831 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
8832 .name
= "Master Playback Switch",
8833 .info
= snd_hda_mixer_amp_switch_info
,
8834 .get
= snd_hda_mixer_amp_switch_get
,
8835 .put
= alc262_fujitsu_master_sw_put
,
8836 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
8838 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
8839 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
8840 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
8841 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
8842 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
8843 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT
),
8844 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
8845 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
8849 /* additional init verbs for Benq laptops */
8850 static struct hda_verb alc262_EAPD_verbs
[] = {
8851 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8852 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
8856 static struct hda_verb alc262_benq_t31_EAPD_verbs
[] = {
8857 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
8858 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8860 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
8861 {0x20, AC_VERB_SET_PROC_COEF
, 0x3050},
8865 /* Samsung Q1 Ultra Vista model setup */
8866 static struct snd_kcontrol_new alc262_ultra_mixer
[] = {
8867 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
8868 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
8869 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
8870 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
8871 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
8872 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT
),
8876 static struct hda_verb alc262_ultra_verbs
[] = {
8877 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
8878 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
8879 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
8880 /* Mic is on Node 0x19 */
8881 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
8882 {0x22, AC_VERB_SET_CONNECT_SEL
, 0x01},
8883 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8884 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x01},
8885 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8886 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x01},
8887 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
8891 static struct hda_input_mux alc262_ultra_capture_source
= {
8898 /* mute/unmute internal speaker according to the hp jack and mute state */
8899 static void alc262_ultra_automute(struct hda_codec
*codec
)
8901 struct alc_spec
*spec
= codec
->spec
;
8903 unsigned int present
;
8905 /* need to execute and sync at first */
8906 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
8907 present
= snd_hda_codec_read(codec
, 0x15, 0,
8908 AC_VERB_GET_PIN_SENSE
, 0);
8909 spec
->jack_present
= (present
& 0x80000000) != 0;
8910 if (spec
->jack_present
) {
8911 /* mute internal speaker */
8912 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8913 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
8915 /* unmute internal speaker if necessary */
8916 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
8917 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
8918 HDA_AMP_MUTE
, mute
);
8922 /* unsolicited event for HP jack sensing */
8923 static void alc262_ultra_unsol_event(struct hda_codec
*codec
,
8926 if ((res
>> 26) != ALC880_HP_EVENT
)
8928 alc262_ultra_automute(codec
);
8931 /* add playback controls from the parsed DAC table */
8932 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
,
8933 const struct auto_pin_cfg
*cfg
)
8938 spec
->multiout
.num_dacs
= 1; /* only use one dac */
8939 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
8940 spec
->multiout
.dac_nids
[0] = 2;
8942 nid
= cfg
->line_out_pins
[0];
8944 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
8945 "Front Playback Volume",
8946 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
));
8949 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8950 "Front Playback Switch",
8951 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
8956 nid
= cfg
->speaker_pins
[0];
8959 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
8960 "Speaker Playback Volume",
8961 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8965 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8966 "Speaker Playback Switch",
8967 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
8972 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8973 "Speaker Playback Switch",
8974 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
8980 nid
= cfg
->hp_pins
[0];
8982 /* spec->multiout.hp_nid = 2; */
8984 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
8985 "Headphone Playback Volume",
8986 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
8990 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8991 "Headphone Playback Switch",
8992 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
8997 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
8998 "Headphone Playback Switch",
8999 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
9008 /* identical with ALC880 */
9009 #define alc262_auto_create_analog_input_ctls \
9010 alc880_auto_create_analog_input_ctls
9013 * generic initialization of ADC, input mixers and output mixers
9015 static struct hda_verb alc262_volume_init_verbs
[] = {
9017 * Unmute ADC0-2 and set the default input to mic-in
9019 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9020 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9021 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9022 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9023 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9024 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9026 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9028 * Note: PASD motherboards uses the Line In 2 as the input for
9029 * front panel mic (mic 2)
9031 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9032 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9033 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9034 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9036 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9039 * Set up output mixers (0x0c - 0x0f)
9041 /* set vol=0 to output mixers */
9042 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9043 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9044 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9046 /* set up input amps for analog loopback */
9047 /* Amp Indices: DAC = 0, mixer = 1 */
9048 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9049 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9050 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9051 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9052 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9053 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9055 /* FIXME: use matrix-type input source selection */
9056 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9057 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9058 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9059 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9060 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9061 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9063 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9064 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9065 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9066 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9068 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9069 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
9070 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
9071 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
9076 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
9078 * Unmute ADC0-2 and set the default input to mic-in
9080 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9082 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9083 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9084 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9085 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9087 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9089 * Note: PASD motherboards uses the Line In 2 as the input for
9090 * front panel mic (mic 2)
9092 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9093 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9094 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9095 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9096 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9097 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9098 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9099 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9102 * Set up output mixers (0x0c - 0x0e)
9104 /* set vol=0 to output mixers */
9105 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9106 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9107 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9109 /* set up input amps for analog loopback */
9110 /* Amp Indices: DAC = 0, mixer = 1 */
9111 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9112 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9113 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9114 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9115 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9116 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9118 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9120 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9122 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9123 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9125 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9126 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
9128 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9129 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9130 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9131 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9132 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9134 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
9135 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9136 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9137 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
9138 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9139 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9142 /* FIXME: use matrix-type input source selection */
9143 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9144 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9145 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9146 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9147 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9148 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9150 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9151 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9152 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9153 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9155 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9156 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9157 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9158 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9160 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9165 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs
[] = {
9167 * Unmute ADC0-2 and set the default input to mic-in
9169 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
9170 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9171 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
9172 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9173 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
9174 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9176 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9178 * Note: PASD motherboards uses the Line In 2 as the input for front
9181 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
9183 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
9185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
9186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
9187 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
9188 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)},
9189 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)},
9191 * Set up output mixers (0x0c - 0x0e)
9193 /* set vol=0 to output mixers */
9194 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9195 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9196 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9198 /* set up input amps for analog loopback */
9199 /* Amp Indices: DAC = 0, mixer = 1 */
9200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9202 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9203 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9204 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9205 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9208 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
}, /* HP */
9209 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Mono */
9210 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* rear MIC */
9211 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* Line in */
9212 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
}, /* Front MIC */
9213 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
}, /* Line out */
9214 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
}, /* CD in */
9216 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9217 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9219 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
9220 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
9222 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
9223 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9224 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9225 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
9226 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9227 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
9229 /* FIXME: use matrix-type input source selection */
9230 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9231 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9232 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))}, /*rear MIC*/
9233 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))}, /*Line in*/
9234 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))}, /*F MIC*/
9235 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))}, /*Front*/
9236 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))}, /*CD*/
9237 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9238 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))}, /*HP*/
9240 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9241 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9242 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9243 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9244 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9245 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9246 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
9248 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
9249 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
9250 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
9251 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
9252 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
9253 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
9254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x07 << 8))},
9256 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9261 #ifdef CONFIG_SND_HDA_POWER_SAVE
9262 #define alc262_loopbacks alc880_loopbacks
9265 /* pcm configuration: identiacal with ALC880 */
9266 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
9267 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
9268 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
9269 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
9272 * BIOS auto configuration
9274 static int alc262_parse_auto_config(struct hda_codec
*codec
)
9276 struct alc_spec
*spec
= codec
->spec
;
9278 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
9280 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
9284 if (!spec
->autocfg
.line_outs
)
9285 return 0; /* can't find valid BIOS pin config */
9286 err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
9289 err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
9293 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
9295 if (spec
->autocfg
.dig_out_pin
)
9296 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
9297 if (spec
->autocfg
.dig_in_pin
)
9298 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
9300 if (spec
->kctl_alloc
)
9301 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
9303 spec
->init_verbs
[spec
->num_init_verbs
++] = alc262_volume_init_verbs
;
9304 spec
->num_mux_defs
= 1;
9305 spec
->input_mux
= &spec
->private_imux
;
9307 err
= alc_auto_add_mic_boost(codec
);
9314 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
9315 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
9316 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
9319 /* init callback for auto-configuration model -- overriding the default init */
9320 static void alc262_auto_init(struct hda_codec
*codec
)
9322 struct alc_spec
*spec
= codec
->spec
;
9323 alc262_auto_init_multi_out(codec
);
9324 alc262_auto_init_hp_out(codec
);
9325 alc262_auto_init_analog_input(codec
);
9326 if (spec
->unsol_event
)
9327 alc_sku_automute(codec
);
9331 * configuration and preset
9333 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
9334 [ALC262_BASIC
] = "basic",
9335 [ALC262_HIPPO
] = "hippo",
9336 [ALC262_HIPPO_1
] = "hippo_1",
9337 [ALC262_FUJITSU
] = "fujitsu",
9338 [ALC262_HP_BPC
] = "hp-bpc",
9339 [ALC262_HP_BPC_D7000_WL
]= "hp-bpc-d7000",
9340 [ALC262_HP_TC_T5735
] = "hp-tc-t5735",
9341 [ALC262_HP_RP5700
] = "hp-rp5700",
9342 [ALC262_BENQ_ED8
] = "benq",
9343 [ALC262_BENQ_T31
] = "benq-t31",
9344 [ALC262_SONY_ASSAMD
] = "sony-assamd",
9345 [ALC262_ULTRA
] = "ultra",
9346 [ALC262_AUTO
] = "auto",
9349 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
9350 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
9351 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC
),
9352 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC
),
9353 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC
),
9354 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC
),
9355 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC
),
9356 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC
),
9357 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC
),
9358 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC
),
9359 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9360 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9361 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9362 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9363 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9364 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9365 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL
),
9366 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF
),
9367 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
9368 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
9369 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
9370 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
9371 ALC262_HP_TC_T5735
),
9372 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700
),
9373 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
9374 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
9375 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
9376 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD
),
9377 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD
),
9378 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
9379 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU
),
9380 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA
),
9381 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
9382 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31
),
9383 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
9387 static struct alc_config_preset alc262_presets
[] = {
9389 .mixers
= { alc262_base_mixer
},
9390 .init_verbs
= { alc262_init_verbs
},
9391 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9392 .dac_nids
= alc262_dac_nids
,
9394 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9395 .channel_mode
= alc262_modes
,
9396 .input_mux
= &alc262_capture_source
,
9399 .mixers
= { alc262_base_mixer
},
9400 .init_verbs
= { alc262_init_verbs
, alc262_hippo_unsol_verbs
},
9401 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9402 .dac_nids
= alc262_dac_nids
,
9404 .dig_out_nid
= ALC262_DIGOUT_NID
,
9405 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9406 .channel_mode
= alc262_modes
,
9407 .input_mux
= &alc262_capture_source
,
9408 .unsol_event
= alc262_hippo_unsol_event
,
9409 .init_hook
= alc262_hippo_automute
,
9411 [ALC262_HIPPO_1
] = {
9412 .mixers
= { alc262_hippo1_mixer
},
9413 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
9414 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9415 .dac_nids
= alc262_dac_nids
,
9417 .dig_out_nid
= ALC262_DIGOUT_NID
,
9418 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9419 .channel_mode
= alc262_modes
,
9420 .input_mux
= &alc262_capture_source
,
9421 .unsol_event
= alc262_hippo1_unsol_event
,
9422 .init_hook
= alc262_hippo1_automute
,
9424 [ALC262_FUJITSU
] = {
9425 .mixers
= { alc262_fujitsu_mixer
},
9426 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
,
9427 alc262_fujitsu_unsol_verbs
},
9428 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9429 .dac_nids
= alc262_dac_nids
,
9431 .dig_out_nid
= ALC262_DIGOUT_NID
,
9432 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9433 .channel_mode
= alc262_modes
,
9434 .input_mux
= &alc262_fujitsu_capture_source
,
9435 .unsol_event
= alc262_fujitsu_unsol_event
,
9438 .mixers
= { alc262_HP_BPC_mixer
},
9439 .init_verbs
= { alc262_HP_BPC_init_verbs
},
9440 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9441 .dac_nids
= alc262_dac_nids
,
9443 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9444 .channel_mode
= alc262_modes
,
9445 .input_mux
= &alc262_HP_capture_source
,
9446 .unsol_event
= alc262_hp_bpc_unsol_event
,
9447 .init_hook
= alc262_hp_bpc_automute
,
9449 [ALC262_HP_BPC_D7000_WF
] = {
9450 .mixers
= { alc262_HP_BPC_WildWest_mixer
},
9451 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
9452 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9453 .dac_nids
= alc262_dac_nids
,
9455 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9456 .channel_mode
= alc262_modes
,
9457 .input_mux
= &alc262_HP_D7000_capture_source
,
9458 .unsol_event
= alc262_hp_wildwest_unsol_event
,
9459 .init_hook
= alc262_hp_wildwest_automute
,
9461 [ALC262_HP_BPC_D7000_WL
] = {
9462 .mixers
= { alc262_HP_BPC_WildWest_mixer
,
9463 alc262_HP_BPC_WildWest_option_mixer
},
9464 .init_verbs
= { alc262_HP_BPC_WildWest_init_verbs
},
9465 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9466 .dac_nids
= alc262_dac_nids
,
9468 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9469 .channel_mode
= alc262_modes
,
9470 .input_mux
= &alc262_HP_D7000_capture_source
,
9471 .unsol_event
= alc262_hp_wildwest_unsol_event
,
9472 .init_hook
= alc262_hp_wildwest_automute
,
9474 [ALC262_HP_TC_T5735
] = {
9475 .mixers
= { alc262_hp_t5735_mixer
},
9476 .init_verbs
= { alc262_init_verbs
, alc262_hp_t5735_verbs
},
9477 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9478 .dac_nids
= alc262_dac_nids
,
9480 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9481 .channel_mode
= alc262_modes
,
9482 .input_mux
= &alc262_capture_source
,
9483 .unsol_event
= alc262_hp_t5735_unsol_event
,
9484 .init_hook
= alc262_hp_t5735_init_hook
,
9486 [ALC262_HP_RP5700
] = {
9487 .mixers
= { alc262_hp_rp5700_mixer
},
9488 .init_verbs
= { alc262_init_verbs
, alc262_hp_rp5700_verbs
},
9489 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9490 .dac_nids
= alc262_dac_nids
,
9491 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9492 .channel_mode
= alc262_modes
,
9493 .input_mux
= &alc262_hp_rp5700_capture_source
,
9495 [ALC262_BENQ_ED8
] = {
9496 .mixers
= { alc262_base_mixer
},
9497 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
9498 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9499 .dac_nids
= alc262_dac_nids
,
9501 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9502 .channel_mode
= alc262_modes
,
9503 .input_mux
= &alc262_capture_source
,
9505 [ALC262_SONY_ASSAMD
] = {
9506 .mixers
= { alc262_sony_mixer
},
9507 .init_verbs
= { alc262_init_verbs
, alc262_sony_unsol_verbs
},
9508 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9509 .dac_nids
= alc262_dac_nids
,
9511 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9512 .channel_mode
= alc262_modes
,
9513 .input_mux
= &alc262_capture_source
,
9514 .unsol_event
= alc262_hippo_unsol_event
,
9515 .init_hook
= alc262_hippo_automute
,
9517 [ALC262_BENQ_T31
] = {
9518 .mixers
= { alc262_benq_t31_mixer
},
9519 .init_verbs
= { alc262_init_verbs
, alc262_benq_t31_EAPD_verbs
, alc262_hippo_unsol_verbs
},
9520 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9521 .dac_nids
= alc262_dac_nids
,
9523 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9524 .channel_mode
= alc262_modes
,
9525 .input_mux
= &alc262_capture_source
,
9526 .unsol_event
= alc262_hippo_unsol_event
,
9527 .init_hook
= alc262_hippo_automute
,
9530 .mixers
= { alc262_ultra_mixer
},
9531 .init_verbs
= { alc262_init_verbs
, alc262_ultra_verbs
},
9532 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
9533 .dac_nids
= alc262_dac_nids
,
9535 .dig_out_nid
= ALC262_DIGOUT_NID
,
9536 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
9537 .channel_mode
= alc262_modes
,
9538 .input_mux
= &alc262_ultra_capture_source
,
9539 .unsol_event
= alc262_ultra_unsol_event
,
9540 .init_hook
= alc262_ultra_automute
,
9544 static int patch_alc262(struct hda_codec
*codec
)
9546 struct alc_spec
*spec
;
9550 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
9556 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
9561 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
9562 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
9563 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
9564 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
9568 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
9572 if (board_config
< 0) {
9573 printk(KERN_INFO
"hda_codec: Unknown model for ALC262, "
9574 "trying auto-probe from BIOS...\n");
9575 board_config
= ALC262_AUTO
;
9578 if (board_config
== ALC262_AUTO
) {
9579 /* automatic parse from the BIOS config */
9580 err
= alc262_parse_auto_config(codec
);
9586 "hda_codec: Cannot set up configuration "
9587 "from BIOS. Using base mode...\n");
9588 board_config
= ALC262_BASIC
;
9592 if (board_config
!= ALC262_AUTO
)
9593 setup_preset(spec
, &alc262_presets
[board_config
]);
9595 spec
->stream_name_analog
= "ALC262 Analog";
9596 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
9597 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
9599 spec
->stream_name_digital
= "ALC262 Digital";
9600 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
9601 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
9603 if (!spec
->adc_nids
&& spec
->input_mux
) {
9604 /* check whether NID 0x07 is valid */
9605 unsigned int wcap
= get_wcaps(codec
, 0x07);
9608 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
9609 if (wcap
!= AC_WID_AUD_IN
) {
9610 spec
->adc_nids
= alc262_adc_nids_alt
;
9611 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids_alt
);
9612 spec
->capsrc_nids
= alc262_capsrc_nids_alt
;
9613 spec
->mixers
[spec
->num_mixers
] =
9614 alc262_capture_alt_mixer
;
9617 spec
->adc_nids
= alc262_adc_nids
;
9618 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids
);
9619 spec
->capsrc_nids
= alc262_capsrc_nids
;
9620 spec
->mixers
[spec
->num_mixers
] = alc262_capture_mixer
;
9625 spec
->vmaster_nid
= 0x0c;
9627 codec
->patch_ops
= alc_patch_ops
;
9628 if (board_config
== ALC262_AUTO
)
9629 spec
->init_hook
= alc262_auto_init
;
9630 #ifdef CONFIG_SND_HDA_POWER_SAVE
9631 if (!spec
->loopback
.amplist
)
9632 spec
->loopback
.amplist
= alc262_loopbacks
;
9639 * ALC268 channel source setting (2 channel)
9641 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
9642 #define alc268_modes alc260_modes
9644 static hda_nid_t alc268_dac_nids
[2] = {
9649 static hda_nid_t alc268_adc_nids
[2] = {
9654 static hda_nid_t alc268_adc_nids_alt
[1] = {
9659 static hda_nid_t alc268_capsrc_nids
[2] = { 0x23, 0x24 };
9661 static struct snd_kcontrol_new alc268_base_mixer
[] = {
9662 /* output mixer control */
9663 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
9664 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9665 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
9666 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9667 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9668 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
9669 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
9673 /* bind Beep switches of both NID 0x0f and 0x10 */
9674 static struct hda_bind_ctls alc268_bind_beep_sw
= {
9675 .ops
= &snd_hda_bind_sw
,
9677 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT
),
9678 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT
),
9683 static struct snd_kcontrol_new alc268_beep_mixer
[] = {
9684 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT
),
9685 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw
),
9689 static struct hda_verb alc268_eapd_verbs
[] = {
9690 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
9691 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
9695 /* Toshiba specific */
9696 #define alc268_toshiba_automute alc262_hippo_automute
9698 static struct hda_verb alc268_toshiba_verbs
[] = {
9699 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9704 /* bind volumes of both NID 0x02 and 0x03 */
9705 static struct hda_bind_ctls alc268_acer_bind_master_vol
= {
9706 .ops
= &snd_hda_bind_vol
,
9708 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
),
9709 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT
),
9714 /* mute/unmute internal speaker according to the hp jack and mute state */
9715 static void alc268_acer_automute(struct hda_codec
*codec
, int force
)
9717 struct alc_spec
*spec
= codec
->spec
;
9720 if (force
|| !spec
->sense_updated
) {
9721 unsigned int present
;
9722 present
= snd_hda_codec_read(codec
, 0x14, 0,
9723 AC_VERB_GET_PIN_SENSE
, 0);
9724 spec
->jack_present
= (present
& 0x80000000) != 0;
9725 spec
->sense_updated
= 1;
9727 if (spec
->jack_present
)
9728 mute
= HDA_AMP_MUTE
; /* mute internal speaker */
9729 else /* unmute internal speaker if necessary */
9730 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
9731 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
9732 HDA_AMP_MUTE
, mute
);
9736 /* bind hp and internal speaker mute (with plug check) */
9737 static int alc268_acer_master_sw_put(struct snd_kcontrol
*kcontrol
,
9738 struct snd_ctl_elem_value
*ucontrol
)
9740 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
9741 long *valp
= ucontrol
->value
.integer
.value
;
9744 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
9746 valp
[0] ? 0 : HDA_AMP_MUTE
);
9747 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
9749 valp
[1] ? 0 : HDA_AMP_MUTE
);
9751 alc268_acer_automute(codec
, 0);
9755 static struct snd_kcontrol_new alc268_acer_mixer
[] = {
9756 /* output mixer control */
9757 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol
),
9759 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9760 .name
= "Master Playback Switch",
9761 .info
= snd_hda_mixer_amp_switch_info
,
9762 .get
= snd_hda_mixer_amp_switch_get
,
9763 .put
= alc268_acer_master_sw_put
,
9764 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
9766 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9767 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
9768 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT
),
9772 static struct hda_verb alc268_acer_verbs
[] = {
9773 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9774 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
9776 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9780 /* unsolicited event for HP jack sensing */
9781 static void alc268_toshiba_unsol_event(struct hda_codec
*codec
,
9784 if ((res
>> 26) != ALC880_HP_EVENT
)
9786 alc268_toshiba_automute(codec
);
9789 static void alc268_acer_unsol_event(struct hda_codec
*codec
,
9792 if ((res
>> 26) != ALC880_HP_EVENT
)
9794 alc268_acer_automute(codec
, 1);
9797 static void alc268_acer_init_hook(struct hda_codec
*codec
)
9799 alc268_acer_automute(codec
, 1);
9802 static struct snd_kcontrol_new alc268_dell_mixer
[] = {
9803 /* output mixer control */
9804 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
9805 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
9806 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
9807 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
9808 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
9809 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT
),
9813 static struct hda_verb alc268_dell_verbs
[] = {
9814 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9815 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
9816 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
9820 /* mute/unmute internal speaker according to the hp jack and mute state */
9821 static void alc268_dell_automute(struct hda_codec
*codec
)
9823 unsigned int present
;
9826 present
= snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_GET_PIN_SENSE
, 0);
9827 if (present
& 0x80000000)
9828 mute
= HDA_AMP_MUTE
;
9830 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
9831 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
9832 HDA_AMP_MUTE
, mute
);
9835 static void alc268_dell_unsol_event(struct hda_codec
*codec
,
9838 if ((res
>> 26) != ALC880_HP_EVENT
)
9840 alc268_dell_automute(codec
);
9843 #define alc268_dell_init_hook alc268_dell_automute
9846 * generic initialization of ADC, input mixers and output mixers
9848 static struct hda_verb alc268_base_init_verbs
[] = {
9849 /* Unmute DAC0-1 and set vol = 0 */
9850 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9851 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9852 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9853 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9854 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9855 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9858 * Set up output mixers (0x0c - 0x0e)
9860 /* set vol=0 to output mixers */
9861 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9862 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9863 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9864 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
9866 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9867 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9869 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
9870 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
9871 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
9872 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9873 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9874 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9875 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9876 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9878 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9879 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9880 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9881 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9882 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9883 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9884 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9886 /* set PCBEEP vol = 0, mute connections */
9887 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9888 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9889 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9891 /* Unmute Selector 23h,24h and set the default input to mic-in */
9893 {0x23, AC_VERB_SET_CONNECT_SEL
, 0x00},
9894 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9895 {0x24, AC_VERB_SET_CONNECT_SEL
, 0x00},
9896 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
9902 * generic initialization of ADC, input mixers and output mixers
9904 static struct hda_verb alc268_volume_init_verbs
[] = {
9905 /* set output DAC */
9906 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9907 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9908 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9909 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9911 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9912 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
9913 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9914 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9915 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
9917 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
9918 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9919 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
9920 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9921 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9923 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9924 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9925 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9926 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
9928 /* set PCBEEP vol = 0, mute connections */
9929 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
9930 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9931 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
9936 #define alc268_mux_enum_info alc_mux_enum_info
9937 #define alc268_mux_enum_get alc_mux_enum_get
9938 #define alc268_mux_enum_put alc_mux_enum_put
9940 static struct snd_kcontrol_new alc268_capture_alt_mixer
[] = {
9941 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
9942 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
9944 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9945 /* The multiple "Capture Source" controls confuse alsamixer
9946 * So call somewhat different..
9948 /* .name = "Capture Source", */
9949 .name
= "Input Source",
9951 .info
= alc268_mux_enum_info
,
9952 .get
= alc268_mux_enum_get
,
9953 .put
= alc268_mux_enum_put
,
9958 static struct snd_kcontrol_new alc268_capture_mixer
[] = {
9959 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
9960 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT
),
9961 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT
),
9962 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT
),
9964 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
9965 /* The multiple "Capture Source" controls confuse alsamixer
9966 * So call somewhat different..
9968 /* .name = "Capture Source", */
9969 .name
= "Input Source",
9971 .info
= alc268_mux_enum_info
,
9972 .get
= alc268_mux_enum_get
,
9973 .put
= alc268_mux_enum_put
,
9978 static struct hda_input_mux alc268_capture_source
= {
9982 { "Front Mic", 0x1 },
9988 #ifdef CONFIG_SND_DEBUG
9989 static struct snd_kcontrol_new alc268_test_mixer
[] = {
9990 /* Volume widgets */
9991 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
9992 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
9993 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
9994 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT
),
9995 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT
),
9996 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT
),
9997 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT
),
9998 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT
),
9999 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT
),
10000 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT
),
10001 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT
),
10002 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT
),
10003 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT
),
10004 /* The below appears problematic on some hardwares */
10005 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
10006 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT
),
10007 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT
),
10008 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT
),
10009 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT
),
10011 /* Modes for retasking pin widgets */
10012 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT
),
10013 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT
),
10014 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT
),
10015 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT
),
10017 /* Controls for GPIO pins, assuming they are configured as outputs */
10018 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
10019 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
10020 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
10021 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
10023 /* Switches to allow the digital SPDIF output pin to be enabled.
10024 * The ALC268 does not have an SPDIF input.
10026 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
10028 /* A switch allowing EAPD to be enabled. Some laptops seem to use
10029 * this output to turn on an external amplifier.
10031 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
10032 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
10038 /* create input playback/capture controls for the given pin */
10039 static int alc268_new_analog_output(struct alc_spec
*spec
, hda_nid_t nid
,
10040 const char *ctlname
, int idx
)
10045 sprintf(name
, "%s Playback Volume", ctlname
);
10047 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
10048 HDA_COMPOSE_AMP_VAL(0x02, 3, idx
,
10052 } else if (nid
== 0x15) {
10053 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
10054 HDA_COMPOSE_AMP_VAL(0x03, 3, idx
,
10060 sprintf(name
, "%s Playback Switch", ctlname
);
10061 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
10062 HDA_COMPOSE_AMP_VAL(nid
, 3, idx
, HDA_OUTPUT
));
10068 /* add playback controls from the parsed DAC table */
10069 static int alc268_auto_create_multi_out_ctls(struct alc_spec
*spec
,
10070 const struct auto_pin_cfg
*cfg
)
10075 spec
->multiout
.num_dacs
= 2; /* only use one dac */
10076 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
10077 spec
->multiout
.dac_nids
[0] = 2;
10078 spec
->multiout
.dac_nids
[1] = 3;
10080 nid
= cfg
->line_out_pins
[0];
10082 alc268_new_analog_output(spec
, nid
, "Front", 0);
10084 nid
= cfg
->speaker_pins
[0];
10086 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10087 "Speaker Playback Volume",
10088 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_INPUT
));
10092 nid
= cfg
->hp_pins
[0];
10094 alc268_new_analog_output(spec
, nid
, "Headphone", 0);
10096 nid
= cfg
->line_out_pins
[1] | cfg
->line_out_pins
[2];
10098 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10099 "Mono Playback Switch",
10100 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_INPUT
));
10107 /* create playback/capture controls for input pins */
10108 static int alc268_auto_create_analog_input_ctls(struct alc_spec
*spec
,
10109 const struct auto_pin_cfg
*cfg
)
10111 struct hda_input_mux
*imux
= &spec
->private_imux
;
10114 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
10115 switch(cfg
->input_pins
[i
]) {
10117 idx1
= 0; /* Mic 1 */
10120 idx1
= 1; /* Mic 2 */
10123 idx1
= 2; /* Line In */
10131 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
10132 imux
->items
[imux
->num_items
].index
= idx1
;
10138 static void alc268_auto_init_mono_speaker_out(struct hda_codec
*codec
)
10140 struct alc_spec
*spec
= codec
->spec
;
10141 hda_nid_t speaker_nid
= spec
->autocfg
.speaker_pins
[0];
10142 hda_nid_t hp_nid
= spec
->autocfg
.hp_pins
[0];
10143 hda_nid_t line_nid
= spec
->autocfg
.line_out_pins
[0];
10144 unsigned int dac_vol1
, dac_vol2
;
10147 snd_hda_codec_write(codec
, speaker_nid
, 0,
10148 AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
);
10149 snd_hda_codec_write(codec
, 0x0f, 0,
10150 AC_VERB_SET_AMP_GAIN_MUTE
,
10152 snd_hda_codec_write(codec
, 0x10, 0,
10153 AC_VERB_SET_AMP_GAIN_MUTE
,
10156 snd_hda_codec_write(codec
, 0x0f, 0,
10157 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
10158 snd_hda_codec_write(codec
, 0x10, 0,
10159 AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1));
10162 dac_vol1
= dac_vol2
= 0xb000 | 0x40; /* set max volume */
10163 if (line_nid
== 0x14)
10164 dac_vol2
= AMP_OUT_ZERO
;
10165 else if (line_nid
== 0x15)
10166 dac_vol1
= AMP_OUT_ZERO
;
10167 if (hp_nid
== 0x14)
10168 dac_vol2
= AMP_OUT_ZERO
;
10169 else if (hp_nid
== 0x15)
10170 dac_vol1
= AMP_OUT_ZERO
;
10171 if (line_nid
!= 0x16 || hp_nid
!= 0x16 ||
10172 spec
->autocfg
.line_out_pins
[1] != 0x16 ||
10173 spec
->autocfg
.line_out_pins
[2] != 0x16)
10174 dac_vol1
= dac_vol2
= AMP_OUT_ZERO
;
10176 snd_hda_codec_write(codec
, 0x02, 0,
10177 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol1
);
10178 snd_hda_codec_write(codec
, 0x03, 0,
10179 AC_VERB_SET_AMP_GAIN_MUTE
, dac_vol2
);
10182 /* pcm configuration: identiacal with ALC880 */
10183 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
10184 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
10185 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
10186 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
10189 * BIOS auto configuration
10191 static int alc268_parse_auto_config(struct hda_codec
*codec
)
10193 struct alc_spec
*spec
= codec
->spec
;
10195 static hda_nid_t alc268_ignore
[] = { 0 };
10197 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10201 if (!spec
->autocfg
.line_outs
)
10202 return 0; /* can't find valid BIOS pin config */
10204 err
= alc268_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
10207 err
= alc268_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
10211 spec
->multiout
.max_channels
= 2;
10213 /* digital only support output */
10214 if (spec
->autocfg
.dig_out_pin
)
10215 spec
->multiout
.dig_out_nid
= ALC268_DIGOUT_NID
;
10217 if (spec
->kctl_alloc
)
10218 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
10220 if (spec
->autocfg
.speaker_pins
[0] != 0x1d)
10221 spec
->mixers
[spec
->num_mixers
++] = alc268_beep_mixer
;
10223 spec
->init_verbs
[spec
->num_init_verbs
++] = alc268_volume_init_verbs
;
10224 spec
->num_mux_defs
= 1;
10225 spec
->input_mux
= &spec
->private_imux
;
10227 err
= alc_auto_add_mic_boost(codec
);
10234 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
10235 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
10236 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
10238 /* init callback for auto-configuration model -- overriding the default init */
10239 static void alc268_auto_init(struct hda_codec
*codec
)
10241 struct alc_spec
*spec
= codec
->spec
;
10242 alc268_auto_init_multi_out(codec
);
10243 alc268_auto_init_hp_out(codec
);
10244 alc268_auto_init_mono_speaker_out(codec
);
10245 alc268_auto_init_analog_input(codec
);
10246 if (spec
->unsol_event
)
10247 alc_sku_automute(codec
);
10251 * configuration and preset
10253 static const char *alc268_models
[ALC268_MODEL_LAST
] = {
10254 [ALC268_3ST
] = "3stack",
10255 [ALC268_TOSHIBA
] = "toshiba",
10256 [ALC268_ACER
] = "acer",
10257 [ALC268_DELL
] = "dell",
10258 [ALC268_ZEPTO
] = "zepto",
10259 #ifdef CONFIG_SND_DEBUG
10260 [ALC268_TEST
] = "test",
10262 [ALC268_AUTO
] = "auto",
10265 static struct snd_pci_quirk alc268_cfg_tbl
[] = {
10266 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER
),
10267 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER
),
10268 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER
),
10269 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER
),
10270 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL
),
10271 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA
),
10272 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST
),
10273 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA
),
10274 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA
),
10275 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER
),
10276 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO
),
10280 static struct alc_config_preset alc268_presets
[] = {
10282 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
10283 alc268_beep_mixer
},
10284 .init_verbs
= { alc268_base_init_verbs
},
10285 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10286 .dac_nids
= alc268_dac_nids
,
10287 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10288 .adc_nids
= alc268_adc_nids_alt
,
10289 .capsrc_nids
= alc268_capsrc_nids
,
10291 .dig_out_nid
= ALC268_DIGOUT_NID
,
10292 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10293 .channel_mode
= alc268_modes
,
10294 .input_mux
= &alc268_capture_source
,
10296 [ALC268_TOSHIBA
] = {
10297 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
10298 alc268_beep_mixer
},
10299 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10300 alc268_toshiba_verbs
},
10301 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10302 .dac_nids
= alc268_dac_nids
,
10303 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10304 .adc_nids
= alc268_adc_nids_alt
,
10305 .capsrc_nids
= alc268_capsrc_nids
,
10307 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10308 .channel_mode
= alc268_modes
,
10309 .input_mux
= &alc268_capture_source
,
10310 .unsol_event
= alc268_toshiba_unsol_event
,
10311 .init_hook
= alc268_toshiba_automute
,
10314 .mixers
= { alc268_acer_mixer
, alc268_capture_alt_mixer
,
10315 alc268_beep_mixer
},
10316 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10317 alc268_acer_verbs
},
10318 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10319 .dac_nids
= alc268_dac_nids
,
10320 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10321 .adc_nids
= alc268_adc_nids_alt
,
10322 .capsrc_nids
= alc268_capsrc_nids
,
10324 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10325 .channel_mode
= alc268_modes
,
10326 .input_mux
= &alc268_capture_source
,
10327 .unsol_event
= alc268_acer_unsol_event
,
10328 .init_hook
= alc268_acer_init_hook
,
10331 .mixers
= { alc268_dell_mixer
, alc268_beep_mixer
},
10332 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10333 alc268_dell_verbs
},
10334 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10335 .dac_nids
= alc268_dac_nids
,
10337 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10338 .channel_mode
= alc268_modes
,
10339 .unsol_event
= alc268_dell_unsol_event
,
10340 .init_hook
= alc268_dell_init_hook
,
10341 .input_mux
= &alc268_capture_source
,
10344 .mixers
= { alc268_base_mixer
, alc268_capture_alt_mixer
,
10345 alc268_beep_mixer
},
10346 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10347 alc268_toshiba_verbs
},
10348 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10349 .dac_nids
= alc268_dac_nids
,
10350 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10351 .adc_nids
= alc268_adc_nids_alt
,
10352 .capsrc_nids
= alc268_capsrc_nids
,
10354 .dig_out_nid
= ALC268_DIGOUT_NID
,
10355 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10356 .channel_mode
= alc268_modes
,
10357 .input_mux
= &alc268_capture_source
,
10358 .unsol_event
= alc268_toshiba_unsol_event
,
10359 .init_hook
= alc268_toshiba_automute
10361 #ifdef CONFIG_SND_DEBUG
10363 .mixers
= { alc268_test_mixer
, alc268_capture_mixer
},
10364 .init_verbs
= { alc268_base_init_verbs
, alc268_eapd_verbs
,
10365 alc268_volume_init_verbs
},
10366 .num_dacs
= ARRAY_SIZE(alc268_dac_nids
),
10367 .dac_nids
= alc268_dac_nids
,
10368 .num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
),
10369 .adc_nids
= alc268_adc_nids_alt
,
10370 .capsrc_nids
= alc268_capsrc_nids
,
10372 .dig_out_nid
= ALC268_DIGOUT_NID
,
10373 .num_channel_mode
= ARRAY_SIZE(alc268_modes
),
10374 .channel_mode
= alc268_modes
,
10375 .input_mux
= &alc268_capture_source
,
10380 static int patch_alc268(struct hda_codec
*codec
)
10382 struct alc_spec
*spec
;
10386 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
10390 codec
->spec
= spec
;
10392 board_config
= snd_hda_check_board_config(codec
, ALC268_MODEL_LAST
,
10396 if (board_config
< 0 || board_config
>= ALC268_MODEL_LAST
) {
10397 printk(KERN_INFO
"hda_codec: Unknown model for ALC268, "
10398 "trying auto-probe from BIOS...\n");
10399 board_config
= ALC268_AUTO
;
10402 if (board_config
== ALC268_AUTO
) {
10403 /* automatic parse from the BIOS config */
10404 err
= alc268_parse_auto_config(codec
);
10410 "hda_codec: Cannot set up configuration "
10411 "from BIOS. Using base mode...\n");
10412 board_config
= ALC268_3ST
;
10416 if (board_config
!= ALC268_AUTO
)
10417 setup_preset(spec
, &alc268_presets
[board_config
]);
10419 spec
->stream_name_analog
= "ALC268 Analog";
10420 spec
->stream_analog_playback
= &alc268_pcm_analog_playback
;
10421 spec
->stream_analog_capture
= &alc268_pcm_analog_capture
;
10422 spec
->stream_analog_alt_capture
= &alc268_pcm_analog_alt_capture
;
10424 spec
->stream_name_digital
= "ALC268 Digital";
10425 spec
->stream_digital_playback
= &alc268_pcm_digital_playback
;
10427 if (!query_amp_caps(codec
, 0x1d, HDA_INPUT
))
10428 /* override the amp caps for beep generator */
10429 snd_hda_override_amp_caps(codec
, 0x1d, HDA_INPUT
,
10430 (0x0c << AC_AMPCAP_OFFSET_SHIFT
) |
10431 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT
) |
10432 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT
) |
10433 (0 << AC_AMPCAP_MUTE_SHIFT
));
10435 if (!spec
->adc_nids
&& spec
->input_mux
) {
10436 /* check whether NID 0x07 is valid */
10437 unsigned int wcap
= get_wcaps(codec
, 0x07);
10441 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
;
10442 if (wcap
!= AC_WID_AUD_IN
|| spec
->input_mux
->num_items
== 1) {
10443 spec
->adc_nids
= alc268_adc_nids_alt
;
10444 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids_alt
);
10445 spec
->mixers
[spec
->num_mixers
] =
10446 alc268_capture_alt_mixer
;
10447 spec
->num_mixers
++;
10449 spec
->adc_nids
= alc268_adc_nids
;
10450 spec
->num_adc_nids
= ARRAY_SIZE(alc268_adc_nids
);
10451 spec
->mixers
[spec
->num_mixers
] =
10452 alc268_capture_mixer
;
10453 spec
->num_mixers
++;
10455 spec
->capsrc_nids
= alc268_capsrc_nids
;
10456 /* set default input source */
10457 for (i
= 0; i
< spec
->num_adc_nids
; i
++)
10458 snd_hda_codec_write_cache(codec
, alc268_capsrc_nids
[i
],
10459 0, AC_VERB_SET_CONNECT_SEL
,
10460 spec
->input_mux
->items
[0].index
);
10463 spec
->vmaster_nid
= 0x02;
10465 codec
->patch_ops
= alc_patch_ops
;
10466 if (board_config
== ALC268_AUTO
)
10467 spec
->init_hook
= alc268_auto_init
;
10473 * ALC269 channel source setting (2 channel)
10475 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
10477 #define alc269_dac_nids alc260_dac_nids
10479 static hda_nid_t alc269_adc_nids
[1] = {
10484 #define alc269_modes alc260_modes
10485 #define alc269_capture_source alc880_lg_lw_capture_source
10487 static struct snd_kcontrol_new alc269_base_mixer
[] = {
10488 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
10489 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
10490 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
10491 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
10492 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
10493 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
10494 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
10495 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
10496 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
10497 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
10498 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
10499 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
10503 /* capture mixer elements */
10504 static struct snd_kcontrol_new alc269_capture_mixer
[] = {
10505 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
10506 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
10508 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10509 /* The multiple "Capture Source" controls confuse alsamixer
10510 * So call somewhat different..
10512 /* .name = "Capture Source", */
10513 .name
= "Input Source",
10515 .info
= alc_mux_enum_info
,
10516 .get
= alc_mux_enum_get
,
10517 .put
= alc_mux_enum_put
,
10523 * generic initialization of ADC, input mixers and output mixers
10525 static struct hda_verb alc269_init_verbs
[] = {
10527 * Unmute ADC0 and set the default input to mic-in
10529 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10531 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
10532 * analog-loopback mixer widget
10533 * Note: PASD motherboards uses the Line In 2 as the input for
10534 * front panel mic (mic 2)
10536 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10537 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
10538 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10539 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10540 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10541 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
10544 * Set up output mixers (0x0c - 0x0e)
10546 /* set vol=0 to output mixers */
10547 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10548 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
10550 /* set up input amps for analog loopback */
10551 /* Amp Indices: DAC = 0, mixer = 1 */
10552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10554 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10555 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10556 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10557 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
10559 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10560 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
10561 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
10562 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10563 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
10564 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10565 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
10567 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10568 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
10569 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10570 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10571 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10572 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10573 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
10575 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
10576 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
10578 /* FIXME: use matrix-type input source selection */
10579 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
10580 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10581 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
10582 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
10583 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
10584 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
10587 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10588 {0x15, AC_VERB_SET_EAPD_BTLENABLE
, 2},
10592 /* add playback controls from the parsed DAC table */
10593 static int alc269_auto_create_multi_out_ctls(struct alc_spec
*spec
,
10594 const struct auto_pin_cfg
*cfg
)
10599 spec
->multiout
.num_dacs
= 1; /* only use one dac */
10600 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
10601 spec
->multiout
.dac_nids
[0] = 2;
10603 nid
= cfg
->line_out_pins
[0];
10605 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10606 "Front Playback Volume",
10607 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT
));
10610 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10611 "Front Playback Switch",
10612 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
10617 nid
= cfg
->speaker_pins
[0];
10619 if (!cfg
->line_out_pins
[0]) {
10620 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10621 "Speaker Playback Volume",
10622 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10628 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10629 "Speaker Playback Switch",
10630 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
10635 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10636 "Speaker Playback Switch",
10637 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
10643 nid
= cfg
->hp_pins
[0];
10645 /* spec->multiout.hp_nid = 2; */
10646 if (!cfg
->line_out_pins
[0] && !cfg
->speaker_pins
[0]) {
10647 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
10648 "Headphone Playback Volume",
10649 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
10655 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10656 "Headphone Playback Switch",
10657 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
10662 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
10663 "Headphone Playback Switch",
10664 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
10673 #define alc269_auto_create_analog_input_ctls \
10674 alc880_auto_create_analog_input_ctls
10676 #ifdef CONFIG_SND_HDA_POWER_SAVE
10677 #define alc269_loopbacks alc880_loopbacks
10680 /* pcm configuration: identiacal with ALC880 */
10681 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
10682 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
10683 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
10684 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
10687 * BIOS auto configuration
10689 static int alc269_parse_auto_config(struct hda_codec
*codec
)
10691 struct alc_spec
*spec
= codec
->spec
;
10693 static hda_nid_t alc269_ignore
[] = { 0x1d, 0 };
10695 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
10700 err
= alc269_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
10703 err
= alc269_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
10707 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
10709 if (spec
->autocfg
.dig_out_pin
)
10710 spec
->multiout
.dig_out_nid
= ALC269_DIGOUT_NID
;
10712 if (spec
->kctl_alloc
)
10713 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
10715 spec
->init_verbs
[spec
->num_init_verbs
++] = alc269_init_verbs
;
10716 spec
->num_mux_defs
= 1;
10717 spec
->input_mux
= &spec
->private_imux
;
10719 err
= alc_auto_add_mic_boost(codec
);
10726 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
10727 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
10728 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
10731 /* init callback for auto-configuration model -- overriding the default init */
10732 static void alc269_auto_init(struct hda_codec
*codec
)
10734 struct alc_spec
*spec
= codec
->spec
;
10735 alc269_auto_init_multi_out(codec
);
10736 alc269_auto_init_hp_out(codec
);
10737 alc269_auto_init_analog_input(codec
);
10738 if (spec
->unsol_event
)
10739 alc_sku_automute(codec
);
10743 * configuration and preset
10745 static const char *alc269_models
[ALC269_MODEL_LAST
] = {
10746 [ALC269_BASIC
] = "basic",
10749 static struct snd_pci_quirk alc269_cfg_tbl
[] = {
10753 static struct alc_config_preset alc269_presets
[] = {
10755 .mixers
= { alc269_base_mixer
},
10756 .init_verbs
= { alc269_init_verbs
},
10757 .num_dacs
= ARRAY_SIZE(alc269_dac_nids
),
10758 .dac_nids
= alc269_dac_nids
,
10760 .num_channel_mode
= ARRAY_SIZE(alc269_modes
),
10761 .channel_mode
= alc269_modes
,
10762 .input_mux
= &alc269_capture_source
,
10766 static int patch_alc269(struct hda_codec
*codec
)
10768 struct alc_spec
*spec
;
10772 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
10776 codec
->spec
= spec
;
10778 board_config
= snd_hda_check_board_config(codec
, ALC269_MODEL_LAST
,
10782 if (board_config
< 0) {
10783 printk(KERN_INFO
"hda_codec: Unknown model for ALC269, "
10784 "trying auto-probe from BIOS...\n");
10785 board_config
= ALC269_AUTO
;
10788 if (board_config
== ALC269_AUTO
) {
10789 /* automatic parse from the BIOS config */
10790 err
= alc269_parse_auto_config(codec
);
10796 "hda_codec: Cannot set up configuration "
10797 "from BIOS. Using base mode...\n");
10798 board_config
= ALC269_BASIC
;
10802 if (board_config
!= ALC269_AUTO
)
10803 setup_preset(spec
, &alc269_presets
[board_config
]);
10805 spec
->stream_name_analog
= "ALC269 Analog";
10806 spec
->stream_analog_playback
= &alc269_pcm_analog_playback
;
10807 spec
->stream_analog_capture
= &alc269_pcm_analog_capture
;
10809 spec
->stream_name_digital
= "ALC269 Digital";
10810 spec
->stream_digital_playback
= &alc269_pcm_digital_playback
;
10811 spec
->stream_digital_capture
= &alc269_pcm_digital_capture
;
10813 spec
->adc_nids
= alc269_adc_nids
;
10814 spec
->num_adc_nids
= ARRAY_SIZE(alc269_adc_nids
);
10815 spec
->mixers
[spec
->num_mixers
] = alc269_capture_mixer
;
10816 spec
->num_mixers
++;
10818 codec
->patch_ops
= alc_patch_ops
;
10819 if (board_config
== ALC269_AUTO
)
10820 spec
->init_hook
= alc269_auto_init
;
10821 #ifdef CONFIG_SND_HDA_POWER_SAVE
10822 if (!spec
->loopback
.amplist
)
10823 spec
->loopback
.amplist
= alc269_loopbacks
;
10830 * ALC861 channel source setting (2/6 channel selection for 3-stack)
10834 * set the path ways for 2 channel output
10835 * need to set the codec line out and mic 1 pin widgets to inputs
10837 static struct hda_verb alc861_threestack_ch2_init
[] = {
10838 /* set pin widget 1Ah (line in) for input */
10839 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
10840 /* set pin widget 18h (mic1/2) for input, for mic also enable
10843 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
10845 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
10847 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
10848 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
10854 * need to set the codec line out and mic 1 pin widgets to outputs
10856 static struct hda_verb alc861_threestack_ch6_init
[] = {
10857 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10858 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
10859 /* set pin widget 18h (mic1) for output (CLFE)*/
10860 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
10862 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
10863 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
10865 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
10867 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
10868 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
10873 static struct hda_channel_mode alc861_threestack_modes
[2] = {
10874 { 2, alc861_threestack_ch2_init
},
10875 { 6, alc861_threestack_ch6_init
},
10877 /* Set mic1 as input and unmute the mixer */
10878 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
10879 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
10880 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
10883 /* Set mic1 as output and mute mixer */
10884 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
10885 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
10886 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
10890 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
10891 { 2, alc861_uniwill_m31_ch2_init
},
10892 { 4, alc861_uniwill_m31_ch4_init
},
10895 /* Set mic1 and line-in as input and unmute the mixer */
10896 static struct hda_verb alc861_asus_ch2_init
[] = {
10897 /* set pin widget 1Ah (line in) for input */
10898 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
10899 /* set pin widget 18h (mic1/2) for input, for mic also enable
10902 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
10904 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
10906 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
10907 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
10911 /* Set mic1 nad line-in as output and mute mixer */
10912 static struct hda_verb alc861_asus_ch6_init
[] = {
10913 /* set pin widget 1Ah (line in) for output (Back Surround)*/
10914 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
10915 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10916 /* set pin widget 18h (mic1) for output (CLFE)*/
10917 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
10918 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
10919 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
10920 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
10922 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
10924 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
10925 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
10930 static struct hda_channel_mode alc861_asus_modes
[2] = {
10931 { 2, alc861_asus_ch2_init
},
10932 { 6, alc861_asus_ch6_init
},
10937 static struct snd_kcontrol_new alc861_base_mixer
[] = {
10938 /* output mixer control */
10939 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
10940 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
10941 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
10942 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
10943 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
10945 /*Input mixer control */
10946 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10947 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10948 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
10949 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
10950 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
10951 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
10952 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
10953 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
10954 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
10955 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
10957 /* Capture mixer control */
10958 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
10959 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
10961 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10962 .name
= "Capture Source",
10964 .info
= alc_mux_enum_info
,
10965 .get
= alc_mux_enum_get
,
10966 .put
= alc_mux_enum_put
,
10971 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
10972 /* output mixer control */
10973 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
10974 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
10975 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
10976 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
10977 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
10979 /* Input mixer control */
10980 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
10981 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
10982 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
10983 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
10984 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
10985 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
10986 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
10987 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
10988 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
10989 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
10991 /* Capture mixer control */
10992 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
10993 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
10995 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
10996 .name
= "Capture Source",
10998 .info
= alc_mux_enum_info
,
10999 .get
= alc_mux_enum_get
,
11000 .put
= alc_mux_enum_put
,
11003 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11004 .name
= "Channel Mode",
11005 .info
= alc_ch_mode_info
,
11006 .get
= alc_ch_mode_get
,
11007 .put
= alc_ch_mode_put
,
11008 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
11013 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
11014 /* output mixer control */
11015 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11016 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11017 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11019 /*Capture mixer control */
11020 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11021 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11023 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11024 .name
= "Capture Source",
11026 .info
= alc_mux_enum_info
,
11027 .get
= alc_mux_enum_get
,
11028 .put
= alc_mux_enum_put
,
11034 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
11035 /* output mixer control */
11036 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11037 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11038 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11039 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11040 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
11042 /* Input mixer control */
11043 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
11044 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
11045 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11046 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11047 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11048 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11050 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11051 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11052 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
11054 /* Capture mixer control */
11055 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11056 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11058 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11059 .name
= "Capture Source",
11061 .info
= alc_mux_enum_info
,
11062 .get
= alc_mux_enum_get
,
11063 .put
= alc_mux_enum_put
,
11066 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11067 .name
= "Channel Mode",
11068 .info
= alc_ch_mode_info
,
11069 .get
= alc_ch_mode_get
,
11070 .put
= alc_ch_mode_put
,
11071 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
11076 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
11077 /* output mixer control */
11078 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
11079 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
11080 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
11081 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
11082 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
11084 /* Input mixer control */
11085 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
11086 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
11087 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11088 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11089 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
11090 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
11091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
11092 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
11093 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
11094 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
),
11096 /* Capture mixer control */
11097 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11098 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11100 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11101 .name
= "Capture Source",
11103 .info
= alc_mux_enum_info
,
11104 .get
= alc_mux_enum_get
,
11105 .put
= alc_mux_enum_put
,
11108 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11109 .name
= "Channel Mode",
11110 .info
= alc_ch_mode_info
,
11111 .get
= alc_ch_mode_get
,
11112 .put
= alc_ch_mode_put
,
11113 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
11118 /* additional mixer */
11119 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
11120 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
11121 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
11122 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT
),
11123 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT
),
11128 * generic initialization of ADC, input mixers and output mixers
11130 static struct hda_verb alc861_base_init_verbs
[] = {
11132 * Unmute ADC0 and set the default input to mic-in
11134 /* port-A for surround (rear panel) */
11135 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11136 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11137 /* port-B for mic-in (rear panel) with vref */
11138 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11139 /* port-C for line-in (rear panel) */
11140 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11141 /* port-D for Front */
11142 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11143 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11144 /* port-E for HP out (front panel) */
11145 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
11146 /* route front PCM to HP */
11147 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11148 /* port-F for mic-in (front panel) with vref */
11149 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11150 /* port-G for CLFE (rear panel) */
11151 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11152 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11153 /* port-H for side (rear panel) */
11154 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11155 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11157 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11158 /* route front mic to ADC1*/
11159 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11160 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11162 /* Unmute DAC0~3 & spdif out*/
11163 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11164 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11165 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11166 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11167 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11169 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11170 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11171 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11172 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11173 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11175 /* Unmute Stereo Mixer 15 */
11176 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11178 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
11181 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11182 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11183 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11184 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11185 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11186 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11187 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11188 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11189 /* hp used DAC 3 (Front) */
11190 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11191 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11196 static struct hda_verb alc861_threestack_init_verbs
[] = {
11198 * Unmute ADC0 and set the default input to mic-in
11200 /* port-A for surround (rear panel) */
11201 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11202 /* port-B for mic-in (rear panel) with vref */
11203 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11204 /* port-C for line-in (rear panel) */
11205 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11206 /* port-D for Front */
11207 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11208 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11209 /* port-E for HP out (front panel) */
11210 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
11211 /* route front PCM to HP */
11212 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11213 /* port-F for mic-in (front panel) with vref */
11214 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11215 /* port-G for CLFE (rear panel) */
11216 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11217 /* port-H for side (rear panel) */
11218 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11220 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11221 /* route front mic to ADC1*/
11222 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11223 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11224 /* Unmute DAC0~3 & spdif out*/
11225 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11226 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11227 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11228 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11229 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11231 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11232 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11233 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11234 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11235 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11237 /* Unmute Stereo Mixer 15 */
11238 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11239 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11240 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11241 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
11243 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11244 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11245 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11246 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11247 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11248 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11249 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11250 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11251 /* hp used DAC 3 (Front) */
11252 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11253 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11257 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
11259 * Unmute ADC0 and set the default input to mic-in
11261 /* port-A for surround (rear panel) */
11262 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11263 /* port-B for mic-in (rear panel) with vref */
11264 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11265 /* port-C for line-in (rear panel) */
11266 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11267 /* port-D for Front */
11268 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11269 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11270 /* port-E for HP out (front panel) */
11271 /* this has to be set to VREF80 */
11272 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11273 /* route front PCM to HP */
11274 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11275 /* port-F for mic-in (front panel) with vref */
11276 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11277 /* port-G for CLFE (rear panel) */
11278 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11279 /* port-H for side (rear panel) */
11280 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
11282 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11283 /* route front mic to ADC1*/
11284 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11285 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11286 /* Unmute DAC0~3 & spdif out*/
11287 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11288 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11289 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11290 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11291 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11293 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11294 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11295 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11296 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11297 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11299 /* Unmute Stereo Mixer 15 */
11300 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11301 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11302 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11303 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
11305 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11306 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11307 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11308 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11309 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11310 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11311 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11312 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11313 /* hp used DAC 3 (Front) */
11314 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11315 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11319 static struct hda_verb alc861_asus_init_verbs
[] = {
11321 * Unmute ADC0 and set the default input to mic-in
11323 /* port-A for surround (rear panel)
11324 * according to codec#0 this is the HP jack
11326 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
11327 /* route front PCM to HP */
11328 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
11329 /* port-B for mic-in (rear panel) with vref */
11330 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11331 /* port-C for line-in (rear panel) */
11332 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11333 /* port-D for Front */
11334 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11335 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11336 /* port-E for HP out (front panel) */
11337 /* this has to be set to VREF80 */
11338 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11339 /* route front PCM to HP */
11340 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
11341 /* port-F for mic-in (front panel) with vref */
11342 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
11343 /* port-G for CLFE (rear panel) */
11344 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11345 /* port-H for side (rear panel) */
11346 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
11348 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
11349 /* route front mic to ADC1*/
11350 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
11351 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11352 /* Unmute DAC0~3 & spdif out*/
11353 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11354 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11355 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11356 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11357 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11358 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11359 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11360 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11361 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11362 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11364 /* Unmute Stereo Mixer 15 */
11365 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c}, /* Output 0~12 step */
11370 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11371 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11372 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11373 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11374 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11375 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11376 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11377 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11378 /* hp used DAC 3 (Front) */
11379 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11380 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11384 /* additional init verbs for ASUS laptops */
11385 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
11386 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
11387 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
11392 * generic initialization of ADC, input mixers and output mixers
11394 static struct hda_verb alc861_auto_init_verbs
[] = {
11396 * Unmute ADC0 and set the default input to mic-in
11398 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
11399 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11401 /* Unmute DAC0~3 & spdif out*/
11402 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11403 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11404 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11405 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
11406 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
11408 /* Unmute Mixer 14 (mic) 1c (Line in)*/
11409 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11410 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11411 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11412 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11414 /* Unmute Stereo Mixer 15 */
11415 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11417 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11418 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
11420 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11421 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11422 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11423 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11424 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11425 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11426 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
11427 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
11429 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11430 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11431 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11432 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11433 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
11434 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
11435 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
11436 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
11438 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* set Mic 1 */
11443 static struct hda_verb alc861_toshiba_init_verbs
[] = {
11444 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
11449 /* toggle speaker-output according to the hp-jack state */
11450 static void alc861_toshiba_automute(struct hda_codec
*codec
)
11452 unsigned int present
;
11454 present
= snd_hda_codec_read(codec
, 0x0f, 0,
11455 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
11456 snd_hda_codec_amp_stereo(codec
, 0x16, HDA_INPUT
, 0,
11457 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
11458 snd_hda_codec_amp_stereo(codec
, 0x1a, HDA_INPUT
, 3,
11459 HDA_AMP_MUTE
, present
? 0 : HDA_AMP_MUTE
);
11462 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
11465 if ((res
>> 26) == ALC880_HP_EVENT
)
11466 alc861_toshiba_automute(codec
);
11469 /* pcm configuration: identiacal with ALC880 */
11470 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
11471 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
11472 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
11473 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
11476 #define ALC861_DIGOUT_NID 0x07
11478 static struct hda_channel_mode alc861_8ch_modes
[1] = {
11482 static hda_nid_t alc861_dac_nids
[4] = {
11483 /* front, surround, clfe, side */
11484 0x03, 0x06, 0x05, 0x04
11487 static hda_nid_t alc660_dac_nids
[3] = {
11488 /* front, clfe, surround */
11492 static hda_nid_t alc861_adc_nids
[1] = {
11497 static struct hda_input_mux alc861_capture_source
= {
11501 { "Front Mic", 0x3 },
11508 /* fill in the dac_nids table from the parsed pin configuration */
11509 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
,
11510 const struct auto_pin_cfg
*cfg
)
11515 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
11516 for (i
= 0; i
< cfg
->line_outs
; i
++) {
11517 nid
= cfg
->line_out_pins
[i
];
11519 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
11521 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
11524 spec
->multiout
.num_dacs
= cfg
->line_outs
;
11528 /* add playback controls from the parsed DAC table */
11529 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
11530 const struct auto_pin_cfg
*cfg
)
11533 static const char *chname
[4] = {
11534 "Front", "Surround", NULL
/*CLFE*/, "Side"
11539 for (i
= 0; i
< cfg
->line_outs
; i
++) {
11540 nid
= spec
->multiout
.dac_nids
[i
];
11545 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
11546 "Center Playback Switch",
11547 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
11551 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
11552 "LFE Playback Switch",
11553 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
11558 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1;
11560 if (nid
== alc861_dac_nids
[idx
])
11562 sprintf(name
, "%s Playback Switch", chname
[idx
]);
11563 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
11564 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
11573 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
11581 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
11583 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
,
11584 "Headphone Playback Switch",
11585 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
11588 spec
->multiout
.hp_nid
= nid
;
11593 /* create playback/capture controls for input pins */
11594 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
,
11595 const struct auto_pin_cfg
*cfg
)
11597 struct hda_input_mux
*imux
= &spec
->private_imux
;
11598 int i
, err
, idx
, idx1
;
11600 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
11601 switch (cfg
->input_pins
[i
]) {
11604 idx
= 2; /* Line In */
11608 idx
= 2; /* Line In */
11612 idx
= 1; /* Mic In */
11616 idx
= 1; /* Mic In */
11626 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
11627 auto_pin_cfg_labels
[i
], idx
, 0x15);
11631 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
11632 imux
->items
[imux
->num_items
].index
= idx1
;
11638 static struct snd_kcontrol_new alc861_capture_mixer
[] = {
11639 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
11640 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
11643 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
11644 /* The multiple "Capture Source" controls confuse alsamixer
11645 * So call somewhat different..
11647 /* .name = "Capture Source", */
11648 .name
= "Input Source",
11650 .info
= alc_mux_enum_info
,
11651 .get
= alc_mux_enum_get
,
11652 .put
= alc_mux_enum_put
,
11657 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
,
11659 int pin_type
, int dac_idx
)
11661 alc_set_pin_output(codec
, nid
, pin_type
);
11664 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
11666 struct alc_spec
*spec
= codec
->spec
;
11669 alc_subsystem_id(codec
, 0x0e, 0x0f, 0x0b);
11670 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
11671 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
11672 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
11674 alc861_auto_set_output_and_unmute(codec
, nid
, pin_type
,
11675 spec
->multiout
.dac_nids
[i
]);
11679 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
11681 struct alc_spec
*spec
= codec
->spec
;
11684 pin
= spec
->autocfg
.hp_pins
[0];
11685 if (pin
) /* connect to front */
11686 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
,
11687 spec
->multiout
.dac_nids
[0]);
11688 pin
= spec
->autocfg
.speaker_pins
[0];
11690 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
11693 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
11695 struct alc_spec
*spec
= codec
->spec
;
11698 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
11699 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
11700 if (nid
>= 0x0c && nid
<= 0x11) {
11701 snd_hda_codec_write(codec
, nid
, 0,
11702 AC_VERB_SET_PIN_WIDGET_CONTROL
,
11703 i
<= AUTO_PIN_FRONT_MIC
?
11704 PIN_VREF80
: PIN_IN
);
11709 /* parse the BIOS configuration and set up the alc_spec */
11710 /* return 1 if successful, 0 if the proper config is not found,
11711 * or a negative error code
11713 static int alc861_parse_auto_config(struct hda_codec
*codec
)
11715 struct alc_spec
*spec
= codec
->spec
;
11717 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
11719 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
11723 if (!spec
->autocfg
.line_outs
)
11724 return 0; /* can't find valid BIOS pin config */
11726 err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
);
11729 err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
11732 err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pins
[0]);
11735 err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
11739 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
11741 if (spec
->autocfg
.dig_out_pin
)
11742 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
11744 if (spec
->kctl_alloc
)
11745 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
11747 spec
->init_verbs
[spec
->num_init_verbs
++] = alc861_auto_init_verbs
;
11749 spec
->num_mux_defs
= 1;
11750 spec
->input_mux
= &spec
->private_imux
;
11752 spec
->adc_nids
= alc861_adc_nids
;
11753 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
11754 spec
->mixers
[spec
->num_mixers
] = alc861_capture_mixer
;
11755 spec
->num_mixers
++;
11760 /* additional initialization for auto-configuration model */
11761 static void alc861_auto_init(struct hda_codec
*codec
)
11763 struct alc_spec
*spec
= codec
->spec
;
11764 alc861_auto_init_multi_out(codec
);
11765 alc861_auto_init_hp_out(codec
);
11766 alc861_auto_init_analog_input(codec
);
11767 if (spec
->unsol_event
)
11768 alc_sku_automute(codec
);
11771 #ifdef CONFIG_SND_HDA_POWER_SAVE
11772 static struct hda_amp_list alc861_loopbacks
[] = {
11773 { 0x15, HDA_INPUT
, 0 },
11774 { 0x15, HDA_INPUT
, 1 },
11775 { 0x15, HDA_INPUT
, 2 },
11776 { 0x15, HDA_INPUT
, 3 },
11783 * configuration and preset
11785 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
11786 [ALC861_3ST
] = "3stack",
11787 [ALC660_3ST
] = "3stack-660",
11788 [ALC861_3ST_DIG
] = "3stack-dig",
11789 [ALC861_6ST_DIG
] = "6stack-dig",
11790 [ALC861_UNIWILL_M31
] = "uniwill-m31",
11791 [ALC861_TOSHIBA
] = "toshiba",
11792 [ALC861_ASUS
] = "asus",
11793 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
11794 [ALC861_AUTO
] = "auto",
11797 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
11798 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST
),
11799 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
11800 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
11801 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
11802 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP
),
11803 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG
),
11804 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA
),
11805 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
11806 * Any other models that need this preset?
11808 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
11809 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST
),
11810 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST
),
11811 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31
),
11812 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
11813 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP
),
11814 /* FIXME: the below seems conflict */
11815 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
11816 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST
),
11817 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
11821 static struct alc_config_preset alc861_presets
[] = {
11823 .mixers
= { alc861_3ST_mixer
},
11824 .init_verbs
= { alc861_threestack_init_verbs
},
11825 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
11826 .dac_nids
= alc861_dac_nids
,
11827 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
11828 .channel_mode
= alc861_threestack_modes
,
11830 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
11831 .adc_nids
= alc861_adc_nids
,
11832 .input_mux
= &alc861_capture_source
,
11834 [ALC861_3ST_DIG
] = {
11835 .mixers
= { alc861_base_mixer
},
11836 .init_verbs
= { alc861_threestack_init_verbs
},
11837 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
11838 .dac_nids
= alc861_dac_nids
,
11839 .dig_out_nid
= ALC861_DIGOUT_NID
,
11840 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
11841 .channel_mode
= alc861_threestack_modes
,
11843 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
11844 .adc_nids
= alc861_adc_nids
,
11845 .input_mux
= &alc861_capture_source
,
11847 [ALC861_6ST_DIG
] = {
11848 .mixers
= { alc861_base_mixer
},
11849 .init_verbs
= { alc861_base_init_verbs
},
11850 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
11851 .dac_nids
= alc861_dac_nids
,
11852 .dig_out_nid
= ALC861_DIGOUT_NID
,
11853 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
11854 .channel_mode
= alc861_8ch_modes
,
11855 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
11856 .adc_nids
= alc861_adc_nids
,
11857 .input_mux
= &alc861_capture_source
,
11860 .mixers
= { alc861_3ST_mixer
},
11861 .init_verbs
= { alc861_threestack_init_verbs
},
11862 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
11863 .dac_nids
= alc660_dac_nids
,
11864 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
11865 .channel_mode
= alc861_threestack_modes
,
11867 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
11868 .adc_nids
= alc861_adc_nids
,
11869 .input_mux
= &alc861_capture_source
,
11871 [ALC861_UNIWILL_M31
] = {
11872 .mixers
= { alc861_uniwill_m31_mixer
},
11873 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
11874 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
11875 .dac_nids
= alc861_dac_nids
,
11876 .dig_out_nid
= ALC861_DIGOUT_NID
,
11877 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
11878 .channel_mode
= alc861_uniwill_m31_modes
,
11880 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
11881 .adc_nids
= alc861_adc_nids
,
11882 .input_mux
= &alc861_capture_source
,
11884 [ALC861_TOSHIBA
] = {
11885 .mixers
= { alc861_toshiba_mixer
},
11886 .init_verbs
= { alc861_base_init_verbs
,
11887 alc861_toshiba_init_verbs
},
11888 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
11889 .dac_nids
= alc861_dac_nids
,
11890 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
11891 .channel_mode
= alc883_3ST_2ch_modes
,
11892 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
11893 .adc_nids
= alc861_adc_nids
,
11894 .input_mux
= &alc861_capture_source
,
11895 .unsol_event
= alc861_toshiba_unsol_event
,
11896 .init_hook
= alc861_toshiba_automute
,
11899 .mixers
= { alc861_asus_mixer
},
11900 .init_verbs
= { alc861_asus_init_verbs
},
11901 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
11902 .dac_nids
= alc861_dac_nids
,
11903 .dig_out_nid
= ALC861_DIGOUT_NID
,
11904 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
11905 .channel_mode
= alc861_asus_modes
,
11908 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
11909 .adc_nids
= alc861_adc_nids
,
11910 .input_mux
= &alc861_capture_source
,
11912 [ALC861_ASUS_LAPTOP
] = {
11913 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
11914 .init_verbs
= { alc861_asus_init_verbs
,
11915 alc861_asus_laptop_init_verbs
},
11916 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
11917 .dac_nids
= alc861_dac_nids
,
11918 .dig_out_nid
= ALC861_DIGOUT_NID
,
11919 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
11920 .channel_mode
= alc883_3ST_2ch_modes
,
11922 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
11923 .adc_nids
= alc861_adc_nids
,
11924 .input_mux
= &alc861_capture_source
,
11929 static int patch_alc861(struct hda_codec
*codec
)
11931 struct alc_spec
*spec
;
11935 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
11939 codec
->spec
= spec
;
11941 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
11945 if (board_config
< 0) {
11946 printk(KERN_INFO
"hda_codec: Unknown model for ALC861, "
11947 "trying auto-probe from BIOS...\n");
11948 board_config
= ALC861_AUTO
;
11951 if (board_config
== ALC861_AUTO
) {
11952 /* automatic parse from the BIOS config */
11953 err
= alc861_parse_auto_config(codec
);
11959 "hda_codec: Cannot set up configuration "
11960 "from BIOS. Using base mode...\n");
11961 board_config
= ALC861_3ST_DIG
;
11965 if (board_config
!= ALC861_AUTO
)
11966 setup_preset(spec
, &alc861_presets
[board_config
]);
11968 spec
->stream_name_analog
= "ALC861 Analog";
11969 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
11970 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
11972 spec
->stream_name_digital
= "ALC861 Digital";
11973 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
11974 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
11976 spec
->vmaster_nid
= 0x03;
11978 codec
->patch_ops
= alc_patch_ops
;
11979 if (board_config
== ALC861_AUTO
)
11980 spec
->init_hook
= alc861_auto_init
;
11981 #ifdef CONFIG_SND_HDA_POWER_SAVE
11982 if (!spec
->loopback
.amplist
)
11983 spec
->loopback
.amplist
= alc861_loopbacks
;
11990 * ALC861-VD support
11994 * In addition, an independent DAC
11996 #define ALC861VD_DIGOUT_NID 0x06
11998 static hda_nid_t alc861vd_dac_nids
[4] = {
11999 /* front, surr, clfe, side surr */
12000 0x02, 0x03, 0x04, 0x05
12003 /* dac_nids for ALC660vd are in a different order - according to
12004 * Realtek's driver.
12005 * This should probably tesult in a different mixer for 6stack models
12006 * of ALC660vd codecs, but for now there is only 3stack mixer
12007 * - and it is the same as in 861vd.
12008 * adc_nids in ALC660vd are (is) the same as in 861vd
12010 static hda_nid_t alc660vd_dac_nids
[3] = {
12011 /* front, rear, clfe, rear_surr */
12015 static hda_nid_t alc861vd_adc_nids
[1] = {
12020 static hda_nid_t alc861vd_capsrc_nids
[1] = { 0x22 };
12023 /* FIXME: should be a matrix-type input source selection */
12024 static struct hda_input_mux alc861vd_capture_source
= {
12028 { "Front Mic", 0x1 },
12034 static struct hda_input_mux alc861vd_dallas_capture_source
= {
12037 { "Front Mic", 0x0 },
12038 { "ATAPI Mic", 0x1 },
12039 { "Line In", 0x5 },
12043 static struct hda_input_mux alc861vd_hp_capture_source
= {
12046 { "Front Mic", 0x0 },
12047 { "ATAPI Mic", 0x1 },
12051 #define alc861vd_mux_enum_info alc_mux_enum_info
12052 #define alc861vd_mux_enum_get alc_mux_enum_get
12053 /* ALC861VD has the ALC882-type input selection (but has only one ADC) */
12054 #define alc861vd_mux_enum_put alc882_mux_enum_put
12059 static struct hda_channel_mode alc861vd_3stack_2ch_modes
[1] = {
12066 static struct hda_verb alc861vd_6stack_ch6_init
[] = {
12067 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
12068 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12069 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12070 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12077 static struct hda_verb alc861vd_6stack_ch8_init
[] = {
12078 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12079 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12080 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12081 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12085 static struct hda_channel_mode alc861vd_6stack_modes
[2] = {
12086 { 6, alc861vd_6stack_ch6_init
},
12087 { 8, alc861vd_6stack_ch8_init
},
12090 static struct snd_kcontrol_new alc861vd_chmode_mixer
[] = {
12092 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12093 .name
= "Channel Mode",
12094 .info
= alc_ch_mode_info
,
12095 .get
= alc_ch_mode_get
,
12096 .put
= alc_ch_mode_put
,
12101 static struct snd_kcontrol_new alc861vd_capture_mixer
[] = {
12102 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
12103 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
12106 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
12107 /* The multiple "Capture Source" controls confuse alsamixer
12108 * So call somewhat different..
12110 /* .name = "Capture Source", */
12111 .name
= "Input Source",
12113 .info
= alc861vd_mux_enum_info
,
12114 .get
= alc861vd_mux_enum_get
,
12115 .put
= alc861vd_mux_enum_put
,
12120 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
12121 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
12123 static struct snd_kcontrol_new alc861vd_6st_mixer
[] = {
12124 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12125 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12127 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12128 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
12130 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
12132 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
12134 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
12135 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
12137 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT
),
12138 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
12140 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
12142 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12146 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12147 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12148 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12150 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
12151 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
12153 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12154 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12156 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
12157 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
12162 static struct snd_kcontrol_new alc861vd_3st_mixer
[] = {
12163 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12164 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
12168 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12170 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12172 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12173 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12174 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12176 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
12177 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
12179 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12180 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12182 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
12183 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
12188 static struct snd_kcontrol_new alc861vd_lenovo_mixer
[] = {
12189 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12190 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
12191 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
12193 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
12195 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
12196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12199 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT
),
12200 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12201 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12203 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
12204 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
12209 /* Pin assignment: Front=0x14, HP = 0x15,
12210 * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d
12212 static struct snd_kcontrol_new alc861vd_dallas_mixer
[] = {
12213 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12214 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12215 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12216 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
12217 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12218 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12219 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12220 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12221 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT
),
12222 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT
),
12226 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
12227 * Front Mic=0x18, ATAPI Mic = 0x19,
12229 static struct snd_kcontrol_new alc861vd_hp_mixer
[] = {
12230 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
12231 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
12232 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
12233 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
12234 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
12235 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
12236 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
12237 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
12243 * generic initialization of ADC, input mixers and output mixers
12245 static struct hda_verb alc861vd_volume_init_verbs
[] = {
12247 * Unmute ADC0 and set the default input to mic-in
12249 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12250 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12252 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
12253 * the analog-loopback mixer widget
12255 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12256 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12257 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12258 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12259 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12260 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12262 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
12263 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
12266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
12269 * Set up output mixers (0x02 - 0x05)
12271 /* set vol=0 to output mixers */
12272 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12273 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12274 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12275 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12277 /* set up input amps for analog loopback */
12278 /* Amp Indices: DAC = 0, mixer = 1 */
12279 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12280 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12281 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12282 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12283 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12284 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12285 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12286 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12292 * 3-stack pin configuration:
12293 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
12295 static struct hda_verb alc861vd_3stack_init_verbs
[] = {
12297 * Set pin mode and muting
12299 /* set front pin widgets 0x14 for output */
12300 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12301 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12302 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
12304 /* Mic (rear) pin: input vref at 80% */
12305 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12306 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12307 /* Front Mic pin: input vref at 80% */
12308 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12309 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12310 /* Line In pin: input */
12311 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12312 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12313 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12314 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12315 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12316 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12317 /* CD pin widget for input */
12318 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12324 * 6-stack pin configuration:
12326 static struct hda_verb alc861vd_6stack_init_verbs
[] = {
12328 * Set pin mode and muting
12330 /* set front pin widgets 0x14 for output */
12331 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12332 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12333 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
12335 /* Rear Pin: output 1 (0x0d) */
12336 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12337 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12338 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
12339 /* CLFE Pin: output 2 (0x0e) */
12340 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12341 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12342 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
12343 /* Side Pin: output 3 (0x0f) */
12344 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12345 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12346 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
12348 /* Mic (rear) pin: input vref at 80% */
12349 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12350 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12351 /* Front Mic pin: input vref at 80% */
12352 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
12353 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12354 /* Line In pin: input */
12355 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12356 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12357 /* Line-2 In: Headphone output (output 0 - 0x0c) */
12358 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
12359 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12360 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
12361 /* CD pin widget for input */
12362 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12367 static struct hda_verb alc861vd_eapd_verbs
[] = {
12368 {0x14, AC_VERB_SET_EAPD_BTLENABLE
, 2},
12372 static struct hda_verb alc861vd_lenovo_unsol_verbs
[] = {
12373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12374 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12375 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)},
12376 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12377 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
12381 /* toggle speaker-output according to the hp-jack state */
12382 static void alc861vd_lenovo_hp_automute(struct hda_codec
*codec
)
12384 unsigned int present
;
12385 unsigned char bits
;
12387 present
= snd_hda_codec_read(codec
, 0x1b, 0,
12388 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12389 bits
= present
? HDA_AMP_MUTE
: 0;
12390 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
12391 HDA_AMP_MUTE
, bits
);
12394 static void alc861vd_lenovo_mic_automute(struct hda_codec
*codec
)
12396 unsigned int present
;
12397 unsigned char bits
;
12399 present
= snd_hda_codec_read(codec
, 0x18, 0,
12400 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12401 bits
= present
? HDA_AMP_MUTE
: 0;
12402 snd_hda_codec_amp_stereo(codec
, 0x0b, HDA_INPUT
, 1,
12403 HDA_AMP_MUTE
, bits
);
12406 static void alc861vd_lenovo_automute(struct hda_codec
*codec
)
12408 alc861vd_lenovo_hp_automute(codec
);
12409 alc861vd_lenovo_mic_automute(codec
);
12412 static void alc861vd_lenovo_unsol_event(struct hda_codec
*codec
,
12415 switch (res
>> 26) {
12416 case ALC880_HP_EVENT
:
12417 alc861vd_lenovo_hp_automute(codec
);
12419 case ALC880_MIC_EVENT
:
12420 alc861vd_lenovo_mic_automute(codec
);
12425 static struct hda_verb alc861vd_dallas_verbs
[] = {
12426 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12427 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12428 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12429 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
12431 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12432 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
12433 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12434 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12436 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12437 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12438 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
12440 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12441 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12442 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12443 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12444 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12445 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12446 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
12447 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
12449 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
12450 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12451 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
12452 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
12453 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12454 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12455 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12456 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
12458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
12459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
12460 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
12461 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
12463 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
12464 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
12465 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
12470 /* toggle speaker-output according to the hp-jack state */
12471 static void alc861vd_dallas_automute(struct hda_codec
*codec
)
12473 unsigned int present
;
12475 present
= snd_hda_codec_read(codec
, 0x15, 0,
12476 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
12477 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
12478 HDA_AMP_MUTE
, present
? HDA_AMP_MUTE
: 0);
12481 static void alc861vd_dallas_unsol_event(struct hda_codec
*codec
, unsigned int res
)
12483 if ((res
>> 26) == ALC880_HP_EVENT
)
12484 alc861vd_dallas_automute(codec
);
12487 #ifdef CONFIG_SND_HDA_POWER_SAVE
12488 #define alc861vd_loopbacks alc880_loopbacks
12491 /* pcm configuration: identiacal with ALC880 */
12492 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
12493 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
12494 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
12495 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
12498 * configuration and preset
12500 static const char *alc861vd_models
[ALC861VD_MODEL_LAST
] = {
12501 [ALC660VD_3ST
] = "3stack-660",
12502 [ALC660VD_3ST_DIG
] = "3stack-660-digout",
12503 [ALC861VD_3ST
] = "3stack",
12504 [ALC861VD_3ST_DIG
] = "3stack-digout",
12505 [ALC861VD_6ST_DIG
] = "6stack-digout",
12506 [ALC861VD_LENOVO
] = "lenovo",
12507 [ALC861VD_DALLAS
] = "dallas",
12508 [ALC861VD_HP
] = "hp",
12509 [ALC861VD_AUTO
] = "auto",
12512 static struct snd_pci_quirk alc861vd_cfg_tbl
[] = {
12513 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST
),
12514 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP
),
12515 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST
),
12516 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST
),
12517 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG
),
12518 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST
),
12519 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO
),
12520 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
12521 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS
),
12522 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO
),
12523 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG
),
12524 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO
),
12525 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO
),
12526 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG
),
12530 static struct alc_config_preset alc861vd_presets
[] = {
12532 .mixers
= { alc861vd_3st_mixer
},
12533 .init_verbs
= { alc861vd_volume_init_verbs
,
12534 alc861vd_3stack_init_verbs
},
12535 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
12536 .dac_nids
= alc660vd_dac_nids
,
12537 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
12538 .channel_mode
= alc861vd_3stack_2ch_modes
,
12539 .input_mux
= &alc861vd_capture_source
,
12541 [ALC660VD_3ST_DIG
] = {
12542 .mixers
= { alc861vd_3st_mixer
},
12543 .init_verbs
= { alc861vd_volume_init_verbs
,
12544 alc861vd_3stack_init_verbs
},
12545 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
12546 .dac_nids
= alc660vd_dac_nids
,
12547 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
12548 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
12549 .channel_mode
= alc861vd_3stack_2ch_modes
,
12550 .input_mux
= &alc861vd_capture_source
,
12553 .mixers
= { alc861vd_3st_mixer
},
12554 .init_verbs
= { alc861vd_volume_init_verbs
,
12555 alc861vd_3stack_init_verbs
},
12556 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
12557 .dac_nids
= alc861vd_dac_nids
,
12558 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
12559 .channel_mode
= alc861vd_3stack_2ch_modes
,
12560 .input_mux
= &alc861vd_capture_source
,
12562 [ALC861VD_3ST_DIG
] = {
12563 .mixers
= { alc861vd_3st_mixer
},
12564 .init_verbs
= { alc861vd_volume_init_verbs
,
12565 alc861vd_3stack_init_verbs
},
12566 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
12567 .dac_nids
= alc861vd_dac_nids
,
12568 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
12569 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
12570 .channel_mode
= alc861vd_3stack_2ch_modes
,
12571 .input_mux
= &alc861vd_capture_source
,
12573 [ALC861VD_6ST_DIG
] = {
12574 .mixers
= { alc861vd_6st_mixer
, alc861vd_chmode_mixer
},
12575 .init_verbs
= { alc861vd_volume_init_verbs
,
12576 alc861vd_6stack_init_verbs
},
12577 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
12578 .dac_nids
= alc861vd_dac_nids
,
12579 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
12580 .num_channel_mode
= ARRAY_SIZE(alc861vd_6stack_modes
),
12581 .channel_mode
= alc861vd_6stack_modes
,
12582 .input_mux
= &alc861vd_capture_source
,
12584 [ALC861VD_LENOVO
] = {
12585 .mixers
= { alc861vd_lenovo_mixer
},
12586 .init_verbs
= { alc861vd_volume_init_verbs
,
12587 alc861vd_3stack_init_verbs
,
12588 alc861vd_eapd_verbs
,
12589 alc861vd_lenovo_unsol_verbs
},
12590 .num_dacs
= ARRAY_SIZE(alc660vd_dac_nids
),
12591 .dac_nids
= alc660vd_dac_nids
,
12592 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
12593 .channel_mode
= alc861vd_3stack_2ch_modes
,
12594 .input_mux
= &alc861vd_capture_source
,
12595 .unsol_event
= alc861vd_lenovo_unsol_event
,
12596 .init_hook
= alc861vd_lenovo_automute
,
12598 [ALC861VD_DALLAS
] = {
12599 .mixers
= { alc861vd_dallas_mixer
},
12600 .init_verbs
= { alc861vd_dallas_verbs
},
12601 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
12602 .dac_nids
= alc861vd_dac_nids
,
12603 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
12604 .channel_mode
= alc861vd_3stack_2ch_modes
,
12605 .input_mux
= &alc861vd_dallas_capture_source
,
12606 .unsol_event
= alc861vd_dallas_unsol_event
,
12607 .init_hook
= alc861vd_dallas_automute
,
12610 .mixers
= { alc861vd_hp_mixer
},
12611 .init_verbs
= { alc861vd_dallas_verbs
, alc861vd_eapd_verbs
},
12612 .num_dacs
= ARRAY_SIZE(alc861vd_dac_nids
),
12613 .dac_nids
= alc861vd_dac_nids
,
12614 .dig_out_nid
= ALC861VD_DIGOUT_NID
,
12615 .num_channel_mode
= ARRAY_SIZE(alc861vd_3stack_2ch_modes
),
12616 .channel_mode
= alc861vd_3stack_2ch_modes
,
12617 .input_mux
= &alc861vd_hp_capture_source
,
12618 .unsol_event
= alc861vd_dallas_unsol_event
,
12619 .init_hook
= alc861vd_dallas_automute
,
12624 * BIOS auto configuration
12626 static void alc861vd_auto_set_output_and_unmute(struct hda_codec
*codec
,
12627 hda_nid_t nid
, int pin_type
, int dac_idx
)
12629 alc_set_pin_output(codec
, nid
, pin_type
);
12632 static void alc861vd_auto_init_multi_out(struct hda_codec
*codec
)
12634 struct alc_spec
*spec
= codec
->spec
;
12637 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
12638 for (i
= 0; i
<= HDA_SIDE
; i
++) {
12639 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
12640 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
12642 alc861vd_auto_set_output_and_unmute(codec
, nid
,
12648 static void alc861vd_auto_init_hp_out(struct hda_codec
*codec
)
12650 struct alc_spec
*spec
= codec
->spec
;
12653 pin
= spec
->autocfg
.hp_pins
[0];
12654 if (pin
) /* connect to front and use dac 0 */
12655 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
12656 pin
= spec
->autocfg
.speaker_pins
[0];
12658 alc861vd_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
12661 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
12662 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
12664 static void alc861vd_auto_init_analog_input(struct hda_codec
*codec
)
12666 struct alc_spec
*spec
= codec
->spec
;
12669 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
12670 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
12671 if (alc861vd_is_input_pin(nid
)) {
12672 snd_hda_codec_write(codec
, nid
, 0,
12673 AC_VERB_SET_PIN_WIDGET_CONTROL
,
12674 i
<= AUTO_PIN_FRONT_MIC
?
12675 PIN_VREF80
: PIN_IN
);
12676 if (nid
!= ALC861VD_PIN_CD_NID
)
12677 snd_hda_codec_write(codec
, nid
, 0,
12678 AC_VERB_SET_AMP_GAIN_MUTE
,
12684 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
12685 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
12687 /* add playback controls from the parsed DAC table */
12688 /* Based on ALC880 version. But ALC861VD has separate,
12689 * different NIDs for mute/unmute switch and volume control */
12690 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec
*spec
,
12691 const struct auto_pin_cfg
*cfg
)
12694 static const char *chname
[4] = {"Front", "Surround", "CLFE", "Side"};
12695 hda_nid_t nid_v
, nid_s
;
12698 for (i
= 0; i
< cfg
->line_outs
; i
++) {
12699 if (!spec
->multiout
.dac_nids
[i
])
12701 nid_v
= alc861vd_idx_to_mixer_vol(
12703 spec
->multiout
.dac_nids
[i
]));
12704 nid_s
= alc861vd_idx_to_mixer_switch(
12706 spec
->multiout
.dac_nids
[i
]));
12710 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12711 "Center Playback Volume",
12712 HDA_COMPOSE_AMP_VAL(nid_v
, 1, 0,
12716 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
12717 "LFE Playback Volume",
12718 HDA_COMPOSE_AMP_VAL(nid_v
, 2, 0,
12722 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
12723 "Center Playback Switch",
12724 HDA_COMPOSE_AMP_VAL(nid_s
, 1, 2,
12728 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
12729 "LFE Playback Switch",
12730 HDA_COMPOSE_AMP_VAL(nid_s
, 2, 2,
12735 sprintf(name
, "%s Playback Volume", chname
[i
]);
12736 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
12737 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0,
12741 sprintf(name
, "%s Playback Switch", chname
[i
]);
12742 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
12743 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2,
12752 /* add playback controls for speaker and HP outputs */
12753 /* Based on ALC880 version. But ALC861VD has separate,
12754 * different NIDs for mute/unmute switch and volume control */
12755 static int alc861vd_auto_create_extra_out(struct alc_spec
*spec
,
12756 hda_nid_t pin
, const char *pfx
)
12758 hda_nid_t nid_v
, nid_s
;
12765 if (alc880_is_fixed_pin(pin
)) {
12766 nid_v
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
12767 /* specify the DAC as the extra output */
12768 if (!spec
->multiout
.hp_nid
)
12769 spec
->multiout
.hp_nid
= nid_v
;
12771 spec
->multiout
.extra_out_nid
[0] = nid_v
;
12772 /* control HP volume/switch on the output mixer amp */
12773 nid_v
= alc861vd_idx_to_mixer_vol(
12774 alc880_fixed_pin_idx(pin
));
12775 nid_s
= alc861vd_idx_to_mixer_switch(
12776 alc880_fixed_pin_idx(pin
));
12778 sprintf(name
, "%s Playback Volume", pfx
);
12779 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
12780 HDA_COMPOSE_AMP_VAL(nid_v
, 3, 0, HDA_OUTPUT
));
12783 sprintf(name
, "%s Playback Switch", pfx
);
12784 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
12785 HDA_COMPOSE_AMP_VAL(nid_s
, 3, 2, HDA_INPUT
));
12788 } else if (alc880_is_multi_pin(pin
)) {
12789 /* set manual connection */
12790 /* we have only a switch on HP-out PIN */
12791 sprintf(name
, "%s Playback Switch", pfx
);
12792 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
12793 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
12800 /* parse the BIOS configuration and set up the alc_spec
12801 * return 1 if successful, 0 if the proper config is not found,
12802 * or a negative error code
12803 * Based on ALC880 version - had to change it to override
12804 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
12805 static int alc861vd_parse_auto_config(struct hda_codec
*codec
)
12807 struct alc_spec
*spec
= codec
->spec
;
12809 static hda_nid_t alc861vd_ignore
[] = { 0x1d, 0 };
12811 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
12815 if (!spec
->autocfg
.line_outs
)
12816 return 0; /* can't find valid BIOS pin config */
12818 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
12821 err
= alc861vd_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
12824 err
= alc861vd_auto_create_extra_out(spec
,
12825 spec
->autocfg
.speaker_pins
[0],
12829 err
= alc861vd_auto_create_extra_out(spec
,
12830 spec
->autocfg
.hp_pins
[0],
12834 err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
12838 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
12840 if (spec
->autocfg
.dig_out_pin
)
12841 spec
->multiout
.dig_out_nid
= ALC861VD_DIGOUT_NID
;
12843 if (spec
->kctl_alloc
)
12844 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
12846 spec
->init_verbs
[spec
->num_init_verbs
++]
12847 = alc861vd_volume_init_verbs
;
12849 spec
->num_mux_defs
= 1;
12850 spec
->input_mux
= &spec
->private_imux
;
12852 err
= alc_auto_add_mic_boost(codec
);
12859 /* additional initialization for auto-configuration model */
12860 static void alc861vd_auto_init(struct hda_codec
*codec
)
12862 struct alc_spec
*spec
= codec
->spec
;
12863 alc861vd_auto_init_multi_out(codec
);
12864 alc861vd_auto_init_hp_out(codec
);
12865 alc861vd_auto_init_analog_input(codec
);
12866 if (spec
->unsol_event
)
12867 alc_sku_automute(codec
);
12870 static int patch_alc861vd(struct hda_codec
*codec
)
12872 struct alc_spec
*spec
;
12873 int err
, board_config
;
12875 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
12879 codec
->spec
= spec
;
12881 board_config
= snd_hda_check_board_config(codec
, ALC861VD_MODEL_LAST
,
12885 if (board_config
< 0 || board_config
>= ALC861VD_MODEL_LAST
) {
12886 printk(KERN_INFO
"hda_codec: Unknown model for ALC660VD/"
12887 "ALC861VD, trying auto-probe from BIOS...\n");
12888 board_config
= ALC861VD_AUTO
;
12891 if (board_config
== ALC861VD_AUTO
) {
12892 /* automatic parse from the BIOS config */
12893 err
= alc861vd_parse_auto_config(codec
);
12899 "hda_codec: Cannot set up configuration "
12900 "from BIOS. Using base mode...\n");
12901 board_config
= ALC861VD_3ST
;
12905 if (board_config
!= ALC861VD_AUTO
)
12906 setup_preset(spec
, &alc861vd_presets
[board_config
]);
12908 spec
->stream_name_analog
= "ALC861VD Analog";
12909 spec
->stream_analog_playback
= &alc861vd_pcm_analog_playback
;
12910 spec
->stream_analog_capture
= &alc861vd_pcm_analog_capture
;
12912 spec
->stream_name_digital
= "ALC861VD Digital";
12913 spec
->stream_digital_playback
= &alc861vd_pcm_digital_playback
;
12914 spec
->stream_digital_capture
= &alc861vd_pcm_digital_capture
;
12916 spec
->adc_nids
= alc861vd_adc_nids
;
12917 spec
->num_adc_nids
= ARRAY_SIZE(alc861vd_adc_nids
);
12918 spec
->capsrc_nids
= alc861vd_capsrc_nids
;
12920 spec
->mixers
[spec
->num_mixers
] = alc861vd_capture_mixer
;
12921 spec
->num_mixers
++;
12923 spec
->vmaster_nid
= 0x02;
12925 codec
->patch_ops
= alc_patch_ops
;
12927 if (board_config
== ALC861VD_AUTO
)
12928 spec
->init_hook
= alc861vd_auto_init
;
12929 #ifdef CONFIG_SND_HDA_POWER_SAVE
12930 if (!spec
->loopback
.amplist
)
12931 spec
->loopback
.amplist
= alc861vd_loopbacks
;
12940 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
12941 * configuration. Each pin widget can choose any input DACs and a mixer.
12942 * Each ADC is connected from a mixer of all inputs. This makes possible
12943 * 6-channel independent captures.
12945 * In addition, an independent DAC for the multi-playback (not used in this
12948 #define ALC662_DIGOUT_NID 0x06
12949 #define ALC662_DIGIN_NID 0x0a
12951 static hda_nid_t alc662_dac_nids
[4] = {
12952 /* front, rear, clfe, rear_surr */
12956 static hda_nid_t alc662_adc_nids
[1] = {
12961 static hda_nid_t alc662_capsrc_nids
[1] = { 0x22 };
12964 /* FIXME: should be a matrix-type input source selection */
12965 static struct hda_input_mux alc662_capture_source
= {
12969 { "Front Mic", 0x1 },
12975 static struct hda_input_mux alc662_lenovo_101e_capture_source
= {
12983 static struct hda_input_mux alc662_eeepc_capture_source
= {
12991 #define alc662_mux_enum_info alc_mux_enum_info
12992 #define alc662_mux_enum_get alc_mux_enum_get
12993 #define alc662_mux_enum_put alc882_mux_enum_put
12998 static struct hda_channel_mode alc662_3ST_2ch_modes
[1] = {
13005 static struct hda_verb alc662_3ST_ch2_init
[] = {
13006 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13007 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13008 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13009 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13016 static struct hda_verb alc662_3ST_ch6_init
[] = {
13017 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13018 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13019 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
13020 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13021 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13022 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
13026 static struct hda_channel_mode alc662_3ST_6ch_modes
[2] = {
13027 { 2, alc662_3ST_ch2_init
},
13028 { 6, alc662_3ST_ch6_init
},
13034 static struct hda_verb alc662_sixstack_ch6_init
[] = {
13035 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13036 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
13037 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13044 static struct hda_verb alc662_sixstack_ch8_init
[] = {
13045 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13046 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13047 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13051 static struct hda_channel_mode alc662_5stack_modes
[2] = {
13052 { 2, alc662_sixstack_ch6_init
},
13053 { 6, alc662_sixstack_ch8_init
},
13056 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
13057 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
13060 static struct snd_kcontrol_new alc662_base_mixer
[] = {
13061 /* output mixer control */
13062 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT
),
13063 HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT
),
13064 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT
),
13065 HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
13066 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
13067 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
13068 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT
),
13069 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT
),
13070 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13072 /*Input mixer control */
13073 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT
),
13074 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT
),
13075 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT
),
13076 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT
),
13077 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT
),
13078 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT
),
13079 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT
),
13080 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT
),
13084 static struct snd_kcontrol_new alc662_3ST_2ch_mixer
[] = {
13085 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13086 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
13087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13088 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13089 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13090 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13091 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13092 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13093 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13094 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13095 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13096 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
13097 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
13101 static struct snd_kcontrol_new alc662_3ST_6ch_mixer
[] = {
13102 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13103 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
13104 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13105 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT
),
13106 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
13107 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
13108 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT
),
13109 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT
),
13110 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13111 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
13112 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
13113 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13114 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13115 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13116 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13117 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13118 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13119 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
13120 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
13124 static struct snd_kcontrol_new alc662_lenovo_101e_mixer
[] = {
13125 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13126 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT
),
13127 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13128 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT
),
13129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13130 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13131 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13137 static struct snd_kcontrol_new alc662_eeepc_p701_mixer
[] = {
13138 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13140 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13141 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13143 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT
),
13144 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13145 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13147 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT
),
13148 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
13149 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
13153 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer
[] = {
13154 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT
),
13155 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
13156 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT
),
13157 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT
),
13158 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT
),
13159 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT
),
13160 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT
),
13161 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT
),
13162 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
13163 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT
),
13164 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
13165 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
13166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
13167 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
13171 static struct snd_kcontrol_new alc662_chmode_mixer
[] = {
13173 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13174 .name
= "Channel Mode",
13175 .info
= alc_ch_mode_info
,
13176 .get
= alc_ch_mode_get
,
13177 .put
= alc_ch_mode_put
,
13182 static struct hda_verb alc662_init_verbs
[] = {
13183 /* ADC: mute amp left and right */
13184 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13185 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
13186 /* Front mixer: unmute input/output amp left and right (volume = 0) */
13188 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13189 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13190 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13191 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13192 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
13194 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13195 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13196 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13197 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13198 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13199 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13201 /* Front Pin: output 0 (0x0c) */
13202 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13203 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13205 /* Rear Pin: output 1 (0x0d) */
13206 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13207 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13209 /* CLFE Pin: output 2 (0x0e) */
13210 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13211 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13213 /* Mic (rear) pin: input vref at 80% */
13214 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13215 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13216 /* Front Mic pin: input vref at 80% */
13217 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
13218 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13219 /* Line In pin: input */
13220 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13221 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
13222 /* Line-2 In: Headphone output (output 0 - 0x0c) */
13223 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
13224 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
13225 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
13226 /* CD pin widget for input */
13227 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
13229 /* FIXME: use matrix-type input source selection */
13230 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13232 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13233 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13234 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13235 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
13237 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13238 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13239 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
13240 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
13244 static struct hda_verb alc662_sue_init_verbs
[] = {
13245 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_FRONT_EVENT
},
13246 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
|ALC880_HP_EVENT
},
13250 static struct hda_verb alc662_eeepc_sue_init_verbs
[] = {
13251 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
13252 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13256 /* Set Unsolicited Event*/
13257 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs
[] = {
13258 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
13259 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
13264 * generic initialization of ADC, input mixers and output mixers
13266 static struct hda_verb alc662_auto_init_verbs
[] = {
13268 * Unmute ADC and set the default input to mic-in
13270 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
13271 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13273 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
13275 * Note: PASD motherboards uses the Line In 2 as the input for front
13276 * panel mic (mic 2)
13278 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13279 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
13280 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
13281 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
13282 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
13283 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
13286 * Set up output mixers (0x0c - 0x0f)
13288 /* set vol=0 to output mixers */
13289 {0x02, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13290 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13291 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
13293 /* set up input amps for analog loopback */
13294 /* Amp Indices: DAC = 0, mixer = 1 */
13295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13296 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13298 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13300 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
13303 /* FIXME: use matrix-type input source selection */
13304 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
13306 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13307 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
13311 /* capture mixer elements */
13312 static struct snd_kcontrol_new alc662_capture_mixer
[] = {
13313 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT
),
13314 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT
),
13316 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
13317 /* The multiple "Capture Source" controls confuse alsamixer
13318 * So call somewhat different..
13320 /* .name = "Capture Source", */
13321 .name
= "Input Source",
13323 .info
= alc662_mux_enum_info
,
13324 .get
= alc662_mux_enum_get
,
13325 .put
= alc662_mux_enum_put
,
13330 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec
*codec
)
13332 unsigned int present
;
13333 unsigned char bits
;
13335 present
= snd_hda_codec_read(codec
, 0x14, 0,
13336 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13337 bits
= present
? HDA_AMP_MUTE
: 0;
13338 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
13339 HDA_AMP_MUTE
, bits
);
13342 static void alc662_lenovo_101e_all_automute(struct hda_codec
*codec
)
13344 unsigned int present
;
13345 unsigned char bits
;
13347 present
= snd_hda_codec_read(codec
, 0x1b, 0,
13348 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13349 bits
= present
? HDA_AMP_MUTE
: 0;
13350 snd_hda_codec_amp_stereo(codec
, 0x15, HDA_OUTPUT
, 0,
13351 HDA_AMP_MUTE
, bits
);
13352 snd_hda_codec_amp_stereo(codec
, 0x14, HDA_OUTPUT
, 0,
13353 HDA_AMP_MUTE
, bits
);
13356 static void alc662_lenovo_101e_unsol_event(struct hda_codec
*codec
,
13359 if ((res
>> 26) == ALC880_HP_EVENT
)
13360 alc662_lenovo_101e_all_automute(codec
);
13361 if ((res
>> 26) == ALC880_FRONT_EVENT
)
13362 alc662_lenovo_101e_ispeaker_automute(codec
);
13365 static void alc662_eeepc_mic_automute(struct hda_codec
*codec
)
13367 unsigned int present
;
13369 present
= snd_hda_codec_read(codec
, 0x18, 0,
13370 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
13371 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13372 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
13373 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13374 0x7000 | (0x00 << 8) | (present
? 0 : 0x80));
13375 snd_hda_codec_write(codec
, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13376 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
13377 snd_hda_codec_write(codec
, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
13378 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
13381 /* unsolicited event for HP jack sensing */
13382 static void alc662_eeepc_unsol_event(struct hda_codec
*codec
,
13385 if ((res
>> 26) == ALC880_HP_EVENT
)
13386 alc262_hippo1_automute( codec
);
13388 if ((res
>> 26) == ALC880_MIC_EVENT
)
13389 alc662_eeepc_mic_automute(codec
);
13392 static void alc662_eeepc_inithook(struct hda_codec
*codec
)
13394 alc262_hippo1_automute( codec
);
13395 alc662_eeepc_mic_automute(codec
);
13398 static void alc662_eeepc_ep20_automute(struct hda_codec
*codec
)
13401 unsigned int present
;
13403 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
13404 present
= snd_hda_codec_read(codec
, 0x14, 0,
13405 AC_VERB_GET_PIN_SENSE
, 0);
13406 present
= (present
& 0x80000000) != 0;
13408 /* mute internal speaker */
13409 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
13410 HDA_AMP_MUTE
, HDA_AMP_MUTE
);
13412 /* unmute internal speaker if necessary */
13413 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
13414 snd_hda_codec_amp_stereo(codec
, 0x1b, HDA_OUTPUT
, 0,
13415 HDA_AMP_MUTE
, mute
);
13419 /* unsolicited event for HP jack sensing */
13420 static void alc662_eeepc_ep20_unsol_event(struct hda_codec
*codec
,
13423 if ((res
>> 26) == ALC880_HP_EVENT
)
13424 alc662_eeepc_ep20_automute(codec
);
13427 static void alc662_eeepc_ep20_inithook(struct hda_codec
*codec
)
13429 alc662_eeepc_ep20_automute(codec
);
13432 #ifdef CONFIG_SND_HDA_POWER_SAVE
13433 #define alc662_loopbacks alc880_loopbacks
13437 /* pcm configuration: identiacal with ALC880 */
13438 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
13439 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
13440 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
13441 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
13444 * configuration and preset
13446 static const char *alc662_models
[ALC662_MODEL_LAST
] = {
13447 [ALC662_3ST_2ch_DIG
] = "3stack-dig",
13448 [ALC662_3ST_6ch_DIG
] = "3stack-6ch-dig",
13449 [ALC662_3ST_6ch
] = "3stack-6ch",
13450 [ALC662_5ST_DIG
] = "6stack-dig",
13451 [ALC662_LENOVO_101E
] = "lenovo-101e",
13452 [ALC662_ASUS_EEEPC_P701
] = "eeepc-p701",
13453 [ALC662_ASUS_EEEPC_EP20
] = "eeepc-ep20",
13454 [ALC662_AUTO
] = "auto",
13457 static struct snd_pci_quirk alc662_cfg_tbl
[] = {
13458 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701
),
13459 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20
),
13460 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E
),
13464 static struct alc_config_preset alc662_presets
[] = {
13465 [ALC662_3ST_2ch_DIG
] = {
13466 .mixers
= { alc662_3ST_2ch_mixer
, alc662_capture_mixer
},
13467 .init_verbs
= { alc662_init_verbs
},
13468 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
13469 .dac_nids
= alc662_dac_nids
,
13470 .dig_out_nid
= ALC662_DIGOUT_NID
,
13471 .dig_in_nid
= ALC662_DIGIN_NID
,
13472 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
13473 .channel_mode
= alc662_3ST_2ch_modes
,
13474 .input_mux
= &alc662_capture_source
,
13476 [ALC662_3ST_6ch_DIG
] = {
13477 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
13478 alc662_capture_mixer
},
13479 .init_verbs
= { alc662_init_verbs
},
13480 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
13481 .dac_nids
= alc662_dac_nids
,
13482 .dig_out_nid
= ALC662_DIGOUT_NID
,
13483 .dig_in_nid
= ALC662_DIGIN_NID
,
13484 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
13485 .channel_mode
= alc662_3ST_6ch_modes
,
13487 .input_mux
= &alc662_capture_source
,
13489 [ALC662_3ST_6ch
] = {
13490 .mixers
= { alc662_3ST_6ch_mixer
, alc662_chmode_mixer
,
13491 alc662_capture_mixer
},
13492 .init_verbs
= { alc662_init_verbs
},
13493 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
13494 .dac_nids
= alc662_dac_nids
,
13495 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
13496 .channel_mode
= alc662_3ST_6ch_modes
,
13498 .input_mux
= &alc662_capture_source
,
13500 [ALC662_5ST_DIG
] = {
13501 .mixers
= { alc662_base_mixer
, alc662_chmode_mixer
,
13502 alc662_capture_mixer
},
13503 .init_verbs
= { alc662_init_verbs
},
13504 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
13505 .dac_nids
= alc662_dac_nids
,
13506 .dig_out_nid
= ALC662_DIGOUT_NID
,
13507 .dig_in_nid
= ALC662_DIGIN_NID
,
13508 .num_channel_mode
= ARRAY_SIZE(alc662_5stack_modes
),
13509 .channel_mode
= alc662_5stack_modes
,
13510 .input_mux
= &alc662_capture_source
,
13512 [ALC662_LENOVO_101E
] = {
13513 .mixers
= { alc662_lenovo_101e_mixer
, alc662_capture_mixer
},
13514 .init_verbs
= { alc662_init_verbs
, alc662_sue_init_verbs
},
13515 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
13516 .dac_nids
= alc662_dac_nids
,
13517 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
13518 .channel_mode
= alc662_3ST_2ch_modes
,
13519 .input_mux
= &alc662_lenovo_101e_capture_source
,
13520 .unsol_event
= alc662_lenovo_101e_unsol_event
,
13521 .init_hook
= alc662_lenovo_101e_all_automute
,
13523 [ALC662_ASUS_EEEPC_P701
] = {
13524 .mixers
= { alc662_eeepc_p701_mixer
, alc662_capture_mixer
},
13525 .init_verbs
= { alc662_init_verbs
,
13526 alc662_eeepc_sue_init_verbs
},
13527 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
13528 .dac_nids
= alc662_dac_nids
,
13529 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_2ch_modes
),
13530 .channel_mode
= alc662_3ST_2ch_modes
,
13531 .input_mux
= &alc662_eeepc_capture_source
,
13532 .unsol_event
= alc662_eeepc_unsol_event
,
13533 .init_hook
= alc662_eeepc_inithook
,
13535 [ALC662_ASUS_EEEPC_EP20
] = {
13536 .mixers
= { alc662_eeepc_ep20_mixer
, alc662_capture_mixer
,
13537 alc662_chmode_mixer
},
13538 .init_verbs
= { alc662_init_verbs
,
13539 alc662_eeepc_ep20_sue_init_verbs
},
13540 .num_dacs
= ARRAY_SIZE(alc662_dac_nids
),
13541 .dac_nids
= alc662_dac_nids
,
13542 .num_channel_mode
= ARRAY_SIZE(alc662_3ST_6ch_modes
),
13543 .channel_mode
= alc662_3ST_6ch_modes
,
13544 .input_mux
= &alc662_lenovo_101e_capture_source
,
13545 .unsol_event
= alc662_eeepc_ep20_unsol_event
,
13546 .init_hook
= alc662_eeepc_ep20_inithook
,
13553 * BIOS auto configuration
13556 /* add playback controls from the parsed DAC table */
13557 static int alc662_auto_create_multi_out_ctls(struct alc_spec
*spec
,
13558 const struct auto_pin_cfg
*cfg
)
13561 static const char *chname
[4] = {
13562 "Front", "Surround", NULL
/*CLFE*/, "Side"
13567 for (i
= 0; i
< cfg
->line_outs
; i
++) {
13568 if (!spec
->multiout
.dac_nids
[i
])
13570 nid
= alc880_idx_to_dac(i
);
13573 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13574 "Center Playback Volume",
13575 HDA_COMPOSE_AMP_VAL(nid
, 1, 0,
13579 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
,
13580 "LFE Playback Volume",
13581 HDA_COMPOSE_AMP_VAL(nid
, 2, 0,
13585 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
13586 "Center Playback Switch",
13587 HDA_COMPOSE_AMP_VAL(nid
, 1, 2,
13591 err
= add_control(spec
, ALC_CTL_BIND_MUTE
,
13592 "LFE Playback Switch",
13593 HDA_COMPOSE_AMP_VAL(nid
, 2, 2,
13598 sprintf(name
, "%s Playback Volume", chname
[i
]);
13599 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
13600 HDA_COMPOSE_AMP_VAL(nid
, 3, 0,
13604 sprintf(name
, "%s Playback Switch", chname
[i
]);
13605 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
13606 HDA_COMPOSE_AMP_VAL(nid
, 3, 2,
13615 /* add playback controls for speaker and HP outputs */
13616 static int alc662_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
13626 if (alc880_is_fixed_pin(pin
)) {
13627 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
13628 /* printk("DAC nid=%x\n",nid); */
13629 /* specify the DAC as the extra output */
13630 if (!spec
->multiout
.hp_nid
)
13631 spec
->multiout
.hp_nid
= nid
;
13633 spec
->multiout
.extra_out_nid
[0] = nid
;
13634 /* control HP volume/switch on the output mixer amp */
13635 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
13636 sprintf(name
, "%s Playback Volume", pfx
);
13637 err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
13638 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
));
13641 sprintf(name
, "%s Playback Switch", pfx
);
13642 err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
13643 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
));
13646 } else if (alc880_is_multi_pin(pin
)) {
13647 /* set manual connection */
13648 /* we have only a switch on HP-out PIN */
13649 sprintf(name
, "%s Playback Switch", pfx
);
13650 err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
13651 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
));
13658 /* create playback/capture controls for input pins */
13659 static int alc662_auto_create_analog_input_ctls(struct alc_spec
*spec
,
13660 const struct auto_pin_cfg
*cfg
)
13662 struct hda_input_mux
*imux
= &spec
->private_imux
;
13665 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
13666 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
13667 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
13668 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
13669 auto_pin_cfg_labels
[i
],
13673 imux
->items
[imux
->num_items
].label
=
13674 auto_pin_cfg_labels
[i
];
13675 imux
->items
[imux
->num_items
].index
=
13676 alc880_input_pin_idx(cfg
->input_pins
[i
]);
13683 static void alc662_auto_set_output_and_unmute(struct hda_codec
*codec
,
13684 hda_nid_t nid
, int pin_type
,
13687 alc_set_pin_output(codec
, nid
, pin_type
);
13688 /* need the manual connection? */
13689 if (alc880_is_multi_pin(nid
)) {
13690 struct alc_spec
*spec
= codec
->spec
;
13691 int idx
= alc880_multi_pin_idx(nid
);
13692 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
13693 AC_VERB_SET_CONNECT_SEL
,
13694 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
13698 static void alc662_auto_init_multi_out(struct hda_codec
*codec
)
13700 struct alc_spec
*spec
= codec
->spec
;
13703 alc_subsystem_id(codec
, 0x15, 0x1b, 0x14);
13704 for (i
= 0; i
<= HDA_SIDE
; i
++) {
13705 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
13706 int pin_type
= get_pin_type(spec
->autocfg
.line_out_type
);
13708 alc662_auto_set_output_and_unmute(codec
, nid
, pin_type
,
13713 static void alc662_auto_init_hp_out(struct hda_codec
*codec
)
13715 struct alc_spec
*spec
= codec
->spec
;
13718 pin
= spec
->autocfg
.hp_pins
[0];
13719 if (pin
) /* connect to front */
13721 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
13722 pin
= spec
->autocfg
.speaker_pins
[0];
13724 alc662_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
13727 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)
13728 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
13730 static void alc662_auto_init_analog_input(struct hda_codec
*codec
)
13732 struct alc_spec
*spec
= codec
->spec
;
13735 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
13736 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
13737 if (alc662_is_input_pin(nid
)) {
13738 snd_hda_codec_write(codec
, nid
, 0,
13739 AC_VERB_SET_PIN_WIDGET_CONTROL
,
13740 (i
<= AUTO_PIN_FRONT_MIC
?
13741 PIN_VREF80
: PIN_IN
));
13742 if (nid
!= ALC662_PIN_CD_NID
)
13743 snd_hda_codec_write(codec
, nid
, 0,
13744 AC_VERB_SET_AMP_GAIN_MUTE
,
13750 static int alc662_parse_auto_config(struct hda_codec
*codec
)
13752 struct alc_spec
*spec
= codec
->spec
;
13754 static hda_nid_t alc662_ignore
[] = { 0x1d, 0 };
13756 err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
13760 if (!spec
->autocfg
.line_outs
)
13761 return 0; /* can't find valid BIOS pin config */
13763 err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
);
13766 err
= alc662_auto_create_multi_out_ctls(spec
, &spec
->autocfg
);
13769 err
= alc662_auto_create_extra_out(spec
,
13770 spec
->autocfg
.speaker_pins
[0],
13774 err
= alc662_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
13778 err
= alc662_auto_create_analog_input_ctls(spec
, &spec
->autocfg
);
13782 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
13784 if (spec
->autocfg
.dig_out_pin
)
13785 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
13787 if (spec
->kctl_alloc
)
13788 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
13790 spec
->num_mux_defs
= 1;
13791 spec
->input_mux
= &spec
->private_imux
;
13793 spec
->init_verbs
[spec
->num_init_verbs
++] = alc662_auto_init_verbs
;
13794 spec
->mixers
[spec
->num_mixers
] = alc662_capture_mixer
;
13795 spec
->num_mixers
++;
13799 /* additional initialization for auto-configuration model */
13800 static void alc662_auto_init(struct hda_codec
*codec
)
13802 struct alc_spec
*spec
= codec
->spec
;
13803 alc662_auto_init_multi_out(codec
);
13804 alc662_auto_init_hp_out(codec
);
13805 alc662_auto_init_analog_input(codec
);
13806 if (spec
->unsol_event
)
13807 alc_sku_automute(codec
);
13810 static int patch_alc662(struct hda_codec
*codec
)
13812 struct alc_spec
*spec
;
13813 int err
, board_config
;
13815 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
13819 codec
->spec
= spec
;
13821 board_config
= snd_hda_check_board_config(codec
, ALC662_MODEL_LAST
,
13824 if (board_config
< 0) {
13825 printk(KERN_INFO
"hda_codec: Unknown model for ALC662, "
13826 "trying auto-probe from BIOS...\n");
13827 board_config
= ALC662_AUTO
;
13830 if (board_config
== ALC662_AUTO
) {
13831 /* automatic parse from the BIOS config */
13832 err
= alc662_parse_auto_config(codec
);
13838 "hda_codec: Cannot set up configuration "
13839 "from BIOS. Using base mode...\n");
13840 board_config
= ALC662_3ST_2ch_DIG
;
13844 if (board_config
!= ALC662_AUTO
)
13845 setup_preset(spec
, &alc662_presets
[board_config
]);
13847 spec
->stream_name_analog
= "ALC662 Analog";
13848 spec
->stream_analog_playback
= &alc662_pcm_analog_playback
;
13849 spec
->stream_analog_capture
= &alc662_pcm_analog_capture
;
13851 spec
->stream_name_digital
= "ALC662 Digital";
13852 spec
->stream_digital_playback
= &alc662_pcm_digital_playback
;
13853 spec
->stream_digital_capture
= &alc662_pcm_digital_capture
;
13855 spec
->adc_nids
= alc662_adc_nids
;
13856 spec
->num_adc_nids
= ARRAY_SIZE(alc662_adc_nids
);
13857 spec
->capsrc_nids
= alc662_capsrc_nids
;
13859 spec
->vmaster_nid
= 0x02;
13861 codec
->patch_ops
= alc_patch_ops
;
13862 if (board_config
== ALC662_AUTO
)
13863 spec
->init_hook
= alc662_auto_init
;
13864 #ifdef CONFIG_SND_HDA_POWER_SAVE
13865 if (!spec
->loopback
.amplist
)
13866 spec
->loopback
.amplist
= alc662_loopbacks
;
13875 struct hda_codec_preset snd_hda_preset_realtek
[] = {
13876 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
13877 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
13878 { .id
= 0x10ec0267, .name
= "ALC267", .patch
= patch_alc268
},
13879 { .id
= 0x10ec0268, .name
= "ALC268", .patch
= patch_alc268
},
13880 { .id
= 0x10ec0269, .name
= "ALC269", .patch
= patch_alc269
},
13881 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
13882 .patch
= patch_alc861
},
13883 { .id
= 0x10ec0660, .name
= "ALC660-VD", .patch
= patch_alc861vd
},
13884 { .id
= 0x10ec0861, .name
= "ALC861", .patch
= patch_alc861
},
13885 { .id
= 0x10ec0862, .name
= "ALC861-VD", .patch
= patch_alc861vd
},
13886 { .id
= 0x10ec0662, .rev
= 0x100002, .name
= "ALC662 rev2",
13887 .patch
= patch_alc883
},
13888 { .id
= 0x10ec0662, .rev
= 0x100101, .name
= "ALC662 rev1",
13889 .patch
= patch_alc662
},
13890 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
13891 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
13892 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
13893 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
13894 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
13895 { .id
= 0x10ec0889, .name
= "ALC889", .patch
= patch_alc883
},
13896 {} /* terminator */