2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <sound/driver.h>
27 #include <linux/init.h>
28 #include <linux/delay.h>
29 #include <linux/slab.h>
30 #include <linux/pci.h>
31 #include <sound/core.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
62 #ifdef CONFIG_SND_DEBUG
66 ALC880_MODEL_LAST
/* last tag */
76 #ifdef CONFIG_SND_DEBUG
80 ALC260_MODEL_LAST
/* last tag */
92 ALC262_MODEL_LAST
/* last tag */
126 ALC883_TARGA_2ch_DIG
,
136 #define GPIO_MASK 0x03
139 /* codec parameterization */
140 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
141 unsigned int num_mixers
;
143 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
147 unsigned int num_init_verbs
;
149 char *stream_name_analog
; /* analog PCM stream */
150 struct hda_pcm_stream
*stream_analog_playback
;
151 struct hda_pcm_stream
*stream_analog_capture
;
153 char *stream_name_digital
; /* digital PCM stream */
154 struct hda_pcm_stream
*stream_digital_playback
;
155 struct hda_pcm_stream
*stream_digital_capture
;
158 struct hda_multi_out multiout
; /* playback set-up
159 * max_channels, dacs must be set
160 * dig_out_nid and hp_nid are optional
164 unsigned int num_adc_nids
;
166 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
169 unsigned int num_mux_defs
;
170 const struct hda_input_mux
*input_mux
;
171 unsigned int cur_mux
[3];
174 const struct hda_channel_mode
*channel_mode
;
175 int num_channel_mode
;
178 /* PCM information */
179 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
181 /* dynamic controls, init_verbs and input_mux */
182 struct auto_pin_cfg autocfg
;
183 unsigned int num_kctl_alloc
, num_kctl_used
;
184 struct snd_kcontrol_new
*kctl_alloc
;
185 struct hda_input_mux private_imux
;
186 hda_nid_t private_dac_nids
[5];
189 void (*init_hook
)(struct hda_codec
*codec
);
190 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
192 /* for pin sensing */
193 unsigned int sense_updated
: 1;
194 unsigned int jack_present
: 1;
198 * configuration template - to be copied to the spec instance
200 struct alc_config_preset
{
201 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
204 const struct hda_verb
*init_verbs
[5];
205 unsigned int num_dacs
;
207 hda_nid_t dig_out_nid
; /* optional */
208 hda_nid_t hp_nid
; /* optional */
209 unsigned int num_adc_nids
;
211 hda_nid_t dig_in_nid
;
212 unsigned int num_channel_mode
;
213 const struct hda_channel_mode
*channel_mode
;
215 unsigned int num_mux_defs
;
216 const struct hda_input_mux
*input_mux
;
217 void (*unsol_event
)(struct hda_codec
*, unsigned int);
218 void (*init_hook
)(struct hda_codec
*);
225 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
226 struct snd_ctl_elem_info
*uinfo
)
228 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
229 struct alc_spec
*spec
= codec
->spec
;
230 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
231 if (mux_idx
>= spec
->num_mux_defs
)
233 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
236 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
237 struct snd_ctl_elem_value
*ucontrol
)
239 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
240 struct alc_spec
*spec
= codec
->spec
;
241 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
243 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
247 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
248 struct snd_ctl_elem_value
*ucontrol
)
250 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
251 struct alc_spec
*spec
= codec
->spec
;
252 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
253 unsigned int mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
254 return snd_hda_input_mux_put(codec
, &spec
->input_mux
[mux_idx
], ucontrol
,
255 spec
->adc_nids
[adc_idx
],
256 &spec
->cur_mux
[adc_idx
]);
261 * channel mode setting
263 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
264 struct snd_ctl_elem_info
*uinfo
)
266 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
267 struct alc_spec
*spec
= codec
->spec
;
268 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
269 spec
->num_channel_mode
);
272 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
273 struct snd_ctl_elem_value
*ucontrol
)
275 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
276 struct alc_spec
*spec
= codec
->spec
;
277 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
278 spec
->num_channel_mode
,
279 spec
->multiout
.max_channels
);
282 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
283 struct snd_ctl_elem_value
*ucontrol
)
285 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
286 struct alc_spec
*spec
= codec
->spec
;
287 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
288 spec
->num_channel_mode
,
289 &spec
->multiout
.max_channels
);
290 if (err
>= 0 && spec
->need_dac_fix
)
291 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
296 * Control the mode of pin widget settings via the mixer. "pc" is used
297 * instead of "%" to avoid consequences of accidently treating the % as
298 * being part of a format specifier. Maximum allowed length of a value is
299 * 63 characters plus NULL terminator.
301 * Note: some retasking pin complexes seem to ignore requests for input
302 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
303 * are requested. Therefore order this list so that this behaviour will not
304 * cause problems when mixer clients move through the enum sequentially.
305 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
308 static char *alc_pin_mode_names
[] = {
309 "Mic 50pc bias", "Mic 80pc bias",
310 "Line in", "Line out", "Headphone out",
312 static unsigned char alc_pin_mode_values
[] = {
313 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
315 /* The control can present all 5 options, or it can limit the options based
316 * in the pin being assumed to be exclusively an input or an output pin. In
317 * addition, "input" pins may or may not process the mic bias option
318 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
319 * accept requests for bias as of chip versions up to March 2006) and/or
320 * wiring in the computer.
322 #define ALC_PIN_DIR_IN 0x00
323 #define ALC_PIN_DIR_OUT 0x01
324 #define ALC_PIN_DIR_INOUT 0x02
325 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
326 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
328 /* Info about the pin modes supported by the different pin direction modes.
329 * For each direction the minimum and maximum values are given.
331 static signed char alc_pin_mode_dir_info
[5][2] = {
332 { 0, 2 }, /* ALC_PIN_DIR_IN */
333 { 3, 4 }, /* ALC_PIN_DIR_OUT */
334 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
335 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
336 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
338 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
339 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
340 #define alc_pin_mode_n_items(_dir) \
341 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
343 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
344 struct snd_ctl_elem_info
*uinfo
)
346 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
347 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
349 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
351 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
353 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
354 item_num
= alc_pin_mode_min(dir
);
355 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
359 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
360 struct snd_ctl_elem_value
*ucontrol
)
363 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
364 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
365 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
366 long *valp
= ucontrol
->value
.integer
.value
;
367 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
368 AC_VERB_GET_PIN_WIDGET_CONTROL
,
371 /* Find enumerated value for current pinctl setting */
372 i
= alc_pin_mode_min(dir
);
373 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
375 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
379 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
380 struct snd_ctl_elem_value
*ucontrol
)
383 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
384 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
385 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
386 long val
= *ucontrol
->value
.integer
.value
;
387 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
388 AC_VERB_GET_PIN_WIDGET_CONTROL
,
391 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
392 val
= alc_pin_mode_min(dir
);
394 change
= pinctl
!= alc_pin_mode_values
[val
];
396 /* Set pin mode to that requested */
397 snd_hda_codec_write(codec
,nid
,0,AC_VERB_SET_PIN_WIDGET_CONTROL
,
398 alc_pin_mode_values
[val
]);
400 /* Also enable the retasking pin's input/output as required
401 * for the requested pin mode. Enum values of 2 or less are
404 * Dynamically switching the input/output buffers probably
405 * reduces noise slightly (particularly on input) so we'll
406 * do it. However, having both input and output buffers
407 * enabled simultaneously doesn't seem to be problematic if
408 * this turns out to be necessary in the future.
411 snd_hda_codec_write(codec
, nid
, 0,
412 AC_VERB_SET_AMP_GAIN_MUTE
,
414 snd_hda_codec_write(codec
, nid
, 0,
415 AC_VERB_SET_AMP_GAIN_MUTE
,
418 snd_hda_codec_write(codec
, nid
, 0,
419 AC_VERB_SET_AMP_GAIN_MUTE
,
421 snd_hda_codec_write(codec
, nid
, 0,
422 AC_VERB_SET_AMP_GAIN_MUTE
,
429 #define ALC_PIN_MODE(xname, nid, dir) \
430 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
431 .info = alc_pin_mode_info, \
432 .get = alc_pin_mode_get, \
433 .put = alc_pin_mode_put, \
434 .private_value = nid | (dir<<16) }
436 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
437 * together using a mask with more than one bit set. This control is
438 * currently used only by the ALC260 test model. At this stage they are not
439 * needed for any "production" models.
441 #ifdef CONFIG_SND_DEBUG
442 static int alc_gpio_data_info(struct snd_kcontrol
*kcontrol
,
443 struct snd_ctl_elem_info
*uinfo
)
445 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_BOOLEAN
;
447 uinfo
->value
.integer
.min
= 0;
448 uinfo
->value
.integer
.max
= 1;
451 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
452 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 mask
= (kcontrol
->private_value
>> 16) & 0xff;
457 long *valp
= ucontrol
->value
.integer
.value
;
458 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
459 AC_VERB_GET_GPIO_DATA
, 0x00);
461 *valp
= (val
& mask
) != 0;
464 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
465 struct snd_ctl_elem_value
*ucontrol
)
468 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
469 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
470 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
471 long val
= *ucontrol
->value
.integer
.value
;
472 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
473 AC_VERB_GET_GPIO_DATA
,
476 /* Set/unset the masked GPIO bit(s) as needed */
477 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
482 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_GPIO_DATA
, gpio_data
);
486 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
487 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
488 .info = alc_gpio_data_info, \
489 .get = alc_gpio_data_get, \
490 .put = alc_gpio_data_put, \
491 .private_value = nid | (mask<<16) }
492 #endif /* CONFIG_SND_DEBUG */
494 /* A switch control to allow the enabling of the digital IO pins on the
495 * ALC260. This is incredibly simplistic; the intention of this control is
496 * to provide something in the test model allowing digital outputs to be
497 * identified if present. If models are found which can utilise these
498 * outputs a more complete mixer control can be devised for those models if
501 #ifdef CONFIG_SND_DEBUG
502 static int alc_spdif_ctrl_info(struct snd_kcontrol
*kcontrol
,
503 struct snd_ctl_elem_info
*uinfo
)
505 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_BOOLEAN
;
507 uinfo
->value
.integer
.min
= 0;
508 uinfo
->value
.integer
.max
= 1;
511 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
512 struct snd_ctl_elem_value
*ucontrol
)
514 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
515 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
516 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
517 long *valp
= ucontrol
->value
.integer
.value
;
518 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
519 AC_VERB_GET_DIGI_CONVERT
, 0x00);
521 *valp
= (val
& mask
) != 0;
524 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
525 struct snd_ctl_elem_value
*ucontrol
)
528 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
529 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
530 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
531 long val
= *ucontrol
->value
.integer
.value
;
532 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
533 AC_VERB_GET_DIGI_CONVERT
,
536 /* Set/unset the masked control bit(s) as needed */
537 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
542 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
547 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
548 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
549 .info = alc_spdif_ctrl_info, \
550 .get = alc_spdif_ctrl_get, \
551 .put = alc_spdif_ctrl_put, \
552 .private_value = nid | (mask<<16) }
553 #endif /* CONFIG_SND_DEBUG */
556 * set up from the preset table
558 static void setup_preset(struct alc_spec
*spec
,
559 const struct alc_config_preset
*preset
)
563 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
564 spec
->mixers
[spec
->num_mixers
++] = preset
->mixers
[i
];
565 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
567 spec
->init_verbs
[spec
->num_init_verbs
++] =
568 preset
->init_verbs
[i
];
570 spec
->channel_mode
= preset
->channel_mode
;
571 spec
->num_channel_mode
= preset
->num_channel_mode
;
572 spec
->need_dac_fix
= preset
->need_dac_fix
;
574 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
576 spec
->multiout
.num_dacs
= preset
->num_dacs
;
577 spec
->multiout
.dac_nids
= preset
->dac_nids
;
578 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
579 spec
->multiout
.hp_nid
= preset
->hp_nid
;
581 spec
->num_mux_defs
= preset
->num_mux_defs
;
582 if (! spec
->num_mux_defs
)
583 spec
->num_mux_defs
= 1;
584 spec
->input_mux
= preset
->input_mux
;
586 spec
->num_adc_nids
= preset
->num_adc_nids
;
587 spec
->adc_nids
= preset
->adc_nids
;
588 spec
->dig_in_nid
= preset
->dig_in_nid
;
590 spec
->unsol_event
= preset
->unsol_event
;
591 spec
->init_hook
= preset
->init_hook
;
595 * ALC880 3-stack model
597 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
598 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
599 * F-Mic = 0x1b, HP = 0x19
602 static hda_nid_t alc880_dac_nids
[4] = {
603 /* front, rear, clfe, rear_surr */
604 0x02, 0x05, 0x04, 0x03
607 static hda_nid_t alc880_adc_nids
[3] = {
612 /* The datasheet says the node 0x07 is connected from inputs,
613 * but it shows zero connection in the real implementation on some devices.
614 * Note: this is a 915GAV bug, fixed on 915GLV
616 static hda_nid_t alc880_adc_nids_alt
[2] = {
621 #define ALC880_DIGOUT_NID 0x06
622 #define ALC880_DIGIN_NID 0x0a
624 static struct hda_input_mux alc880_capture_source
= {
628 { "Front Mic", 0x3 },
634 /* channel source setting (2/6 channel selection for 3-stack) */
636 static struct hda_verb alc880_threestack_ch2_init
[] = {
637 /* set line-in to input, mute it */
638 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
639 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
640 /* set mic-in to input vref 80%, mute it */
641 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
642 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
647 static struct hda_verb alc880_threestack_ch6_init
[] = {
648 /* set line-in to output, unmute it */
649 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
650 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
651 /* set mic-in to output, unmute it */
652 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
653 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
657 static struct hda_channel_mode alc880_threestack_modes
[2] = {
658 { 2, alc880_threestack_ch2_init
},
659 { 6, alc880_threestack_ch6_init
},
662 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
663 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
664 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
665 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
666 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
667 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
668 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
669 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
670 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
671 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
672 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
673 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
674 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
675 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
676 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
677 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
678 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
679 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
680 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
683 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
684 .name
= "Channel Mode",
685 .info
= alc_ch_mode_info
,
686 .get
= alc_ch_mode_get
,
687 .put
= alc_ch_mode_put
,
692 /* capture mixer elements */
693 static struct snd_kcontrol_new alc880_capture_mixer
[] = {
694 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
695 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
696 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
697 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
698 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
699 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
701 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
702 /* The multiple "Capture Source" controls confuse alsamixer
703 * So call somewhat different..
704 * FIXME: the controls appear in the "playback" view!
706 /* .name = "Capture Source", */
707 .name
= "Input Source",
709 .info
= alc_mux_enum_info
,
710 .get
= alc_mux_enum_get
,
711 .put
= alc_mux_enum_put
,
716 /* capture mixer elements (in case NID 0x07 not available) */
717 static struct snd_kcontrol_new alc880_capture_alt_mixer
[] = {
718 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
719 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
720 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
721 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
723 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
724 /* The multiple "Capture Source" controls confuse alsamixer
725 * So call somewhat different..
726 * FIXME: the controls appear in the "playback" view!
728 /* .name = "Capture Source", */
729 .name
= "Input Source",
731 .info
= alc_mux_enum_info
,
732 .get
= alc_mux_enum_get
,
733 .put
= alc_mux_enum_put
,
741 * ALC880 5-stack model
743 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
745 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
746 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
749 /* additional mixers to alc880_three_stack_mixer */
750 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
751 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
752 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
756 /* channel source setting (6/8 channel selection for 5-stack) */
758 static struct hda_verb alc880_fivestack_ch6_init
[] = {
759 /* set line-in to input, mute it */
760 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
761 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
766 static struct hda_verb alc880_fivestack_ch8_init
[] = {
767 /* set line-in to output, unmute it */
768 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
769 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
773 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
774 { 6, alc880_fivestack_ch6_init
},
775 { 8, alc880_fivestack_ch8_init
},
780 * ALC880 6-stack model
782 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
784 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
785 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
788 static hda_nid_t alc880_6st_dac_nids
[4] = {
789 /* front, rear, clfe, rear_surr */
790 0x02, 0x03, 0x04, 0x05
793 static struct hda_input_mux alc880_6stack_capture_source
= {
797 { "Front Mic", 0x1 },
803 /* fixed 8-channels */
804 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
808 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
809 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
810 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
811 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
812 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
813 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
814 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
815 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
816 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
817 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
818 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
819 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
820 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
821 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
822 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
823 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
824 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
825 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
826 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
827 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
828 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
830 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
831 .name
= "Channel Mode",
832 .info
= alc_ch_mode_info
,
833 .get
= alc_ch_mode_get
,
834 .put
= alc_ch_mode_put
,
843 * W810 has rear IO for:
846 * Center/LFE (DAC 04)
849 * The system also has a pair of internal speakers, and a headphone jack.
850 * These are both connected to Line2 on the codec, hence to DAC 02.
852 * There is a variable resistor to control the speaker or headphone
853 * volume. This is a hardware-only device without a software API.
855 * Plugging headphones in will disable the internal speakers. This is
856 * implemented in hardware, not via the driver using jack sense. In
857 * a similar fashion, plugging into the rear socket marked "front" will
858 * disable both the speakers and headphones.
860 * For input, there's a microphone jack, and an "audio in" jack.
861 * These may not do anything useful with this driver yet, because I
862 * haven't setup any initialization verbs for these yet...
865 static hda_nid_t alc880_w810_dac_nids
[3] = {
866 /* front, rear/surround, clfe */
870 /* fixed 6 channels */
871 static struct hda_channel_mode alc880_w810_modes
[1] = {
875 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
876 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
877 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
878 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
879 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
880 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
881 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
882 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
883 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
884 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
885 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
893 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
894 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
898 static hda_nid_t alc880_z71v_dac_nids
[1] = {
901 #define ALC880_Z71V_HP_DAC 0x03
903 /* fixed 2 channels */
904 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
908 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
909 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
910 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
911 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
912 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
913 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
914 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
915 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
916 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
925 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
926 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
929 static hda_nid_t alc880_f1734_dac_nids
[1] = {
932 #define ALC880_F1734_HP_DAC 0x02
934 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
935 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
936 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
937 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
938 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
939 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
940 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
951 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
952 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
953 * Mic = 0x18, Line = 0x1a
956 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
957 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
959 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
960 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
961 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
962 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
963 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
964 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
965 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
966 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
967 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
968 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
969 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
970 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
971 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
972 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
975 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
976 .name
= "Channel Mode",
977 .info
= alc_ch_mode_info
,
978 .get
= alc_ch_mode_get
,
979 .put
= alc_ch_mode_put
,
986 * ALC880 ASUS W1V model
988 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
989 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
990 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
993 /* additional mixers to alc880_asus_mixer */
994 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
995 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
996 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
1000 /* additional mixers to alc880_asus_mixer */
1001 static struct snd_kcontrol_new alc880_pcbeep_mixer
[] = {
1002 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1003 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1008 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
1009 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1010 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1011 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
1012 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
1013 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
1014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
1015 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
1016 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1017 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1019 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1020 /* The multiple "Capture Source" controls confuse alsamixer
1021 * So call somewhat different..
1022 * FIXME: the controls appear in the "playback" view!
1024 /* .name = "Capture Source", */
1025 .name
= "Input Source",
1027 .info
= alc_mux_enum_info
,
1028 .get
= alc_mux_enum_get
,
1029 .put
= alc_mux_enum_put
,
1035 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
1036 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1037 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT
),
1038 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1039 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1040 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1041 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1042 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1043 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1044 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1045 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1046 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1047 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1048 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1049 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1050 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1051 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1052 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1053 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1055 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1056 .name
= "Channel Mode",
1057 .info
= alc_ch_mode_info
,
1058 .get
= alc_ch_mode_get
,
1059 .put
= alc_ch_mode_put
,
1064 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
1065 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1066 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT
),
1067 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1068 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1069 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1070 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1075 * build control elements
1077 static int alc_build_controls(struct hda_codec
*codec
)
1079 struct alc_spec
*spec
= codec
->spec
;
1083 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1084 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1089 if (spec
->multiout
.dig_out_nid
) {
1090 err
= snd_hda_create_spdif_out_ctls(codec
,
1091 spec
->multiout
.dig_out_nid
);
1095 if (spec
->dig_in_nid
) {
1096 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1105 * initialize the codec volumes, etc
1109 * generic initialization of ADC, input mixers and output mixers
1111 static struct hda_verb alc880_volume_init_verbs
[] = {
1113 * Unmute ADC0-2 and set the default input to mic-in
1115 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
1116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1117 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
1118 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1119 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
1120 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1122 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1124 * Note: PASD motherboards uses the Line In 2 as the input for front
1127 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1129 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1130 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
1131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
1132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
1135 * Set up output mixers (0x0c - 0x0f)
1137 /* set vol=0 to output mixers */
1138 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1139 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1140 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1141 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1142 /* set up input amps for analog loopback */
1143 /* Amp Indices: DAC = 0, mixer = 1 */
1144 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1145 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1146 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1147 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1148 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1149 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1150 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1151 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1157 * 3-stack pin configuration:
1158 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1160 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
1162 * preset connection lists of input pins
1163 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1165 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
1166 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1167 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
1170 * Set pin mode and muting
1172 /* set front pin widgets 0x14 for output */
1173 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1174 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1175 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1176 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1177 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1178 /* Mic2 (as headphone out) for HP output */
1179 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1180 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1181 /* Line In pin widget for input */
1182 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1183 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1184 /* Line2 (as front mic) pin widget for input and vref at 80% */
1185 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1186 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1187 /* CD pin widget for input */
1188 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1194 * 5-stack pin configuration:
1195 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1196 * line-in/side = 0x1a, f-mic = 0x1b
1198 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
1200 * preset connection lists of input pins
1201 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1203 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1204 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
1207 * Set pin mode and muting
1209 /* set pin widgets 0x14-0x17 for output */
1210 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1211 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1212 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1213 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1214 /* unmute pins for output (no gain on this amp) */
1215 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1216 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1217 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1218 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1220 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1221 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1222 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1223 /* Mic2 (as headphone out) for HP output */
1224 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1225 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1226 /* Line In pin widget for input */
1227 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1228 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1229 /* Line2 (as front mic) pin widget for input and vref at 80% */
1230 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1231 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1232 /* CD pin widget for input */
1233 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1239 * W810 pin configuration:
1240 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1242 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
1243 /* hphone/speaker input selector: front DAC */
1244 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
1246 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1247 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1248 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1249 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1250 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1251 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1253 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1254 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1260 * Z71V pin configuration:
1261 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1263 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
1264 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1265 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1266 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1267 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1269 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1270 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1271 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1272 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1278 * 6-stack pin configuration:
1279 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1280 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1282 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
1283 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1285 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1286 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1287 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1288 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1289 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1290 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1291 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1292 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1294 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1295 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1296 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1297 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1298 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1299 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1300 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1301 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1302 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1308 * Uniwill pin configuration:
1309 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1312 static struct hda_verb alc880_uniwill_init_verbs
[] = {
1313 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1315 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1316 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1317 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1318 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1319 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1320 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1321 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1322 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1324 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1325 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1326 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1327 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1330 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1331 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1332 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1333 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1334 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1335 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1336 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1337 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1338 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1340 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1341 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
1348 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1350 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
1351 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1353 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1354 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1355 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1356 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1357 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1358 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1359 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1360 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1361 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1362 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1363 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1364 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1366 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1367 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1368 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1369 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1370 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1371 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1373 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1374 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
1379 /* toggle speaker-output according to the hp-jack state */
1380 static void alc880_uniwill_automute(struct hda_codec
*codec
)
1382 unsigned int present
;
1384 present
= snd_hda_codec_read(codec
, 0x14, 0,
1385 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1386 snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
1387 0x80, present
? 0x80 : 0);
1388 snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
1389 0x80, present
? 0x80 : 0);
1390 snd_hda_codec_amp_update(codec
, 0x16, 0, HDA_OUTPUT
, 0,
1391 0x80, present
? 0x80 : 0);
1392 snd_hda_codec_amp_update(codec
, 0x16, 1, HDA_OUTPUT
, 0,
1393 0x80, present
? 0x80 : 0);
1395 present
= snd_hda_codec_read(codec
, 0x18, 0,
1396 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1397 snd_hda_codec_write(codec
, 0x0b, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
1398 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
1401 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
1404 /* Looks like the unsol event is incompatible with the standard
1405 * definition. 4bit tag is placed at 28 bit!
1407 if ((res
>> 28) == ALC880_HP_EVENT
||
1408 (res
>> 28) == ALC880_MIC_EVENT
)
1409 alc880_uniwill_automute(codec
);
1412 static void alc880_uniwill_p53_hp_automute(struct hda_codec
*codec
)
1414 unsigned int present
;
1416 present
= snd_hda_codec_read(codec
, 0x14, 0,
1417 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1419 snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_INPUT
, 0,
1420 0x80, present
? 0x80 : 0);
1421 snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_INPUT
, 0,
1422 0x80, present
? 0x80 : 0);
1425 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
1427 unsigned int present
;
1429 present
= snd_hda_codec_read(codec
, 0x21, 0,
1430 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0) & 0x7f;
1432 snd_hda_codec_amp_update(codec
, 0x0c, 0, HDA_OUTPUT
, 0,
1434 snd_hda_codec_amp_update(codec
, 0x0c, 1, HDA_OUTPUT
, 0,
1437 snd_hda_codec_amp_update(codec
, 0x0d, 0, HDA_OUTPUT
, 0,
1439 snd_hda_codec_amp_update(codec
, 0x0d, 1, HDA_OUTPUT
, 0,
1443 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
1446 /* Looks like the unsol event is incompatible with the standard
1447 * definition. 4bit tag is placed at 28 bit!
1449 if ((res
>> 28) == ALC880_HP_EVENT
)
1450 alc880_uniwill_p53_hp_automute(codec
);
1451 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
1452 alc880_uniwill_p53_dcvol_automute(codec
);
1457 * F1734 pin configuration:
1458 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1460 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
1461 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1462 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1463 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
1464 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1467 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1469 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1471 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1472 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1473 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1474 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1475 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1476 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1477 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1478 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1479 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1486 * ASUS pin configuration:
1487 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1489 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
1490 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1491 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1492 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
1493 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1497 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1498 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1499 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1500 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1501 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1502 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1506 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1507 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1508 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1509 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1510 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1511 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1512 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1517 /* Enable GPIO mask and set output */
1518 static struct hda_verb alc880_gpio1_init_verbs
[] = {
1519 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
1520 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
1521 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
1526 /* Enable GPIO mask and set output */
1527 static struct hda_verb alc880_gpio2_init_verbs
[] = {
1528 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
1529 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
1530 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
1535 /* Clevo m520g init */
1536 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
1537 /* headphone output */
1538 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
1540 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1541 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1543 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1544 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1546 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1547 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1548 /* Mic1 (rear panel) */
1549 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1550 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1551 /* Mic2 (front panel) */
1552 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1553 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1555 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1556 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1557 /* change to EAPD mode */
1558 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1559 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
1564 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
1565 /* change to EAPD mode */
1566 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1567 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
1569 /* Headphone output */
1570 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1572 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1573 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
1575 /* Line In pin widget for input */
1576 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1577 /* CD pin widget for input */
1578 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1579 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1580 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1582 /* change to EAPD mode */
1583 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1584 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
1590 * LG m1 express dual
1593 * Rear Line-In/Out (blue): 0x14
1594 * Build-in Mic-In: 0x15
1596 * HP-Out (green): 0x1b
1597 * Mic-In/Out (red): 0x19
1601 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
1602 static hda_nid_t alc880_lg_dac_nids
[3] = {
1606 /* seems analog CD is not working */
1607 static struct hda_input_mux alc880_lg_capture_source
= {
1612 { "Internal Mic", 0x6 },
1616 /* 2,4,6 channel modes */
1617 static struct hda_verb alc880_lg_ch2_init
[] = {
1618 /* set line-in and mic-in to input */
1619 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1620 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1624 static struct hda_verb alc880_lg_ch4_init
[] = {
1625 /* set line-in to out and mic-in to input */
1626 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1627 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1631 static struct hda_verb alc880_lg_ch6_init
[] = {
1632 /* set line-in and mic-in to output */
1633 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1634 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1638 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
1639 { 2, alc880_lg_ch2_init
},
1640 { 4, alc880_lg_ch4_init
},
1641 { 6, alc880_lg_ch6_init
},
1644 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
1645 /* FIXME: it's not really "master" but front channels */
1646 HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1647 HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT
),
1648 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1649 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
1650 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
1651 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
1652 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
1653 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
1654 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1655 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1656 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
1657 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
1658 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
1659 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
1661 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1662 .name
= "Channel Mode",
1663 .info
= alc_ch_mode_info
,
1664 .get
= alc_ch_mode_get
,
1665 .put
= alc_ch_mode_put
,
1670 static struct hda_verb alc880_lg_init_verbs
[] = {
1671 /* set capture source to mic-in */
1672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1673 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1674 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1675 /* mute all amp mixer inputs */
1676 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
1677 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(6)},
1678 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(7)},
1679 /* line-in to input */
1680 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1681 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1683 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1684 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1686 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1687 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1688 /* mic-in to input */
1689 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
1690 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1691 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1693 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
1694 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1695 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1697 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
1701 /* toggle speaker-output according to the hp-jack state */
1702 static void alc880_lg_automute(struct hda_codec
*codec
)
1704 unsigned int present
;
1706 present
= snd_hda_codec_read(codec
, 0x1b, 0,
1707 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1708 snd_hda_codec_amp_update(codec
, 0x17, 0, HDA_OUTPUT
, 0,
1709 0x80, present
? 0x80 : 0);
1710 snd_hda_codec_amp_update(codec
, 0x17, 1, HDA_OUTPUT
, 0,
1711 0x80, present
? 0x80 : 0);
1714 static void alc880_lg_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1716 /* Looks like the unsol event is incompatible with the standard
1717 * definition. 4bit tag is placed at 28 bit!
1719 if ((res
>> 28) == 0x01)
1720 alc880_lg_automute(codec
);
1729 * Built-in Mic-In: 0x19 (?)
1734 /* seems analog CD is not working */
1735 static struct hda_input_mux alc880_lg_lw_capture_source
= {
1739 { "Internal Mic", 0x1 },
1743 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
1744 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1745 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
1746 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1747 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1748 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
1749 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
1753 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
1754 /* set capture source to mic-in */
1755 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1756 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1757 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1758 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(7)},
1760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1763 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1764 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1765 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1766 /* mic-in to input */
1767 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1768 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1770 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1771 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1773 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
1777 /* toggle speaker-output according to the hp-jack state */
1778 static void alc880_lg_lw_automute(struct hda_codec
*codec
)
1780 unsigned int present
;
1782 present
= snd_hda_codec_read(codec
, 0x1b, 0,
1783 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1784 snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
1785 0x80, present
? 0x80 : 0);
1786 snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
1787 0x80, present
? 0x80 : 0);
1790 static void alc880_lg_lw_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1792 /* Looks like the unsol event is incompatible with the standard
1793 * definition. 4bit tag is placed at 28 bit!
1795 if ((res
>> 28) == 0x01)
1796 alc880_lg_lw_automute(codec
);
1803 static int alc_init(struct hda_codec
*codec
)
1805 struct alc_spec
*spec
= codec
->spec
;
1808 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
1809 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
1811 if (spec
->init_hook
)
1812 spec
->init_hook(codec
);
1817 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1819 struct alc_spec
*spec
= codec
->spec
;
1821 if (spec
->unsol_event
)
1822 spec
->unsol_event(codec
, res
);
1829 static int alc_resume(struct hda_codec
*codec
)
1831 struct alc_spec
*spec
= codec
->spec
;
1835 for (i
= 0; i
< spec
->num_mixers
; i
++)
1836 snd_hda_resume_ctls(codec
, spec
->mixers
[i
]);
1837 if (spec
->multiout
.dig_out_nid
)
1838 snd_hda_resume_spdif_out(codec
);
1839 if (spec
->dig_in_nid
)
1840 snd_hda_resume_spdif_in(codec
);
1847 * Analog playback callbacks
1849 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
1850 struct hda_codec
*codec
,
1851 struct snd_pcm_substream
*substream
)
1853 struct alc_spec
*spec
= codec
->spec
;
1854 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
);
1857 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
1858 struct hda_codec
*codec
,
1859 unsigned int stream_tag
,
1860 unsigned int format
,
1861 struct snd_pcm_substream
*substream
)
1863 struct alc_spec
*spec
= codec
->spec
;
1864 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
1865 stream_tag
, format
, substream
);
1868 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
1869 struct hda_codec
*codec
,
1870 struct snd_pcm_substream
*substream
)
1872 struct alc_spec
*spec
= codec
->spec
;
1873 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
1879 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
1880 struct hda_codec
*codec
,
1881 struct snd_pcm_substream
*substream
)
1883 struct alc_spec
*spec
= codec
->spec
;
1884 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
1887 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
1888 struct hda_codec
*codec
,
1889 struct snd_pcm_substream
*substream
)
1891 struct alc_spec
*spec
= codec
->spec
;
1892 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
1898 static int alc880_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
1899 struct hda_codec
*codec
,
1900 unsigned int stream_tag
,
1901 unsigned int format
,
1902 struct snd_pcm_substream
*substream
)
1904 struct alc_spec
*spec
= codec
->spec
;
1906 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
1907 stream_tag
, 0, format
);
1911 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
1912 struct hda_codec
*codec
,
1913 struct snd_pcm_substream
*substream
)
1915 struct alc_spec
*spec
= codec
->spec
;
1917 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
1925 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
1929 /* NID is set in alc_build_pcms */
1931 .open
= alc880_playback_pcm_open
,
1932 .prepare
= alc880_playback_pcm_prepare
,
1933 .cleanup
= alc880_playback_pcm_cleanup
1937 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
1941 /* NID is set in alc_build_pcms */
1943 .prepare
= alc880_capture_pcm_prepare
,
1944 .cleanup
= alc880_capture_pcm_cleanup
1948 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
1952 /* NID is set in alc_build_pcms */
1954 .open
= alc880_dig_playback_pcm_open
,
1955 .close
= alc880_dig_playback_pcm_close
1959 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
1963 /* NID is set in alc_build_pcms */
1966 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
1967 static struct hda_pcm_stream alc_pcm_null_playback
= {
1973 static int alc_build_pcms(struct hda_codec
*codec
)
1975 struct alc_spec
*spec
= codec
->spec
;
1976 struct hda_pcm
*info
= spec
->pcm_rec
;
1979 codec
->num_pcms
= 1;
1980 codec
->pcm_info
= info
;
1982 info
->name
= spec
->stream_name_analog
;
1983 if (spec
->stream_analog_playback
) {
1984 snd_assert(spec
->multiout
.dac_nids
, return -EINVAL
);
1985 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
1986 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
1988 if (spec
->stream_analog_capture
) {
1989 snd_assert(spec
->adc_nids
, return -EINVAL
);
1990 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
1991 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
1994 if (spec
->channel_mode
) {
1995 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
1996 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
1997 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
1998 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
2003 /* SPDIF for stream index #1 */
2004 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2005 codec
->num_pcms
= 2;
2006 info
= spec
->pcm_rec
+ 1;
2007 info
->name
= spec
->stream_name_digital
;
2008 if (spec
->multiout
.dig_out_nid
&&
2009 spec
->stream_digital_playback
) {
2010 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
2011 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2013 if (spec
->dig_in_nid
&&
2014 spec
->stream_digital_capture
) {
2015 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
2016 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2020 /* If the use of more than one ADC is requested for the current
2021 * model, configure a second analog capture-only PCM.
2023 /* Additional Analaog capture for index #2 */
2024 if (spec
->num_adc_nids
> 1 && spec
->stream_analog_capture
&&
2026 codec
->num_pcms
= 3;
2027 info
= spec
->pcm_rec
+ 2;
2028 info
->name
= spec
->stream_name_analog
;
2029 /* No playback stream for second PCM */
2030 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = alc_pcm_null_playback
;
2031 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
2032 if (spec
->stream_analog_capture
) {
2033 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
2034 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[1];
2041 static void alc_free(struct hda_codec
*codec
)
2043 struct alc_spec
*spec
= codec
->spec
;
2049 if (spec
->kctl_alloc
) {
2050 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
2051 kfree(spec
->kctl_alloc
[i
].name
);
2052 kfree(spec
->kctl_alloc
);
2059 static struct hda_codec_ops alc_patch_ops
= {
2060 .build_controls
= alc_build_controls
,
2061 .build_pcms
= alc_build_pcms
,
2064 .unsol_event
= alc_unsol_event
,
2066 .resume
= alc_resume
,
2072 * Test configuration for debugging
2074 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2077 #ifdef CONFIG_SND_DEBUG
2078 static hda_nid_t alc880_test_dac_nids
[4] = {
2079 0x02, 0x03, 0x04, 0x05
2082 static struct hda_input_mux alc880_test_capture_source
= {
2091 { "Surround", 0x6 },
2095 static struct hda_channel_mode alc880_test_modes
[4] = {
2102 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
2103 struct snd_ctl_elem_info
*uinfo
)
2105 static char *texts
[] = {
2106 "N/A", "Line Out", "HP Out",
2107 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2109 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2111 uinfo
->value
.enumerated
.items
= 8;
2112 if (uinfo
->value
.enumerated
.item
>= 8)
2113 uinfo
->value
.enumerated
.item
= 7;
2114 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2118 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
2119 struct snd_ctl_elem_value
*ucontrol
)
2121 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2122 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2123 unsigned int pin_ctl
, item
= 0;
2125 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2126 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2127 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
2128 if (pin_ctl
& AC_PINCTL_HP_EN
)
2132 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
2133 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
2134 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
2135 case AC_PINCTL_VREF_50
: item
= 4; break;
2136 case AC_PINCTL_VREF_GRD
: item
= 5; break;
2137 case AC_PINCTL_VREF_80
: item
= 6; break;
2138 case AC_PINCTL_VREF_100
: item
= 7; break;
2141 ucontrol
->value
.enumerated
.item
[0] = item
;
2145 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
2146 struct snd_ctl_elem_value
*ucontrol
)
2148 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2149 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2150 static unsigned int ctls
[] = {
2151 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
2152 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
2153 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
2154 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
2155 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
2156 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
2158 unsigned int old_ctl
, new_ctl
;
2160 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2161 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2162 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
2163 if (old_ctl
!= new_ctl
) {
2164 snd_hda_codec_write(codec
, nid
, 0,
2165 AC_VERB_SET_PIN_WIDGET_CONTROL
, new_ctl
);
2166 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
2167 (ucontrol
->value
.enumerated
.item
[0] >= 3 ?
2174 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
2175 struct snd_ctl_elem_info
*uinfo
)
2177 static char *texts
[] = {
2178 "Front", "Surround", "CLFE", "Side"
2180 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2182 uinfo
->value
.enumerated
.items
= 4;
2183 if (uinfo
->value
.enumerated
.item
>= 4)
2184 uinfo
->value
.enumerated
.item
= 3;
2185 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2189 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
2190 struct snd_ctl_elem_value
*ucontrol
)
2192 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2193 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2196 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
2197 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
2201 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
2202 struct snd_ctl_elem_value
*ucontrol
)
2204 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2205 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2208 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
2209 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
2210 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
2211 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, sel
);
2217 #define PIN_CTL_TEST(xname,nid) { \
2218 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2220 .info = alc_test_pin_ctl_info, \
2221 .get = alc_test_pin_ctl_get, \
2222 .put = alc_test_pin_ctl_put, \
2223 .private_value = nid \
2226 #define PIN_SRC_TEST(xname,nid) { \
2227 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2229 .info = alc_test_pin_src_info, \
2230 .get = alc_test_pin_src_get, \
2231 .put = alc_test_pin_src_put, \
2232 .private_value = nid \
2235 static struct snd_kcontrol_new alc880_test_mixer
[] = {
2236 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2237 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2238 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
2239 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2240 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2241 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2242 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
2243 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2244 PIN_CTL_TEST("Front Pin Mode", 0x14),
2245 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2246 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2247 PIN_CTL_TEST("Side Pin Mode", 0x17),
2248 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2249 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2250 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2251 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2252 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2253 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2254 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2255 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2256 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2257 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2258 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2259 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2260 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
2261 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
2262 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2263 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2264 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
2265 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
2267 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2268 .name
= "Channel Mode",
2269 .info
= alc_ch_mode_info
,
2270 .get
= alc_ch_mode_get
,
2271 .put
= alc_ch_mode_put
,
2276 static struct hda_verb alc880_test_init_verbs
[] = {
2277 /* Unmute inputs of 0x0c - 0x0f */
2278 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2279 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2280 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2281 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2282 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2283 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2284 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2285 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2286 /* Vol output for 0x0c-0x0f */
2287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2288 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2289 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2290 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2291 /* Set output pins 0x14-0x17 */
2292 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2294 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2295 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2296 /* Unmute output pins 0x14-0x17 */
2297 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2298 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2299 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2300 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2301 /* Set input pins 0x18-0x1c */
2302 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2303 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2304 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2305 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2306 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2307 /* Mute input pins 0x18-0x1b */
2308 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2309 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2310 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2311 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2313 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2314 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2315 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2316 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2317 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2318 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2319 /* Analog input/passthru */
2320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
2323 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
2324 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
2332 static const char *alc880_models
[ALC880_MODEL_LAST
] = {
2333 [ALC880_3ST
] = "3stack",
2334 [ALC880_TCL_S700
] = "tcl",
2335 [ALC880_3ST_DIG
] = "3stack-digout",
2336 [ALC880_CLEVO
] = "clevo",
2337 [ALC880_5ST
] = "5stack",
2338 [ALC880_5ST_DIG
] = "5stack-digout",
2339 [ALC880_W810
] = "w810",
2340 [ALC880_Z71V
] = "z71v",
2341 [ALC880_6ST
] = "6stack",
2342 [ALC880_6ST_DIG
] = "6stack-digout",
2343 [ALC880_ASUS
] = "asus",
2344 [ALC880_ASUS_W1V
] = "asus-w1v",
2345 [ALC880_ASUS_DIG
] = "asus-dig",
2346 [ALC880_ASUS_DIG2
] = "asus-dig2",
2347 [ALC880_UNIWILL_DIG
] = "uniwill",
2348 [ALC880_F1734
] = "F1734",
2350 [ALC880_LG_LW
] = "lg-lw",
2351 #ifdef CONFIG_SND_DEBUG
2352 [ALC880_TEST
] = "test",
2354 [ALC880_AUTO
] = "auto",
2357 static struct snd_pci_quirk alc880_cfg_tbl
[] = {
2358 /* Broken BIOS configuration */
2359 SND_PCI_QUIRK(0x2668, 0x8086, NULL
, ALC880_6ST_DIG
),
2360 SND_PCI_QUIRK(0x8086, 0x2668, NULL
, ALC880_6ST_DIG
),
2362 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG
),
2363 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST
),
2364 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG
),
2365 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG
),
2366 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG
),
2367 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG
),
2368 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG
),
2369 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST
),
2371 SND_PCI_QUIRK(0x1039, 0x1234, NULL
, ALC880_6ST_DIG
),
2372 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST
),
2374 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V
),
2375 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG
),
2376 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG
),
2377 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG
),
2378 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG
),
2379 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG
),
2380 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V
),
2381 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
2382 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG
),
2383 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG
),
2384 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_5ST
),
2385 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG
),
2386 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST
),
2387 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST
),
2388 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS
),
2390 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST
),
2391 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST
),
2392 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST
),
2393 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST
),
2394 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST
),
2395 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO
),
2396 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO
),
2397 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG
),
2398 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810
),
2399 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG
),
2400 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700
),
2401 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG
),
2402 SND_PCI_QUIRK(0xe803, 0x1019, NULL
, ALC880_6ST_DIG
),
2403 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG
),
2404 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG
),
2405 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG
),
2406 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG
),
2407 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2
),
2409 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG
),
2410 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL
),
2411 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53
),
2412 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734
),
2414 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG
),
2415 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL
),
2416 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734
),
2418 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG
),
2419 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG
),
2420 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW
),
2421 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW
),
2423 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG
),
2424 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG
),
2425 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG
),
2426 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG
),
2427 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG
),
2428 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG
),
2429 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG
),
2430 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG
),
2431 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG
),
2432 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG
),
2433 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST
),
2439 * ALC880 codec presets
2441 static struct alc_config_preset alc880_presets
[] = {
2443 .mixers
= { alc880_three_stack_mixer
},
2444 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_3stack_init_verbs
},
2445 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2446 .dac_nids
= alc880_dac_nids
,
2447 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2448 .channel_mode
= alc880_threestack_modes
,
2450 .input_mux
= &alc880_capture_source
,
2452 [ALC880_3ST_DIG
] = {
2453 .mixers
= { alc880_three_stack_mixer
},
2454 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_3stack_init_verbs
},
2455 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2456 .dac_nids
= alc880_dac_nids
,
2457 .dig_out_nid
= ALC880_DIGOUT_NID
,
2458 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2459 .channel_mode
= alc880_threestack_modes
,
2461 .input_mux
= &alc880_capture_source
,
2463 [ALC880_TCL_S700
] = {
2464 .mixers
= { alc880_tcl_s700_mixer
},
2465 .init_verbs
= { alc880_volume_init_verbs
,
2466 alc880_pin_tcl_S700_init_verbs
,
2467 alc880_gpio2_init_verbs
},
2468 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2469 .dac_nids
= alc880_dac_nids
,
2471 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2472 .channel_mode
= alc880_2_jack_modes
,
2473 .input_mux
= &alc880_capture_source
,
2476 .mixers
= { alc880_three_stack_mixer
, alc880_five_stack_mixer
},
2477 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_5stack_init_verbs
},
2478 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2479 .dac_nids
= alc880_dac_nids
,
2480 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
2481 .channel_mode
= alc880_fivestack_modes
,
2482 .input_mux
= &alc880_capture_source
,
2484 [ALC880_5ST_DIG
] = {
2485 .mixers
= { alc880_three_stack_mixer
, alc880_five_stack_mixer
},
2486 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_5stack_init_verbs
},
2487 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2488 .dac_nids
= alc880_dac_nids
,
2489 .dig_out_nid
= ALC880_DIGOUT_NID
,
2490 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
2491 .channel_mode
= alc880_fivestack_modes
,
2492 .input_mux
= &alc880_capture_source
,
2495 .mixers
= { alc880_six_stack_mixer
},
2496 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_6stack_init_verbs
},
2497 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
2498 .dac_nids
= alc880_6st_dac_nids
,
2499 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
2500 .channel_mode
= alc880_sixstack_modes
,
2501 .input_mux
= &alc880_6stack_capture_source
,
2503 [ALC880_6ST_DIG
] = {
2504 .mixers
= { alc880_six_stack_mixer
},
2505 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_6stack_init_verbs
},
2506 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
2507 .dac_nids
= alc880_6st_dac_nids
,
2508 .dig_out_nid
= ALC880_DIGOUT_NID
,
2509 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
2510 .channel_mode
= alc880_sixstack_modes
,
2511 .input_mux
= &alc880_6stack_capture_source
,
2514 .mixers
= { alc880_w810_base_mixer
},
2515 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_w810_init_verbs
,
2516 alc880_gpio2_init_verbs
},
2517 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
2518 .dac_nids
= alc880_w810_dac_nids
,
2519 .dig_out_nid
= ALC880_DIGOUT_NID
,
2520 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
2521 .channel_mode
= alc880_w810_modes
,
2522 .input_mux
= &alc880_capture_source
,
2525 .mixers
= { alc880_z71v_mixer
},
2526 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_z71v_init_verbs
},
2527 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
2528 .dac_nids
= alc880_z71v_dac_nids
,
2529 .dig_out_nid
= ALC880_DIGOUT_NID
,
2531 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2532 .channel_mode
= alc880_2_jack_modes
,
2533 .input_mux
= &alc880_capture_source
,
2536 .mixers
= { alc880_f1734_mixer
},
2537 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_f1734_init_verbs
},
2538 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
2539 .dac_nids
= alc880_f1734_dac_nids
,
2541 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2542 .channel_mode
= alc880_2_jack_modes
,
2543 .input_mux
= &alc880_capture_source
,
2546 .mixers
= { alc880_asus_mixer
},
2547 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
,
2548 alc880_gpio1_init_verbs
},
2549 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2550 .dac_nids
= alc880_asus_dac_nids
,
2551 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2552 .channel_mode
= alc880_asus_modes
,
2554 .input_mux
= &alc880_capture_source
,
2556 [ALC880_ASUS_DIG
] = {
2557 .mixers
= { alc880_asus_mixer
},
2558 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
,
2559 alc880_gpio1_init_verbs
},
2560 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2561 .dac_nids
= alc880_asus_dac_nids
,
2562 .dig_out_nid
= ALC880_DIGOUT_NID
,
2563 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2564 .channel_mode
= alc880_asus_modes
,
2566 .input_mux
= &alc880_capture_source
,
2568 [ALC880_ASUS_DIG2
] = {
2569 .mixers
= { alc880_asus_mixer
},
2570 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
,
2571 alc880_gpio2_init_verbs
}, /* use GPIO2 */
2572 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2573 .dac_nids
= alc880_asus_dac_nids
,
2574 .dig_out_nid
= ALC880_DIGOUT_NID
,
2575 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2576 .channel_mode
= alc880_asus_modes
,
2578 .input_mux
= &alc880_capture_source
,
2580 [ALC880_ASUS_W1V
] = {
2581 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
2582 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
,
2583 alc880_gpio1_init_verbs
},
2584 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2585 .dac_nids
= alc880_asus_dac_nids
,
2586 .dig_out_nid
= ALC880_DIGOUT_NID
,
2587 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2588 .channel_mode
= alc880_asus_modes
,
2590 .input_mux
= &alc880_capture_source
,
2592 [ALC880_UNIWILL_DIG
] = {
2593 .mixers
= { alc880_asus_mixer
, alc880_pcbeep_mixer
},
2594 .init_verbs
= { alc880_volume_init_verbs
,
2595 alc880_pin_asus_init_verbs
},
2596 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2597 .dac_nids
= alc880_asus_dac_nids
,
2598 .dig_out_nid
= ALC880_DIGOUT_NID
,
2599 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2600 .channel_mode
= alc880_asus_modes
,
2602 .input_mux
= &alc880_capture_source
,
2604 [ALC880_UNIWILL
] = {
2605 .mixers
= { alc880_uniwill_mixer
},
2606 .init_verbs
= { alc880_volume_init_verbs
,
2607 alc880_uniwill_init_verbs
},
2608 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2609 .dac_nids
= alc880_asus_dac_nids
,
2610 .dig_out_nid
= ALC880_DIGOUT_NID
,
2611 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2612 .channel_mode
= alc880_threestack_modes
,
2614 .input_mux
= &alc880_capture_source
,
2615 .unsol_event
= alc880_uniwill_unsol_event
,
2616 .init_hook
= alc880_uniwill_automute
,
2618 [ALC880_UNIWILL_P53
] = {
2619 .mixers
= { alc880_uniwill_p53_mixer
},
2620 .init_verbs
= { alc880_volume_init_verbs
,
2621 alc880_uniwill_p53_init_verbs
},
2622 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2623 .dac_nids
= alc880_asus_dac_nids
,
2624 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
2625 .channel_mode
= alc880_w810_modes
,
2626 .input_mux
= &alc880_capture_source
,
2627 .unsol_event
= alc880_uniwill_p53_unsol_event
,
2628 .init_hook
= alc880_uniwill_p53_hp_automute
,
2631 .mixers
= { alc880_three_stack_mixer
},
2632 .init_verbs
= { alc880_volume_init_verbs
,
2633 alc880_pin_clevo_init_verbs
},
2634 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2635 .dac_nids
= alc880_dac_nids
,
2637 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2638 .channel_mode
= alc880_threestack_modes
,
2640 .input_mux
= &alc880_capture_source
,
2643 .mixers
= { alc880_lg_mixer
},
2644 .init_verbs
= { alc880_volume_init_verbs
,
2645 alc880_lg_init_verbs
},
2646 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
2647 .dac_nids
= alc880_lg_dac_nids
,
2648 .dig_out_nid
= ALC880_DIGOUT_NID
,
2649 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
2650 .channel_mode
= alc880_lg_ch_modes
,
2652 .input_mux
= &alc880_lg_capture_source
,
2653 .unsol_event
= alc880_lg_unsol_event
,
2654 .init_hook
= alc880_lg_automute
,
2657 .mixers
= { alc880_lg_lw_mixer
},
2658 .init_verbs
= { alc880_volume_init_verbs
,
2659 alc880_lg_lw_init_verbs
},
2661 .dac_nids
= alc880_dac_nids
,
2662 .dig_out_nid
= ALC880_DIGOUT_NID
,
2663 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2664 .channel_mode
= alc880_2_jack_modes
,
2665 .input_mux
= &alc880_lg_lw_capture_source
,
2666 .unsol_event
= alc880_lg_lw_unsol_event
,
2667 .init_hook
= alc880_lg_lw_automute
,
2669 #ifdef CONFIG_SND_DEBUG
2671 .mixers
= { alc880_test_mixer
},
2672 .init_verbs
= { alc880_test_init_verbs
},
2673 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
2674 .dac_nids
= alc880_test_dac_nids
,
2675 .dig_out_nid
= ALC880_DIGOUT_NID
,
2676 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
2677 .channel_mode
= alc880_test_modes
,
2678 .input_mux
= &alc880_test_capture_source
,
2684 * Automatic parse of I/O pins from the BIOS configuration
2687 #define NUM_CONTROL_ALLOC 32
2688 #define NUM_VERB_ALLOC 32
2692 ALC_CTL_WIDGET_MUTE
,
2695 static struct snd_kcontrol_new alc880_control_templates
[] = {
2696 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
2697 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
2698 HDA_BIND_MUTE(NULL
, 0, 0, 0),
2701 /* add dynamic controls */
2702 static int add_control(struct alc_spec
*spec
, int type
, const char *name
, unsigned long val
)
2704 struct snd_kcontrol_new
*knew
;
2706 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
2707 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
2709 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
); /* array + terminator */
2712 if (spec
->kctl_alloc
) {
2713 memcpy(knew
, spec
->kctl_alloc
, sizeof(*knew
) * spec
->num_kctl_alloc
);
2714 kfree(spec
->kctl_alloc
);
2716 spec
->kctl_alloc
= knew
;
2717 spec
->num_kctl_alloc
= num
;
2720 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
2721 *knew
= alc880_control_templates
[type
];
2722 knew
->name
= kstrdup(name
, GFP_KERNEL
);
2725 knew
->private_value
= val
;
2726 spec
->num_kctl_used
++;
2730 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
2731 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
2732 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
2733 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
2734 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
2735 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
2736 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
2737 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
2738 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
2739 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
2740 #define ALC880_PIN_CD_NID 0x1c
2742 /* fill in the dac_nids table from the parsed pin configuration */
2743 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
, const struct auto_pin_cfg
*cfg
)
2749 memset(assigned
, 0, sizeof(assigned
));
2750 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
2752 /* check the pins hardwired to audio widget */
2753 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2754 nid
= cfg
->line_out_pins
[i
];
2755 if (alc880_is_fixed_pin(nid
)) {
2756 int idx
= alc880_fixed_pin_idx(nid
);
2757 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
2761 /* left pins can be connect to any audio widget */
2762 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2763 nid
= cfg
->line_out_pins
[i
];
2764 if (alc880_is_fixed_pin(nid
))
2766 /* search for an empty channel */
2767 for (j
= 0; j
< cfg
->line_outs
; j
++) {
2768 if (! assigned
[j
]) {
2769 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(j
);
2775 spec
->multiout
.num_dacs
= cfg
->line_outs
;
2779 /* add playback controls from the parsed DAC table */
2780 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
2781 const struct auto_pin_cfg
*cfg
)
2784 static const char *chname
[4] = { "Front", "Surround", NULL
/*CLFE*/, "Side" };
2788 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2789 if (! spec
->multiout
.dac_nids
[i
])
2791 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
2794 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "Center Playback Volume",
2795 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
))) < 0)
2797 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "LFE Playback Volume",
2798 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
))) < 0)
2800 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, "Center Playback Switch",
2801 HDA_COMPOSE_AMP_VAL(nid
, 1, 2, HDA_INPUT
))) < 0)
2803 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, "LFE Playback Switch",
2804 HDA_COMPOSE_AMP_VAL(nid
, 2, 2, HDA_INPUT
))) < 0)
2807 sprintf(name
, "%s Playback Volume", chname
[i
]);
2808 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
2809 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
2811 sprintf(name
, "%s Playback Switch", chname
[i
]);
2812 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
2813 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
))) < 0)
2820 /* add playback controls for speaker and HP outputs */
2821 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
2831 if (alc880_is_fixed_pin(pin
)) {
2832 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
2833 /* specify the DAC as the extra output */
2834 if (! spec
->multiout
.hp_nid
)
2835 spec
->multiout
.hp_nid
= nid
;
2837 spec
->multiout
.extra_out_nid
[0] = nid
;
2838 /* control HP volume/switch on the output mixer amp */
2839 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
2840 sprintf(name
, "%s Playback Volume", pfx
);
2841 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
2842 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
2844 sprintf(name
, "%s Playback Switch", pfx
);
2845 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
2846 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
))) < 0)
2848 } else if (alc880_is_multi_pin(pin
)) {
2849 /* set manual connection */
2850 /* we have only a switch on HP-out PIN */
2851 sprintf(name
, "%s Playback Switch", pfx
);
2852 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
2853 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
))) < 0)
2859 /* create input playback/capture controls for the given pin */
2860 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
, const char *ctlname
,
2861 int idx
, hda_nid_t mix_nid
)
2866 sprintf(name
, "%s Playback Volume", ctlname
);
2867 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
2868 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
))) < 0)
2870 sprintf(name
, "%s Playback Switch", ctlname
);
2871 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
2872 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
))) < 0)
2877 /* create playback/capture controls for input pins */
2878 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
2879 const struct auto_pin_cfg
*cfg
)
2881 struct hda_input_mux
*imux
= &spec
->private_imux
;
2884 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
2885 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
2886 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
2887 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
2888 auto_pin_cfg_labels
[i
],
2892 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
2893 imux
->items
[imux
->num_items
].index
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
2900 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
2901 hda_nid_t nid
, int pin_type
,
2905 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
2906 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
2907 /* need the manual connection? */
2908 if (alc880_is_multi_pin(nid
)) {
2909 struct alc_spec
*spec
= codec
->spec
;
2910 int idx
= alc880_multi_pin_idx(nid
);
2911 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
2912 AC_VERB_SET_CONNECT_SEL
,
2913 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
2917 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
2919 struct alc_spec
*spec
= codec
->spec
;
2922 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
2923 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
2924 alc880_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, i
);
2928 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
2930 struct alc_spec
*spec
= codec
->spec
;
2933 pin
= spec
->autocfg
.speaker_pins
[0];
2934 if (pin
) /* connect to front */
2935 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
2936 pin
= spec
->autocfg
.hp_pins
[0];
2937 if (pin
) /* connect to front */
2938 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
2941 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
2943 struct alc_spec
*spec
= codec
->spec
;
2946 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
2947 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
2948 if (alc880_is_input_pin(nid
)) {
2949 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
2950 i
<= AUTO_PIN_FRONT_MIC
? PIN_VREF80
: PIN_IN
);
2951 if (nid
!= ALC880_PIN_CD_NID
)
2952 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
2958 /* parse the BIOS configuration and set up the alc_spec */
2959 /* return 1 if successful, 0 if the proper config is not found, or a negative error code */
2960 static int alc880_parse_auto_config(struct hda_codec
*codec
)
2962 struct alc_spec
*spec
= codec
->spec
;
2964 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
2966 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
2967 alc880_ignore
)) < 0)
2969 if (! spec
->autocfg
.line_outs
)
2970 return 0; /* can't find valid BIOS pin config */
2972 if ((err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
)) < 0 ||
2973 (err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0 ||
2974 (err
= alc880_auto_create_extra_out(spec
,
2975 spec
->autocfg
.speaker_pins
[0],
2977 (err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
2978 "Headphone")) < 0 ||
2979 (err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
)) < 0)
2982 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
2984 if (spec
->autocfg
.dig_out_pin
)
2985 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
2986 if (spec
->autocfg
.dig_in_pin
)
2987 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
2989 if (spec
->kctl_alloc
)
2990 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
2992 spec
->init_verbs
[spec
->num_init_verbs
++] = alc880_volume_init_verbs
;
2994 spec
->num_mux_defs
= 1;
2995 spec
->input_mux
= &spec
->private_imux
;
3000 /* additional initialization for auto-configuration model */
3001 static void alc880_auto_init(struct hda_codec
*codec
)
3003 alc880_auto_init_multi_out(codec
);
3004 alc880_auto_init_extra_out(codec
);
3005 alc880_auto_init_analog_input(codec
);
3009 * OK, here we have finally the patch for ALC880
3012 static int patch_alc880(struct hda_codec
*codec
)
3014 struct alc_spec
*spec
;
3018 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3024 board_config
= snd_hda_check_board_config(codec
, ALC880_MODEL_LAST
,
3027 if (board_config
< 0) {
3028 printk(KERN_INFO
"hda_codec: Unknown model for ALC880, "
3029 "trying auto-probe from BIOS...\n");
3030 board_config
= ALC880_AUTO
;
3033 if (board_config
== ALC880_AUTO
) {
3034 /* automatic parse from the BIOS config */
3035 err
= alc880_parse_auto_config(codec
);
3041 "hda_codec: Cannot set up configuration "
3042 "from BIOS. Using 3-stack mode...\n");
3043 board_config
= ALC880_3ST
;
3047 if (board_config
!= ALC880_AUTO
)
3048 setup_preset(spec
, &alc880_presets
[board_config
]);
3050 spec
->stream_name_analog
= "ALC880 Analog";
3051 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
3052 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
3054 spec
->stream_name_digital
= "ALC880 Digital";
3055 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
3056 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
3058 if (! spec
->adc_nids
&& spec
->input_mux
) {
3059 /* check whether NID 0x07 is valid */
3060 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
3061 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
3062 if (wcap
!= AC_WID_AUD_IN
) {
3063 spec
->adc_nids
= alc880_adc_nids_alt
;
3064 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
3065 spec
->mixers
[spec
->num_mixers
] = alc880_capture_alt_mixer
;
3068 spec
->adc_nids
= alc880_adc_nids
;
3069 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
3070 spec
->mixers
[spec
->num_mixers
] = alc880_capture_mixer
;
3075 codec
->patch_ops
= alc_patch_ops
;
3076 if (board_config
== ALC880_AUTO
)
3077 spec
->init_hook
= alc880_auto_init
;
3087 static hda_nid_t alc260_dac_nids
[1] = {
3092 static hda_nid_t alc260_adc_nids
[1] = {
3097 static hda_nid_t alc260_adc_nids_alt
[1] = {
3102 static hda_nid_t alc260_hp_adc_nids
[2] = {
3107 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3108 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3110 static hda_nid_t alc260_dual_adc_nids
[2] = {
3115 #define ALC260_DIGOUT_NID 0x03
3116 #define ALC260_DIGIN_NID 0x06
3118 static struct hda_input_mux alc260_capture_source
= {
3122 { "Front Mic", 0x1 },
3128 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3129 * headphone jack and the internal CD lines since these are the only pins at
3130 * which audio can appear. For flexibility, also allow the option of
3131 * recording the mixer output on the second ADC (ADC0 doesn't have a
3132 * connection to the mixer output).
3134 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
3138 { "Mic/Line", 0x0 },
3140 { "Headphone", 0x2 },
3146 { "Mic/Line", 0x0 },
3148 { "Headphone", 0x2 },
3155 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3156 * the Fujitsu S702x, but jacks are marked differently.
3158 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
3165 { "Headphone", 0x5 },
3174 { "Headphone", 0x6 },
3180 * This is just place-holder, so there's something for alc_build_pcms to look
3181 * at when it calculates the maximum number of channels. ALC260 has no mixer
3182 * element which allows changing the channel mode, so the verb list is
3185 static struct hda_channel_mode alc260_modes
[1] = {
3190 /* Mixer combinations
3192 * basic: base_output + input + pc_beep + capture
3193 * HP: base_output + input + capture_alt
3194 * HP_3013: hp_3013 + input + capture
3195 * fujitsu: fujitsu + capture
3196 * acer: acer + capture
3199 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
3200 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3201 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
3202 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3203 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
3204 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3205 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
3209 static struct snd_kcontrol_new alc260_input_mixer
[] = {
3210 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3211 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3212 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3213 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3214 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3215 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3216 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
3217 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
3221 static struct snd_kcontrol_new alc260_pc_beep_mixer
[] = {
3222 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT
),
3223 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT
),
3227 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
3228 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3229 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
3230 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
3231 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
3232 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3233 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
3234 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3235 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
3239 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3240 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3242 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
3243 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3244 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
3245 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3246 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3247 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3248 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
3249 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
3250 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3251 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3252 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3253 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3254 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
3258 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3259 * versions of the ALC260 don't act on requests to enable mic bias from NID
3260 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3261 * datasheet doesn't mention this restriction. At this stage it's not clear
3262 * whether this behaviour is intentional or is a hardware bug in chip
3263 * revisions available in early 2006. Therefore for now allow the
3264 * "Headphone Jack Mode" control to span all choices, but if it turns out
3265 * that the lack of mic bias for this NID is intentional we could change the
3266 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3268 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3269 * don't appear to make the mic bias available from the "line" jack, even
3270 * though the NID used for this jack (0x14) can supply it. The theory is
3271 * that perhaps Acer have included blocking capacitors between the ALC260
3272 * and the output jack. If this turns out to be the case for all such
3273 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3274 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3276 * The C20x Tablet series have a mono internal speaker which is controlled
3277 * via the chip's Mono sum widget and pin complex, so include the necessary
3278 * controls for such models. On models without a "mono speaker" the control
3279 * won't do anything.
3281 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
3282 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3283 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
3284 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
3285 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0,
3287 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2,
3289 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3290 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3291 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3292 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3293 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3294 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3295 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3296 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3297 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3298 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3302 /* capture mixer elements */
3303 static struct snd_kcontrol_new alc260_capture_mixer
[] = {
3304 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT
),
3305 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT
),
3306 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT
),
3307 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT
),
3309 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3310 /* The multiple "Capture Source" controls confuse alsamixer
3311 * So call somewhat different..
3312 * FIXME: the controls appear in the "playback" view!
3314 /* .name = "Capture Source", */
3315 .name
= "Input Source",
3317 .info
= alc_mux_enum_info
,
3318 .get
= alc_mux_enum_get
,
3319 .put
= alc_mux_enum_put
,
3324 static struct snd_kcontrol_new alc260_capture_alt_mixer
[] = {
3325 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT
),
3326 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT
),
3328 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3329 /* The multiple "Capture Source" controls confuse alsamixer
3330 * So call somewhat different..
3331 * FIXME: the controls appear in the "playback" view!
3333 /* .name = "Capture Source", */
3334 .name
= "Input Source",
3336 .info
= alc_mux_enum_info
,
3337 .get
= alc_mux_enum_get
,
3338 .put
= alc_mux_enum_put
,
3344 * initialization verbs
3346 static struct hda_verb alc260_init_verbs
[] = {
3347 /* Line In pin widget for input */
3348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3349 /* CD pin widget for input */
3350 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3351 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3352 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3353 /* Mic2 (front panel) pin widget for input and vref at 80% */
3354 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3355 /* LINE-2 is used for line-out in rear */
3356 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3357 /* select line-out */
3358 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
3360 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3362 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3364 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3365 /* mute capture amp left and right */
3366 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3367 /* set connection select to line in (default select for this ADC) */
3368 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3369 /* mute capture amp left and right */
3370 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3371 /* set connection select to line in (default select for this ADC) */
3372 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
3373 /* set vol=0 Line-Out mixer amp left and right */
3374 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3375 /* unmute pin widget amp left and right (no gain on this amp) */
3376 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3377 /* set vol=0 HP mixer amp left and right */
3378 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3379 /* unmute pin widget amp left and right (no gain on this amp) */
3380 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3381 /* set vol=0 Mono mixer amp left and right */
3382 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3383 /* unmute pin widget amp left and right (no gain on this amp) */
3384 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3385 /* unmute LINE-2 out pin */
3386 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3387 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */
3389 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
3391 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
3393 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3394 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3395 /* mute Front out path */
3396 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3397 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3398 /* mute Headphone out path */
3399 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3400 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3401 /* mute Mono out path */
3402 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3403 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3407 #if 0 /* should be identical with alc260_init_verbs? */
3408 static struct hda_verb alc260_hp_init_verbs
[] = {
3409 /* Headphone and output */
3410 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
3412 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3413 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3414 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3415 /* Mic2 (front panel) pin widget for input and vref at 80% */
3416 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3417 /* Line In pin widget for input */
3418 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3419 /* Line-2 pin widget for output */
3420 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3421 /* CD pin widget for input */
3422 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3423 /* unmute amp left and right */
3424 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
3425 /* set connection select to line in (default select for this ADC) */
3426 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3427 /* unmute Line-Out mixer amp left and right (volume = 0) */
3428 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3429 /* mute pin widget amp left and right (no gain on this amp) */
3430 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3431 /* unmute HP mixer amp left and right (volume = 0) */
3432 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3433 /* mute pin widget amp left and right (no gain on this amp) */
3434 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3435 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */
3437 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
3438 /* unmute Line In */
3439 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
3441 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3442 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3443 /* Unmute Front out path */
3444 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3446 /* Unmute Headphone out path */
3447 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3448 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3449 /* Unmute Mono out path */
3450 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3451 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3456 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
3457 /* Line out and output */
3458 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3460 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3461 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3462 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3463 /* Mic2 (front panel) pin widget for input and vref at 80% */
3464 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3465 /* Line In pin widget for input */
3466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3467 /* Headphone pin widget for output */
3468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
3469 /* CD pin widget for input */
3470 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3471 /* unmute amp left and right */
3472 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
3473 /* set connection select to line in (default select for this ADC) */
3474 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3475 /* unmute Line-Out mixer amp left and right (volume = 0) */
3476 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3477 /* mute pin widget amp left and right (no gain on this amp) */
3478 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3479 /* unmute HP mixer amp left and right (volume = 0) */
3480 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3481 /* mute pin widget amp left and right (no gain on this amp) */
3482 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3483 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */
3485 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
3486 /* unmute Line In */
3487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
3489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3490 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3491 /* Unmute Front out path */
3492 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3493 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3494 /* Unmute Headphone out path */
3495 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3496 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3497 /* Unmute Mono out path */
3498 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3499 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3503 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
3504 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
3505 * audio = 0x16, internal speaker = 0x10.
3507 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
3508 /* Disable all GPIOs */
3509 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
3510 /* Internal speaker is connected to headphone pin */
3511 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3512 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
3513 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3514 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
3515 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3516 /* Ensure all other unused pins are disabled and muted. */
3517 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3518 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3519 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3520 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3521 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3522 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3523 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3524 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3526 /* Disable digital (SPDIF) pins */
3527 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3528 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3530 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
3531 * when acting as an output.
3533 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
3535 /* Start with output sum widgets muted and their output gains at min */
3536 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3537 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3538 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3539 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3540 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3541 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3542 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3543 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3544 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3546 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
3547 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3548 /* Unmute Line1 pin widget output buffer since it starts as an output.
3549 * If the pin mode is changed by the user the pin mode control will
3550 * take care of enabling the pin's input/output buffers as needed.
3551 * Therefore there's no need to enable the input buffer at this
3554 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3555 /* Unmute input buffer of pin widget used for Line-in (no equiv
3558 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3560 /* Mute capture amp left and right */
3561 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3562 /* Set ADC connection select to match default mixer setting - line
3565 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
3567 /* Do the same for the second ADC: mute capture input amp and
3568 * set ADC connection to line in (on mic1 pin)
3570 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3571 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
3573 /* Mute all inputs to mixer widget (even unconnected ones) */
3574 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
3575 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
3576 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
3577 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
3578 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
3579 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
3581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
3586 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
3587 * similar laptops (adapted from Fujitsu init verbs).
3589 static struct hda_verb alc260_acer_init_verbs
[] = {
3590 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
3591 * the headphone jack. Turn this on and rely on the standard mute
3592 * methods whenever the user wants to turn these outputs off.
3594 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
3595 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
3596 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
3597 /* Internal speaker/Headphone jack is connected to Line-out pin */
3598 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3599 /* Internal microphone/Mic jack is connected to Mic1 pin */
3600 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
3601 /* Line In jack is connected to Line1 pin */
3602 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3603 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
3604 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3605 /* Ensure all other unused pins are disabled and muted. */
3606 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3607 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3608 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3609 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3610 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3611 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3612 /* Disable digital (SPDIF) pins */
3613 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3614 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3616 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
3617 * bus when acting as outputs.
3619 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
3620 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
3622 /* Start with output sum widgets muted and their output gains at min */
3623 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3624 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3625 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3626 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3627 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3628 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3629 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3630 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3631 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3633 /* Unmute Line-out pin widget amp left and right (no equiv mixer ctrl) */
3634 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3635 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
3636 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3637 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
3638 * inputs. If the pin mode is changed by the user the pin mode control
3639 * will take care of enabling the pin's input/output buffers as needed.
3640 * Therefore there's no need to enable the input buffer at this
3643 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3644 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3646 /* Mute capture amp left and right */
3647 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3648 /* Set ADC connection select to match default mixer setting - mic
3651 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
3653 /* Do similar with the second ADC: mute capture input amp and
3654 * set ADC connection to mic to match ALSA's default state.
3656 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3657 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
3659 /* Mute all inputs to mixer widget (even unconnected ones) */
3660 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
3661 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
3662 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
3663 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
3664 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
3665 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3666 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
3667 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
3672 /* Test configuration for debugging, modelled after the ALC880 test
3675 #ifdef CONFIG_SND_DEBUG
3676 static hda_nid_t alc260_test_dac_nids
[1] = {
3679 static hda_nid_t alc260_test_adc_nids
[2] = {
3682 /* For testing the ALC260, each input MUX needs its own definition since
3683 * the signal assignments are different. This assumes that the first ADC
3686 static struct hda_input_mux alc260_test_capture_sources
[2] = {
3690 { "MIC1 pin", 0x0 },
3691 { "MIC2 pin", 0x1 },
3692 { "LINE1 pin", 0x2 },
3693 { "LINE2 pin", 0x3 },
3695 { "LINE-OUT pin", 0x5 },
3696 { "HP-OUT pin", 0x6 },
3702 { "MIC1 pin", 0x0 },
3703 { "MIC2 pin", 0x1 },
3704 { "LINE1 pin", 0x2 },
3705 { "LINE2 pin", 0x3 },
3708 { "LINE-OUT pin", 0x6 },
3709 { "HP-OUT pin", 0x7 },
3713 static struct snd_kcontrol_new alc260_test_mixer
[] = {
3714 /* Output driver widgets */
3715 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3716 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
3717 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3718 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
3719 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3720 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
3722 /* Modes for retasking pin widgets
3723 * Note: the ALC260 doesn't seem to act on requests to enable mic
3724 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
3725 * mention this restriction. At this stage it's not clear whether
3726 * this behaviour is intentional or is a hardware bug in chip
3727 * revisions available at least up until early 2006. Therefore for
3728 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
3729 * choices, but if it turns out that the lack of mic bias for these
3730 * NIDs is intentional we could change their modes from
3731 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3733 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
3734 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
3735 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
3736 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
3737 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
3738 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
3740 /* Loopback mixer controls */
3741 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
3742 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
3743 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
3744 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
3745 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
3746 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
3747 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
3748 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
3749 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3750 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3751 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3752 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3753 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
3754 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
3755 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
3756 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
3758 /* Controls for GPIO pins, assuming they are configured as outputs */
3759 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
3760 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
3761 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
3762 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
3764 /* Switches to allow the digital IO pins to be enabled. The datasheet
3765 * is ambigious as to which NID is which; testing on laptops which
3766 * make this output available should provide clarification.
3768 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
3769 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
3773 static struct hda_verb alc260_test_init_verbs
[] = {
3774 /* Enable all GPIOs as outputs with an initial value of 0 */
3775 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
3776 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
3777 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
3779 /* Enable retasking pins as output, initially without power amp */
3780 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3781 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3782 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3783 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3784 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3785 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3787 /* Disable digital (SPDIF) pins initially, but users can enable
3788 * them via a mixer switch. In the case of SPDIF-out, this initverb
3789 * payload also sets the generation to 0, output to be in "consumer"
3790 * PCM format, copyright asserted, no pre-emphasis and no validity
3793 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3794 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3796 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
3797 * OUT1 sum bus when acting as an output.
3799 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
3800 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
3801 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
3802 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
3804 /* Start with output sum widgets muted and their output gains at min */
3805 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3806 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3807 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3808 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3809 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3810 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3811 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3812 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3813 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3815 /* Unmute retasking pin widget output buffers since the default
3816 * state appears to be output. As the pin mode is changed by the
3817 * user the pin mode control will take care of enabling the pin's
3818 * input/output buffers as needed.
3820 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3821 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3822 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3823 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3824 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3825 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3826 /* Also unmute the mono-out pin widget */
3827 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3829 /* Mute capture amp left and right */
3830 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3831 /* Set ADC connection select to match default mixer setting (mic1
3834 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
3836 /* Do the same for the second ADC: mute capture input amp and
3837 * set ADC connection to mic1 pin
3839 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3840 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
3842 /* Mute all inputs to mixer widget (even unconnected ones) */
3843 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
3844 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
3845 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
3846 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
3847 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
3848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3849 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
3850 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
3856 static struct hda_pcm_stream alc260_pcm_analog_playback
= {
3862 static struct hda_pcm_stream alc260_pcm_analog_capture
= {
3868 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
3869 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
3872 * for BIOS auto-configuration
3875 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
3879 unsigned long vol_val
, sw_val
;
3883 if (nid
>= 0x0f && nid
< 0x11) {
3884 nid_vol
= nid
- 0x7;
3885 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
3886 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
3887 } else if (nid
== 0x11) {
3888 nid_vol
= nid
- 0x7;
3889 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
3890 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
3891 } else if (nid
>= 0x12 && nid
<= 0x15) {
3893 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
3894 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
3898 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
3899 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
)) < 0)
3901 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
3902 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
)) < 0)
3907 /* add playback controls from the parsed DAC table */
3908 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
3909 const struct auto_pin_cfg
*cfg
)
3914 spec
->multiout
.num_dacs
= 1;
3915 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
3916 spec
->multiout
.dac_nids
[0] = 0x02;
3918 nid
= cfg
->line_out_pins
[0];
3920 err
= alc260_add_playback_controls(spec
, nid
, "Front");
3925 nid
= cfg
->speaker_pins
[0];
3927 err
= alc260_add_playback_controls(spec
, nid
, "Speaker");
3932 nid
= cfg
->hp_pins
[0];
3934 err
= alc260_add_playback_controls(spec
, nid
, "Headphone");
3941 /* create playback/capture controls for input pins */
3942 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
3943 const struct auto_pin_cfg
*cfg
)
3945 struct hda_input_mux
*imux
= &spec
->private_imux
;
3948 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3949 if (cfg
->input_pins
[i
] >= 0x12) {
3950 idx
= cfg
->input_pins
[i
] - 0x12;
3951 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
3952 auto_pin_cfg_labels
[i
], idx
, 0x07);
3955 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
3956 imux
->items
[imux
->num_items
].index
= idx
;
3959 if ((cfg
->input_pins
[i
] >= 0x0f) && (cfg
->input_pins
[i
] <= 0x10)){
3960 idx
= cfg
->input_pins
[i
] - 0x09;
3961 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
3962 auto_pin_cfg_labels
[i
], idx
, 0x07);
3965 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
3966 imux
->items
[imux
->num_items
].index
= idx
;
3973 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
3974 hda_nid_t nid
, int pin_type
,
3978 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
3979 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
3980 /* need the manual connection? */
3982 int idx
= nid
- 0x12;
3983 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
3984 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
3989 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
3991 struct alc_spec
*spec
= codec
->spec
;
3994 nid
= spec
->autocfg
.line_out_pins
[0];
3996 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
3998 nid
= spec
->autocfg
.speaker_pins
[0];
4000 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
4002 nid
= spec
->autocfg
.hp_pins
[0];
4004 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
4007 #define ALC260_PIN_CD_NID 0x16
4008 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
4010 struct alc_spec
*spec
= codec
->spec
;
4013 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4014 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
4016 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4017 i
<= AUTO_PIN_FRONT_MIC
? PIN_VREF80
: PIN_IN
);
4018 if (nid
!= ALC260_PIN_CD_NID
)
4019 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4026 * generic initialization of ADC, input mixers and output mixers
4028 static struct hda_verb alc260_volume_init_verbs
[] = {
4030 * Unmute ADC0-1 and set the default input to mic-in
4032 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4033 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4034 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4035 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4037 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4039 * Note: PASD motherboards uses the Line In 2 as the input for front panel
4042 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4043 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4044 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4045 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
4046 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
4047 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
4050 * Set up output mixers (0x08 - 0x0a)
4052 /* set vol=0 to output mixers */
4053 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4054 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4055 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4056 /* set up input amps for analog loopback */
4057 /* Amp Indices: DAC = 0, mixer = 1 */
4058 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4059 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4060 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4061 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4062 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4063 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4068 static int alc260_parse_auto_config(struct hda_codec
*codec
)
4070 struct alc_spec
*spec
= codec
->spec
;
4073 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
4075 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
4076 alc260_ignore
)) < 0)
4078 if ((err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0)
4080 if (! spec
->kctl_alloc
)
4081 return 0; /* can't find valid BIOS pin config */
4082 if ((err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
)) < 0)
4085 spec
->multiout
.max_channels
= 2;
4087 if (spec
->autocfg
.dig_out_pin
)
4088 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
4089 if (spec
->kctl_alloc
)
4090 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
4092 spec
->init_verbs
[spec
->num_init_verbs
++] = alc260_volume_init_verbs
;
4094 spec
->num_mux_defs
= 1;
4095 spec
->input_mux
= &spec
->private_imux
;
4097 /* check whether NID 0x04 is valid */
4098 wcap
= get_wcaps(codec
, 0x04);
4099 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
4100 if (wcap
!= AC_WID_AUD_IN
) {
4101 spec
->adc_nids
= alc260_adc_nids_alt
;
4102 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
4103 spec
->mixers
[spec
->num_mixers
] = alc260_capture_alt_mixer
;
4105 spec
->adc_nids
= alc260_adc_nids
;
4106 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
4107 spec
->mixers
[spec
->num_mixers
] = alc260_capture_mixer
;
4114 /* additional initialization for auto-configuration model */
4115 static void alc260_auto_init(struct hda_codec
*codec
)
4117 alc260_auto_init_multi_out(codec
);
4118 alc260_auto_init_analog_input(codec
);
4122 * ALC260 configurations
4124 static const char *alc260_models
[ALC260_MODEL_LAST
] = {
4125 [ALC260_BASIC
] = "basic",
4127 [ALC260_HP_3013
] = "hp-3013",
4128 [ALC260_FUJITSU_S702X
] = "fujitsu",
4129 [ALC260_ACER
] = "acer",
4130 #ifdef CONFIG_SND_DEBUG
4131 [ALC260_TEST
] = "test",
4133 [ALC260_AUTO
] = "auto",
4136 static struct snd_pci_quirk alc260_cfg_tbl
[] = {
4137 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER
),
4138 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER
),
4139 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013
),
4140 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP
),
4141 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013
),
4142 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013
),
4143 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP
),
4144 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP
),
4145 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP
),
4146 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC
),
4147 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC
),
4148 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC
),
4149 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X
),
4150 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC
),
4154 static struct alc_config_preset alc260_presets
[] = {
4156 .mixers
= { alc260_base_output_mixer
,
4158 alc260_pc_beep_mixer
,
4159 alc260_capture_mixer
},
4160 .init_verbs
= { alc260_init_verbs
},
4161 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4162 .dac_nids
= alc260_dac_nids
,
4163 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
4164 .adc_nids
= alc260_adc_nids
,
4165 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4166 .channel_mode
= alc260_modes
,
4167 .input_mux
= &alc260_capture_source
,
4170 .mixers
= { alc260_base_output_mixer
,
4172 alc260_capture_alt_mixer
},
4173 .init_verbs
= { alc260_init_verbs
},
4174 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4175 .dac_nids
= alc260_dac_nids
,
4176 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
4177 .adc_nids
= alc260_hp_adc_nids
,
4178 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4179 .channel_mode
= alc260_modes
,
4180 .input_mux
= &alc260_capture_source
,
4182 [ALC260_HP_3013
] = {
4183 .mixers
= { alc260_hp_3013_mixer
,
4185 alc260_capture_alt_mixer
},
4186 .init_verbs
= { alc260_hp_3013_init_verbs
},
4187 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4188 .dac_nids
= alc260_dac_nids
,
4189 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
4190 .adc_nids
= alc260_hp_adc_nids
,
4191 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4192 .channel_mode
= alc260_modes
,
4193 .input_mux
= &alc260_capture_source
,
4195 [ALC260_FUJITSU_S702X
] = {
4196 .mixers
= { alc260_fujitsu_mixer
,
4197 alc260_capture_mixer
},
4198 .init_verbs
= { alc260_fujitsu_init_verbs
},
4199 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4200 .dac_nids
= alc260_dac_nids
,
4201 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
4202 .adc_nids
= alc260_dual_adc_nids
,
4203 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4204 .channel_mode
= alc260_modes
,
4205 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
4206 .input_mux
= alc260_fujitsu_capture_sources
,
4209 .mixers
= { alc260_acer_mixer
,
4210 alc260_capture_mixer
},
4211 .init_verbs
= { alc260_acer_init_verbs
},
4212 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4213 .dac_nids
= alc260_dac_nids
,
4214 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
4215 .adc_nids
= alc260_dual_adc_nids
,
4216 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4217 .channel_mode
= alc260_modes
,
4218 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
4219 .input_mux
= alc260_acer_capture_sources
,
4221 #ifdef CONFIG_SND_DEBUG
4223 .mixers
= { alc260_test_mixer
,
4224 alc260_capture_mixer
},
4225 .init_verbs
= { alc260_test_init_verbs
},
4226 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
4227 .dac_nids
= alc260_test_dac_nids
,
4228 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
4229 .adc_nids
= alc260_test_adc_nids
,
4230 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4231 .channel_mode
= alc260_modes
,
4232 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
4233 .input_mux
= alc260_test_capture_sources
,
4238 static int patch_alc260(struct hda_codec
*codec
)
4240 struct alc_spec
*spec
;
4241 int err
, board_config
;
4243 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4249 board_config
= snd_hda_check_board_config(codec
, ALC260_MODEL_LAST
,
4252 if (board_config
< 0) {
4253 snd_printd(KERN_INFO
"hda_codec: Unknown model for ALC260, "
4254 "trying auto-probe from BIOS...\n");
4255 board_config
= ALC260_AUTO
;
4258 if (board_config
== ALC260_AUTO
) {
4259 /* automatic parse from the BIOS config */
4260 err
= alc260_parse_auto_config(codec
);
4266 "hda_codec: Cannot set up configuration "
4267 "from BIOS. Using base mode...\n");
4268 board_config
= ALC260_BASIC
;
4272 if (board_config
!= ALC260_AUTO
)
4273 setup_preset(spec
, &alc260_presets
[board_config
]);
4275 spec
->stream_name_analog
= "ALC260 Analog";
4276 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
4277 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
4279 spec
->stream_name_digital
= "ALC260 Digital";
4280 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
4281 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
4283 codec
->patch_ops
= alc_patch_ops
;
4284 if (board_config
== ALC260_AUTO
)
4285 spec
->init_hook
= alc260_auto_init
;
4294 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
4295 * configuration. Each pin widget can choose any input DACs and a mixer.
4296 * Each ADC is connected from a mixer of all inputs. This makes possible
4297 * 6-channel independent captures.
4299 * In addition, an independent DAC for the multi-playback (not used in this
4302 #define ALC882_DIGOUT_NID 0x06
4303 #define ALC882_DIGIN_NID 0x0a
4305 static struct hda_channel_mode alc882_ch_modes
[1] = {
4309 static hda_nid_t alc882_dac_nids
[4] = {
4310 /* front, rear, clfe, rear_surr */
4311 0x02, 0x03, 0x04, 0x05
4314 /* identical with ALC880 */
4315 #define alc882_adc_nids alc880_adc_nids
4316 #define alc882_adc_nids_alt alc880_adc_nids_alt
4319 /* FIXME: should be a matrix-type input source selection */
4321 static struct hda_input_mux alc882_capture_source
= {
4325 { "Front Mic", 0x1 },
4330 #define alc882_mux_enum_info alc_mux_enum_info
4331 #define alc882_mux_enum_get alc_mux_enum_get
4333 static int alc882_mux_enum_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
4335 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4336 struct alc_spec
*spec
= codec
->spec
;
4337 const struct hda_input_mux
*imux
= spec
->input_mux
;
4338 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
4339 static hda_nid_t capture_mixers
[3] = { 0x24, 0x23, 0x22 };
4340 hda_nid_t nid
= capture_mixers
[adc_idx
];
4341 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
4342 unsigned int i
, idx
;
4344 idx
= ucontrol
->value
.enumerated
.item
[0];
4345 if (idx
>= imux
->num_items
)
4346 idx
= imux
->num_items
- 1;
4347 if (*cur_val
== idx
&& ! codec
->in_resume
)
4349 for (i
= 0; i
< imux
->num_items
; i
++) {
4350 unsigned int v
= (i
== idx
) ? 0x7000 : 0x7080;
4351 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4352 v
| (imux
->items
[i
].index
<< 8));
4361 static struct hda_verb alc882_sixstack_ch6_init
[] = {
4362 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
4363 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4364 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4365 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4372 static struct hda_verb alc882_sixstack_ch8_init
[] = {
4373 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4374 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4375 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4376 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4380 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
4381 { 6, alc882_sixstack_ch6_init
},
4382 { 8, alc882_sixstack_ch8_init
},
4385 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
4386 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
4388 static struct snd_kcontrol_new alc882_base_mixer
[] = {
4389 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4390 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4391 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
4392 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
4393 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
4394 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
4395 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
4396 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
4397 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
4398 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
4399 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
4400 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
4401 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
4402 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
4403 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
4404 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4405 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4406 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4407 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4408 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
4409 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
4413 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
4415 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4416 .name
= "Channel Mode",
4417 .info
= alc_ch_mode_info
,
4418 .get
= alc_ch_mode_get
,
4419 .put
= alc_ch_mode_put
,
4424 static struct hda_verb alc882_init_verbs
[] = {
4425 /* Front mixer: unmute input/output amp left and right (volume = 0) */
4426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4427 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4430 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4431 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4432 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4434 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4436 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4438 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4439 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4440 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4442 /* Front Pin: output 0 (0x0c) */
4443 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4444 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4445 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
4446 /* Rear Pin: output 1 (0x0d) */
4447 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4448 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4449 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
4450 /* CLFE Pin: output 2 (0x0e) */
4451 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4452 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4453 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
4454 /* Side Pin: output 3 (0x0f) */
4455 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4456 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4457 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
4458 /* Mic (rear) pin: input vref at 80% */
4459 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4460 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4461 /* Front Mic pin: input vref at 80% */
4462 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4463 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4464 /* Line In pin: input */
4465 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4466 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4467 /* Line-2 In: Headphone output (output 0 - 0x0c) */
4468 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4469 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4470 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
4471 /* CD pin widget for input */
4472 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4474 /* FIXME: use matrix-type input source selection */
4475 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
4476 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
4477 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4478 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4479 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4480 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4482 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4483 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4484 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4485 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4487 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4488 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4490 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4491 /* ADC1: mute amp left and right */
4492 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4493 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4494 /* ADC2: mute amp left and right */
4495 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4496 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4497 /* ADC3: mute amp left and right */
4498 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4499 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4504 static struct hda_verb alc882_eapd_verbs
[] = {
4505 /* change to EAPD mode */
4506 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
4507 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
4512 static struct snd_kcontrol_new alc882_macpro_mixer
[] = {
4513 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4514 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4515 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT
),
4516 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT
),
4517 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT
),
4518 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT
),
4519 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT
),
4523 static struct hda_verb alc882_macpro_init_verbs
[] = {
4524 /* Front mixer: unmute input/output amp left and right (volume = 0) */
4525 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4527 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4528 /* Front Pin: output 0 (0x0c) */
4529 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4530 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4531 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
4532 /* Front Mic pin: input vref at 80% */
4533 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4534 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4535 /* Speaker: output */
4536 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4537 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4538 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x04},
4539 /* Headphone output (output 0 - 0x0c) */
4540 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4541 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4542 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x00},
4544 /* FIXME: use matrix-type input source selection */
4545 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
4546 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
4547 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4548 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4549 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4550 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4552 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4553 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4554 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4555 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4557 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4558 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4559 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4560 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4561 /* ADC1: mute amp left and right */
4562 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4563 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4564 /* ADC2: mute amp left and right */
4565 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4566 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4567 /* ADC3: mute amp left and right */
4568 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4569 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4573 static void alc882_gpio_mute(struct hda_codec
*codec
, int pin
, int muted
)
4575 unsigned int gpiostate
, gpiomask
, gpiodir
;
4577 gpiostate
= snd_hda_codec_read(codec
, codec
->afg
, 0,
4578 AC_VERB_GET_GPIO_DATA
, 0);
4581 gpiostate
|= (1 << pin
);
4583 gpiostate
&= ~(1 << pin
);
4585 gpiomask
= snd_hda_codec_read(codec
, codec
->afg
, 0,
4586 AC_VERB_GET_GPIO_MASK
, 0);
4587 gpiomask
|= (1 << pin
);
4589 gpiodir
= snd_hda_codec_read(codec
, codec
->afg
, 0,
4590 AC_VERB_GET_GPIO_DIRECTION
, 0);
4591 gpiodir
|= (1 << pin
);
4594 snd_hda_codec_write(codec
, codec
->afg
, 0,
4595 AC_VERB_SET_GPIO_MASK
, gpiomask
);
4596 snd_hda_codec_write(codec
, codec
->afg
, 0,
4597 AC_VERB_SET_GPIO_DIRECTION
, gpiodir
);
4601 snd_hda_codec_write(codec
, codec
->afg
, 0,
4602 AC_VERB_SET_GPIO_DATA
, gpiostate
);
4606 * generic initialization of ADC, input mixers and output mixers
4608 static struct hda_verb alc882_auto_init_verbs
[] = {
4610 * Unmute ADC0-2 and set the default input to mic-in
4612 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4614 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4615 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4616 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4617 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4619 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4621 * Note: PASD motherboards uses the Line In 2 as the input for front panel
4624 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
4628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
4629 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
4632 * Set up output mixers (0x0c - 0x0f)
4634 /* set vol=0 to output mixers */
4635 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4636 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4637 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4638 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4639 /* set up input amps for analog loopback */
4640 /* Amp Indices: DAC = 0, mixer = 1 */
4641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4642 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4644 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4646 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4648 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4649 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4650 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4652 /* FIXME: use matrix-type input source selection */
4653 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
4654 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
4655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4656 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
4657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
4658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
4660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
4662 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
4663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
4665 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4666 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
4667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
4668 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
4673 /* capture mixer elements */
4674 static struct snd_kcontrol_new alc882_capture_alt_mixer
[] = {
4675 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
4676 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
4677 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
4678 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
4680 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4681 /* The multiple "Capture Source" controls confuse alsamixer
4682 * So call somewhat different..
4683 * FIXME: the controls appear in the "playback" view!
4685 /* .name = "Capture Source", */
4686 .name
= "Input Source",
4688 .info
= alc882_mux_enum_info
,
4689 .get
= alc882_mux_enum_get
,
4690 .put
= alc882_mux_enum_put
,
4695 static struct snd_kcontrol_new alc882_capture_mixer
[] = {
4696 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
4697 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
4698 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
4699 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
4700 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
4701 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
4703 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4704 /* The multiple "Capture Source" controls confuse alsamixer
4705 * So call somewhat different..
4706 * FIXME: the controls appear in the "playback" view!
4708 /* .name = "Capture Source", */
4709 .name
= "Input Source",
4711 .info
= alc882_mux_enum_info
,
4712 .get
= alc882_mux_enum_get
,
4713 .put
= alc882_mux_enum_put
,
4718 /* pcm configuration: identiacal with ALC880 */
4719 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
4720 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
4721 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
4722 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
4725 * configuration and preset
4727 static const char *alc882_models
[ALC882_MODEL_LAST
] = {
4728 [ALC882_3ST_DIG
] = "3stack-dig",
4729 [ALC882_6ST_DIG
] = "6stack-dig",
4730 [ALC882_ARIMA
] = "arima",
4731 [ALC885_MACPRO
] = "macpro",
4732 [ALC882_AUTO
] = "auto",
4735 static struct snd_pci_quirk alc882_cfg_tbl
[] = {
4736 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG
),
4737 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG
),
4738 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG
),
4739 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA
),
4743 static struct alc_config_preset alc882_presets
[] = {
4744 [ALC882_3ST_DIG
] = {
4745 .mixers
= { alc882_base_mixer
},
4746 .init_verbs
= { alc882_init_verbs
},
4747 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
4748 .dac_nids
= alc882_dac_nids
,
4749 .dig_out_nid
= ALC882_DIGOUT_NID
,
4750 .dig_in_nid
= ALC882_DIGIN_NID
,
4751 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
4752 .channel_mode
= alc882_ch_modes
,
4754 .input_mux
= &alc882_capture_source
,
4756 [ALC882_6ST_DIG
] = {
4757 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
4758 .init_verbs
= { alc882_init_verbs
},
4759 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
4760 .dac_nids
= alc882_dac_nids
,
4761 .dig_out_nid
= ALC882_DIGOUT_NID
,
4762 .dig_in_nid
= ALC882_DIGIN_NID
,
4763 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
4764 .channel_mode
= alc882_sixstack_modes
,
4765 .input_mux
= &alc882_capture_source
,
4768 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
4769 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
},
4770 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
4771 .dac_nids
= alc882_dac_nids
,
4772 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
4773 .channel_mode
= alc882_sixstack_modes
,
4774 .input_mux
= &alc882_capture_source
,
4777 .mixers
= { alc882_macpro_mixer
},
4778 .init_verbs
= { alc882_macpro_init_verbs
},
4779 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
4780 .dac_nids
= alc882_dac_nids
,
4781 .dig_out_nid
= ALC882_DIGOUT_NID
,
4782 .dig_in_nid
= ALC882_DIGIN_NID
,
4783 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
4784 .channel_mode
= alc882_ch_modes
,
4785 .input_mux
= &alc882_capture_source
,
4791 * BIOS auto configuration
4793 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
4794 hda_nid_t nid
, int pin_type
,
4798 struct alc_spec
*spec
= codec
->spec
;
4801 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
4804 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
4806 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
4807 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
4808 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
4812 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
4814 struct alc_spec
*spec
= codec
->spec
;
4817 for (i
= 0; i
<= HDA_SIDE
; i
++) {
4818 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
4820 alc882_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, i
);
4824 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
4826 struct alc_spec
*spec
= codec
->spec
;
4829 pin
= spec
->autocfg
.hp_pins
[0];
4830 if (pin
) /* connect to front */
4831 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0); /* use dac 0 */
4834 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
4835 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
4837 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
4839 struct alc_spec
*spec
= codec
->spec
;
4842 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4843 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
4844 if (alc882_is_input_pin(nid
)) {
4845 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4846 i
<= AUTO_PIN_FRONT_MIC
? PIN_VREF80
: PIN_IN
);
4847 if (nid
!= ALC882_PIN_CD_NID
)
4848 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4854 /* almost identical with ALC880 parser... */
4855 static int alc882_parse_auto_config(struct hda_codec
*codec
)
4857 struct alc_spec
*spec
= codec
->spec
;
4858 int err
= alc880_parse_auto_config(codec
);
4863 /* hack - override the init verbs */
4864 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
4868 /* additional initialization for auto-configuration model */
4869 static void alc882_auto_init(struct hda_codec
*codec
)
4871 alc882_auto_init_multi_out(codec
);
4872 alc882_auto_init_hp_out(codec
);
4873 alc882_auto_init_analog_input(codec
);
4876 static int patch_alc882(struct hda_codec
*codec
)
4878 struct alc_spec
*spec
;
4879 int err
, board_config
;
4881 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4887 board_config
= snd_hda_check_board_config(codec
, ALC882_MODEL_LAST
,
4891 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
4892 printk(KERN_INFO
"hda_codec: Unknown model for ALC882, "
4893 "trying auto-probe from BIOS...\n");
4894 board_config
= ALC882_AUTO
;
4897 if (board_config
== ALC882_AUTO
) {
4898 /* automatic parse from the BIOS config */
4899 err
= alc882_parse_auto_config(codec
);
4905 "hda_codec: Cannot set up configuration "
4906 "from BIOS. Using base mode...\n");
4907 board_config
= ALC882_3ST_DIG
;
4911 if (board_config
!= ALC882_AUTO
)
4912 setup_preset(spec
, &alc882_presets
[board_config
]);
4914 if (board_config
== ALC885_MACPRO
) {
4915 alc882_gpio_mute(codec
, 0, 0);
4916 alc882_gpio_mute(codec
, 1, 0);
4919 spec
->stream_name_analog
= "ALC882 Analog";
4920 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
4921 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
4923 spec
->stream_name_digital
= "ALC882 Digital";
4924 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
4925 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
4927 if (! spec
->adc_nids
&& spec
->input_mux
) {
4928 /* check whether NID 0x07 is valid */
4929 unsigned int wcap
= get_wcaps(codec
, 0x07);
4930 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
4931 if (wcap
!= AC_WID_AUD_IN
) {
4932 spec
->adc_nids
= alc882_adc_nids_alt
;
4933 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
4934 spec
->mixers
[spec
->num_mixers
] = alc882_capture_alt_mixer
;
4937 spec
->adc_nids
= alc882_adc_nids
;
4938 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
4939 spec
->mixers
[spec
->num_mixers
] = alc882_capture_mixer
;
4944 codec
->patch_ops
= alc_patch_ops
;
4945 if (board_config
== ALC882_AUTO
)
4946 spec
->init_hook
= alc882_auto_init
;
4954 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
4955 * configuration. Each pin widget can choose any input DACs and a mixer.
4956 * Each ADC is connected from a mixer of all inputs. This makes possible
4957 * 6-channel independent captures.
4959 * In addition, an independent DAC for the multi-playback (not used in this
4962 #define ALC883_DIGOUT_NID 0x06
4963 #define ALC883_DIGIN_NID 0x0a
4965 static hda_nid_t alc883_dac_nids
[4] = {
4966 /* front, rear, clfe, rear_surr */
4967 0x02, 0x04, 0x03, 0x05
4970 static hda_nid_t alc883_adc_nids
[2] = {
4975 /* FIXME: should be a matrix-type input source selection */
4977 static struct hda_input_mux alc883_capture_source
= {
4981 { "Front Mic", 0x1 },
4986 #define alc883_mux_enum_info alc_mux_enum_info
4987 #define alc883_mux_enum_get alc_mux_enum_get
4989 static int alc883_mux_enum_put(struct snd_kcontrol
*kcontrol
,
4990 struct snd_ctl_elem_value
*ucontrol
)
4992 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4993 struct alc_spec
*spec
= codec
->spec
;
4994 const struct hda_input_mux
*imux
= spec
->input_mux
;
4995 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
4996 static hda_nid_t capture_mixers
[3] = { 0x24, 0x23, 0x22 };
4997 hda_nid_t nid
= capture_mixers
[adc_idx
];
4998 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
4999 unsigned int i
, idx
;
5001 idx
= ucontrol
->value
.enumerated
.item
[0];
5002 if (idx
>= imux
->num_items
)
5003 idx
= imux
->num_items
- 1;
5004 if (*cur_val
== idx
&& ! codec
->in_resume
)
5006 for (i
= 0; i
< imux
->num_items
; i
++) {
5007 unsigned int v
= (i
== idx
) ? 0x7000 : 0x7080;
5008 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
5009 v
| (imux
->items
[i
].index
<< 8));
5017 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
5024 static struct hda_verb alc883_3ST_ch2_init
[] = {
5025 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5026 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5027 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5028 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5035 static struct hda_verb alc883_3ST_ch6_init
[] = {
5036 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5037 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5038 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
5039 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5040 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5041 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
5045 static struct hda_channel_mode alc883_3ST_6ch_modes
[2] = {
5046 { 2, alc883_3ST_ch2_init
},
5047 { 6, alc883_3ST_ch6_init
},
5053 static struct hda_verb alc883_sixstack_ch6_init
[] = {
5054 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
5055 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5056 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5057 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5064 static struct hda_verb alc883_sixstack_ch8_init
[] = {
5065 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5066 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5067 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5068 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5072 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
5073 { 6, alc883_sixstack_ch6_init
},
5074 { 8, alc883_sixstack_ch8_init
},
5077 static struct hda_verb alc883_medion_eapd_verbs
[] = {
5078 /* eanable EAPD on medion laptop */
5079 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
5080 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
5084 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5085 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5088 static struct snd_kcontrol_new alc883_base_mixer
[] = {
5089 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5090 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5091 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5092 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5093 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5094 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5095 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5096 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5097 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
5098 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
5099 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5100 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5101 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5102 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5103 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5104 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5105 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5106 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5107 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5108 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5109 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5110 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5111 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5112 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5113 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5115 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5116 /* .name = "Capture Source", */
5117 .name
= "Input Source",
5119 .info
= alc883_mux_enum_info
,
5120 .get
= alc883_mux_enum_get
,
5121 .put
= alc883_mux_enum_put
,
5126 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
5127 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5128 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5129 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5130 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5131 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5132 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5133 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5134 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5135 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5136 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5137 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5138 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5139 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5140 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5141 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5142 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5143 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5145 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5146 /* .name = "Capture Source", */
5147 .name
= "Input Source",
5149 .info
= alc883_mux_enum_info
,
5150 .get
= alc883_mux_enum_get
,
5151 .put
= alc883_mux_enum_put
,
5156 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
5157 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5158 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5159 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5160 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5161 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5162 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5163 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5164 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5166 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5167 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5168 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5169 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5171 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5172 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5173 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5174 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5175 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5176 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5177 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5178 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5179 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5181 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5182 /* .name = "Capture Source", */
5183 .name
= "Input Source",
5185 .info
= alc883_mux_enum_info
,
5186 .get
= alc883_mux_enum_get
,
5187 .put
= alc883_mux_enum_put
,
5192 static struct snd_kcontrol_new alc883_fivestack_mixer
[] = {
5193 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5194 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5195 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5196 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5197 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5198 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5199 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT
),
5200 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
5201 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5202 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5203 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5204 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5205 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5206 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5207 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5208 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5209 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5210 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5211 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5212 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5213 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5216 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5217 /* .name = "Capture Source", */
5218 .name
= "Input Source",
5220 .info
= alc883_mux_enum_info
,
5221 .get
= alc883_mux_enum_get
,
5222 .put
= alc883_mux_enum_put
,
5227 static struct snd_kcontrol_new alc883_tagra_mixer
[] = {
5228 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5229 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5230 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5231 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5232 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5233 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5234 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5235 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5236 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5237 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5238 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5239 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5240 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5241 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5242 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5243 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5244 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5245 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5246 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5248 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5249 /* .name = "Capture Source", */
5250 .name
= "Input Source",
5252 .info
= alc883_mux_enum_info
,
5253 .get
= alc883_mux_enum_get
,
5254 .put
= alc883_mux_enum_put
,
5259 static struct snd_kcontrol_new alc883_tagra_2ch_mixer
[] = {
5260 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5261 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5262 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5263 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5264 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5265 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5266 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5267 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5268 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5269 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5270 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5272 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5273 /* .name = "Capture Source", */
5274 .name
= "Input Source",
5276 .info
= alc883_mux_enum_info
,
5277 .get
= alc883_mux_enum_get
,
5278 .put
= alc883_mux_enum_put
,
5283 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
5285 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5286 .name
= "Channel Mode",
5287 .info
= alc_ch_mode_info
,
5288 .get
= alc_ch_mode_get
,
5289 .put
= alc_ch_mode_put
,
5294 static struct hda_verb alc883_init_verbs
[] = {
5295 /* ADC1: mute amp left and right */
5296 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5297 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5298 /* ADC2: mute amp left and right */
5299 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5300 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5301 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5304 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5306 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5307 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5308 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5310 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5314 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5315 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5316 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
5322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5324 /* Front Pin: output 0 (0x0c) */
5325 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5326 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5327 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5328 /* Rear Pin: output 1 (0x0d) */
5329 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5330 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5331 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5332 /* CLFE Pin: output 2 (0x0e) */
5333 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5334 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5335 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
5336 /* Side Pin: output 3 (0x0f) */
5337 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5338 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5339 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
5340 /* Mic (rear) pin: input vref at 80% */
5341 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5342 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5343 /* Front Mic pin: input vref at 80% */
5344 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5345 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5346 /* Line In pin: input */
5347 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5348 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5349 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5350 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5351 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5352 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5353 /* CD pin widget for input */
5354 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5356 /* FIXME: use matrix-type input source selection */
5357 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5359 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5360 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5361 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5362 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5364 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5365 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5366 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5367 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5371 static struct hda_verb alc883_tagra_verbs
[] = {
5372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5375 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5376 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5378 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5379 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5380 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5382 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5383 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
5384 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
5385 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
5390 /* toggle speaker-output according to the hp-jack state */
5391 static void alc883_tagra_automute(struct hda_codec
*codec
)
5393 unsigned int present
;
5395 present
= snd_hda_codec_read(codec
, 0x14, 0,
5396 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5397 snd_hda_codec_amp_update(codec
, 0x1b, 0, HDA_OUTPUT
, 0,
5398 0x80, present
? 0x80 : 0);
5399 snd_hda_codec_amp_update(codec
, 0x1b, 1, HDA_OUTPUT
, 0,
5400 0x80, present
? 0x80 : 0);
5401 snd_hda_codec_write(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
, present
? 1 : 3);
5404 static void alc883_tagra_unsol_event(struct hda_codec
*codec
, unsigned int res
)
5406 if ((res
>> 26) == ALC880_HP_EVENT
)
5407 alc883_tagra_automute(codec
);
5411 * generic initialization of ADC, input mixers and output mixers
5413 static struct hda_verb alc883_auto_init_verbs
[] = {
5415 * Unmute ADC0-2 and set the default input to mic-in
5417 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5418 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5419 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5420 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5422 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5424 * Note: PASD motherboards uses the Line In 2 as the input for front panel
5427 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5428 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5429 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5430 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5431 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
5432 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5435 * Set up output mixers (0x0c - 0x0f)
5437 /* set vol=0 to output mixers */
5438 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5439 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5440 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5441 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5442 /* set up input amps for analog loopback */
5443 /* Amp Indices: DAC = 0, mixer = 1 */
5444 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5445 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5446 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5447 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5448 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5449 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5450 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5451 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5452 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5453 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5455 /* FIXME: use matrix-type input source selection */
5456 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5458 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5461 //{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
5462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5464 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5465 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5466 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5467 //{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
5468 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5473 /* capture mixer elements */
5474 static struct snd_kcontrol_new alc883_capture_mixer
[] = {
5475 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5476 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5477 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5478 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5480 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5481 /* The multiple "Capture Source" controls confuse alsamixer
5482 * So call somewhat different..
5483 * FIXME: the controls appear in the "playback" view!
5485 /* .name = "Capture Source", */
5486 .name
= "Input Source",
5488 .info
= alc882_mux_enum_info
,
5489 .get
= alc882_mux_enum_get
,
5490 .put
= alc882_mux_enum_put
,
5495 /* pcm configuration: identiacal with ALC880 */
5496 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
5497 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
5498 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
5499 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
5502 * configuration and preset
5504 static const char *alc883_models
[ALC883_MODEL_LAST
] = {
5505 [ALC883_3ST_2ch_DIG
] = "3stack-dig",
5506 [ALC883_3ST_6ch_DIG
] = "3stack-6ch-dig",
5507 [ALC883_3ST_6ch
] = "3stack-6ch",
5508 [ALC883_6ST_DIG
] = "6stack-dig",
5509 [ALC883_TARGA_DIG
] = "targa-dig",
5510 [ALC883_TARGA_2ch_DIG
] = "targa-2ch-dig",
5511 [ALC888_DEMO_BOARD
] = "6stack-dig-demo",
5512 [ALC883_ACER
] = "acer",
5513 [ALC883_MEDION
] = "medion",
5514 [ALC883_LAPTOP_EAPD
] = "laptop-eapd",
5515 [ALC883_AUTO
] = "auto",
5518 static struct snd_pci_quirk alc883_cfg_tbl
[] = {
5519 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG
),
5520 SND_PCI_QUIRK(0x108e, 0x534d, NULL
, ALC883_3ST_6ch
),
5521 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD
),
5522 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG
),
5523 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG
),
5524 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG
),
5525 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG
),
5526 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG
),
5527 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG
),
5528 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG
),
5529 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG
),
5530 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG
),
5531 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG
),
5532 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG
),
5533 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG
),
5534 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG
),
5535 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER
),
5536 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION
),
5537 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD
),
5538 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch
),
5542 static struct alc_config_preset alc883_presets
[] = {
5543 [ALC883_3ST_2ch_DIG
] = {
5544 .mixers
= { alc883_3ST_2ch_mixer
},
5545 .init_verbs
= { alc883_init_verbs
},
5546 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5547 .dac_nids
= alc883_dac_nids
,
5548 .dig_out_nid
= ALC883_DIGOUT_NID
,
5549 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5550 .adc_nids
= alc883_adc_nids
,
5551 .dig_in_nid
= ALC883_DIGIN_NID
,
5552 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
5553 .channel_mode
= alc883_3ST_2ch_modes
,
5554 .input_mux
= &alc883_capture_source
,
5556 [ALC883_3ST_6ch_DIG
] = {
5557 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
5558 .init_verbs
= { alc883_init_verbs
},
5559 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5560 .dac_nids
= alc883_dac_nids
,
5561 .dig_out_nid
= ALC883_DIGOUT_NID
,
5562 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5563 .adc_nids
= alc883_adc_nids
,
5564 .dig_in_nid
= ALC883_DIGIN_NID
,
5565 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
5566 .channel_mode
= alc883_3ST_6ch_modes
,
5568 .input_mux
= &alc883_capture_source
,
5570 [ALC883_3ST_6ch
] = {
5571 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
5572 .init_verbs
= { alc883_init_verbs
},
5573 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5574 .dac_nids
= alc883_dac_nids
,
5575 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5576 .adc_nids
= alc883_adc_nids
,
5577 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
5578 .channel_mode
= alc883_3ST_6ch_modes
,
5580 .input_mux
= &alc883_capture_source
,
5582 [ALC883_6ST_DIG
] = {
5583 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
5584 .init_verbs
= { alc883_init_verbs
},
5585 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5586 .dac_nids
= alc883_dac_nids
,
5587 .dig_out_nid
= ALC883_DIGOUT_NID
,
5588 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5589 .adc_nids
= alc883_adc_nids
,
5590 .dig_in_nid
= ALC883_DIGIN_NID
,
5591 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
5592 .channel_mode
= alc883_sixstack_modes
,
5593 .input_mux
= &alc883_capture_source
,
5595 [ALC883_TARGA_DIG
] = {
5596 .mixers
= { alc883_tagra_mixer
, alc883_chmode_mixer
},
5597 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
5598 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5599 .dac_nids
= alc883_dac_nids
,
5600 .dig_out_nid
= ALC883_DIGOUT_NID
,
5601 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5602 .adc_nids
= alc883_adc_nids
,
5603 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
5604 .channel_mode
= alc883_3ST_6ch_modes
,
5606 .input_mux
= &alc883_capture_source
,
5607 .unsol_event
= alc883_tagra_unsol_event
,
5608 .init_hook
= alc883_tagra_automute
,
5610 [ALC883_TARGA_2ch_DIG
] = {
5611 .mixers
= { alc883_tagra_2ch_mixer
},
5612 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
5613 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5614 .dac_nids
= alc883_dac_nids
,
5615 .dig_out_nid
= ALC883_DIGOUT_NID
,
5616 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5617 .adc_nids
= alc883_adc_nids
,
5618 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
5619 .channel_mode
= alc883_3ST_2ch_modes
,
5620 .input_mux
= &alc883_capture_source
,
5621 .unsol_event
= alc883_tagra_unsol_event
,
5622 .init_hook
= alc883_tagra_automute
,
5624 [ALC888_DEMO_BOARD
] = {
5625 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
5626 .init_verbs
= { alc883_init_verbs
},
5627 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5628 .dac_nids
= alc883_dac_nids
,
5629 .dig_out_nid
= ALC883_DIGOUT_NID
,
5630 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5631 .adc_nids
= alc883_adc_nids
,
5632 .dig_in_nid
= ALC883_DIGIN_NID
,
5633 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
5634 .channel_mode
= alc883_sixstack_modes
,
5635 .input_mux
= &alc883_capture_source
,
5638 .mixers
= { alc883_base_mixer
,
5639 alc883_chmode_mixer
},
5640 /* On TravelMate laptops, GPIO 0 enables the internal speaker
5641 * and the headphone jack. Turn this on and rely on the
5642 * standard mute methods whenever the user wants to turn
5643 * these outputs off.
5645 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
5646 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5647 .dac_nids
= alc883_dac_nids
,
5648 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5649 .adc_nids
= alc883_adc_nids
,
5650 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
5651 .channel_mode
= alc883_3ST_2ch_modes
,
5652 .input_mux
= &alc883_capture_source
,
5655 .mixers
= { alc883_fivestack_mixer
,
5656 alc883_chmode_mixer
},
5657 .init_verbs
= { alc883_init_verbs
,
5658 alc883_medion_eapd_verbs
},
5659 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5660 .dac_nids
= alc883_dac_nids
,
5661 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5662 .adc_nids
= alc883_adc_nids
,
5663 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
5664 .channel_mode
= alc883_sixstack_modes
,
5665 .input_mux
= &alc883_capture_source
,
5667 [ALC883_LAPTOP_EAPD
] = {
5668 .mixers
= { alc883_base_mixer
,
5669 alc883_chmode_mixer
},
5670 .init_verbs
= { alc883_init_verbs
, alc882_eapd_verbs
},
5671 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5672 .dac_nids
= alc883_dac_nids
,
5673 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5674 .adc_nids
= alc883_adc_nids
,
5675 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
5676 .channel_mode
= alc883_3ST_2ch_modes
,
5677 .input_mux
= &alc883_capture_source
,
5683 * BIOS auto configuration
5685 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
5686 hda_nid_t nid
, int pin_type
,
5690 struct alc_spec
*spec
= codec
->spec
;
5693 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
5696 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
5698 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5700 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
5702 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
5706 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
5708 struct alc_spec
*spec
= codec
->spec
;
5711 for (i
= 0; i
<= HDA_SIDE
; i
++) {
5712 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
5714 alc883_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, i
);
5718 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
5720 struct alc_spec
*spec
= codec
->spec
;
5723 pin
= spec
->autocfg
.hp_pins
[0];
5724 if (pin
) /* connect to front */
5726 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
5729 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
5730 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
5732 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
5734 struct alc_spec
*spec
= codec
->spec
;
5737 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5738 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5739 if (alc883_is_input_pin(nid
)) {
5740 snd_hda_codec_write(codec
, nid
, 0,
5741 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5742 (i
<= AUTO_PIN_FRONT_MIC
?
5743 PIN_VREF80
: PIN_IN
));
5744 if (nid
!= ALC883_PIN_CD_NID
)
5745 snd_hda_codec_write(codec
, nid
, 0,
5746 AC_VERB_SET_AMP_GAIN_MUTE
,
5752 /* almost identical with ALC880 parser... */
5753 static int alc883_parse_auto_config(struct hda_codec
*codec
)
5755 struct alc_spec
*spec
= codec
->spec
;
5756 int err
= alc880_parse_auto_config(codec
);
5761 /* hack - override the init verbs */
5762 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
5763 spec
->mixers
[spec
->num_mixers
] = alc883_capture_mixer
;
5768 /* additional initialization for auto-configuration model */
5769 static void alc883_auto_init(struct hda_codec
*codec
)
5771 alc883_auto_init_multi_out(codec
);
5772 alc883_auto_init_hp_out(codec
);
5773 alc883_auto_init_analog_input(codec
);
5776 static int patch_alc883(struct hda_codec
*codec
)
5778 struct alc_spec
*spec
;
5779 int err
, board_config
;
5781 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5787 board_config
= snd_hda_check_board_config(codec
, ALC883_MODEL_LAST
,
5790 if (board_config
< 0) {
5791 printk(KERN_INFO
"hda_codec: Unknown model for ALC883, "
5792 "trying auto-probe from BIOS...\n");
5793 board_config
= ALC883_AUTO
;
5796 if (board_config
== ALC883_AUTO
) {
5797 /* automatic parse from the BIOS config */
5798 err
= alc883_parse_auto_config(codec
);
5804 "hda_codec: Cannot set up configuration "
5805 "from BIOS. Using base mode...\n");
5806 board_config
= ALC883_3ST_2ch_DIG
;
5810 if (board_config
!= ALC883_AUTO
)
5811 setup_preset(spec
, &alc883_presets
[board_config
]);
5813 spec
->stream_name_analog
= "ALC883 Analog";
5814 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
5815 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
5817 spec
->stream_name_digital
= "ALC883 Digital";
5818 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
5819 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
5821 if (! spec
->adc_nids
&& spec
->input_mux
) {
5822 spec
->adc_nids
= alc883_adc_nids
;
5823 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
5826 codec
->patch_ops
= alc_patch_ops
;
5827 if (board_config
== ALC883_AUTO
)
5828 spec
->init_hook
= alc883_auto_init
;
5837 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
5838 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
5840 #define alc262_dac_nids alc260_dac_nids
5841 #define alc262_adc_nids alc882_adc_nids
5842 #define alc262_adc_nids_alt alc882_adc_nids_alt
5844 #define alc262_modes alc260_modes
5845 #define alc262_capture_source alc882_capture_source
5847 static struct snd_kcontrol_new alc262_base_mixer
[] = {
5848 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5849 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5850 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5851 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5852 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5853 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5854 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5855 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5856 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5857 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5858 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
5859 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
5860 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
5861 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5862 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5863 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
5867 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
5868 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5869 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5870 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5871 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5872 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5873 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5874 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5875 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5876 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5877 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5878 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
5879 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
5880 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
5881 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5885 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
5886 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5887 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5888 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5889 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5890 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
5892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5894 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5895 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5896 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5897 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5898 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5899 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5900 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5901 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5902 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
5903 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
5907 #define alc262_capture_mixer alc882_capture_mixer
5908 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
5911 * generic initialization of ADC, input mixers and output mixers
5913 static struct hda_verb alc262_init_verbs
[] = {
5915 * Unmute ADC0-2 and set the default input to mic-in
5917 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5918 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5919 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5920 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5921 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5922 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5924 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5926 * Note: PASD motherboards uses the Line In 2 as the input for front panel
5929 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5930 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
5934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5937 * Set up output mixers (0x0c - 0x0e)
5939 /* set vol=0 to output mixers */
5940 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5941 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5942 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5943 /* set up input amps for analog loopback */
5944 /* Amp Indices: DAC = 0, mixer = 1 */
5945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5946 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5947 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5948 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5949 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5950 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5952 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5953 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
5954 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5955 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5956 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5957 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5959 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5960 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5961 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5962 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5963 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5965 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5966 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5968 /* FIXME: use matrix-type input source selection */
5969 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5970 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5971 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5972 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5973 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5974 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5976 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5977 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5978 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5979 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5982 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5983 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5984 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5989 static struct hda_verb alc262_hippo_unsol_verbs
[] = {
5990 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5991 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5995 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
5996 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
5997 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5998 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
6000 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
6001 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6005 /* mute/unmute internal speaker according to the hp jack and mute state */
6006 static void alc262_hippo_automute(struct hda_codec
*codec
, int force
)
6008 struct alc_spec
*spec
= codec
->spec
;
6011 if (force
|| ! spec
->sense_updated
) {
6012 unsigned int present
;
6013 /* need to execute and sync at first */
6014 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
6015 present
= snd_hda_codec_read(codec
, 0x15, 0,
6016 AC_VERB_GET_PIN_SENSE
, 0);
6017 spec
->jack_present
= (present
& 0x80000000) != 0;
6018 spec
->sense_updated
= 1;
6020 if (spec
->jack_present
) {
6021 /* mute internal speaker */
6022 snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
6024 snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
6027 /* unmute internal speaker if necessary */
6028 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
6029 snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
6031 mute
= snd_hda_codec_amp_read(codec
, 0x15, 1, HDA_OUTPUT
, 0);
6032 snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
6037 /* unsolicited event for HP jack sensing */
6038 static void alc262_hippo_unsol_event(struct hda_codec
*codec
,
6041 if ((res
>> 26) != ALC880_HP_EVENT
)
6043 alc262_hippo_automute(codec
, 1);
6046 static void alc262_hippo1_automute(struct hda_codec
*codec
, int force
)
6048 struct alc_spec
*spec
= codec
->spec
;
6051 if (force
|| ! spec
->sense_updated
) {
6052 unsigned int present
;
6053 /* need to execute and sync at first */
6054 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
6055 present
= snd_hda_codec_read(codec
, 0x1b, 0,
6056 AC_VERB_GET_PIN_SENSE
, 0);
6057 spec
->jack_present
= (present
& 0x80000000) != 0;
6058 spec
->sense_updated
= 1;
6060 if (spec
->jack_present
) {
6061 /* mute internal speaker */
6062 snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
6064 snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
6067 /* unmute internal speaker if necessary */
6068 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
6069 snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
6071 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 1, HDA_OUTPUT
, 0);
6072 snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
6077 /* unsolicited event for HP jack sensing */
6078 static void alc262_hippo1_unsol_event(struct hda_codec
*codec
,
6081 if ((res
>> 26) != ALC880_HP_EVENT
)
6083 alc262_hippo1_automute(codec
, 1);
6088 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
6091 #define ALC_HP_EVENT 0x37
6093 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
6094 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
6095 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6099 static struct hda_input_mux alc262_fujitsu_capture_source
= {
6107 static struct hda_input_mux alc262_HP_capture_source
= {
6111 { "Front Mic", 0x3 },
6118 /* mute/unmute internal speaker according to the hp jack and mute state */
6119 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
6121 struct alc_spec
*spec
= codec
->spec
;
6124 if (force
|| ! spec
->sense_updated
) {
6125 unsigned int present
;
6126 /* need to execute and sync at first */
6127 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
6128 present
= snd_hda_codec_read(codec
, 0x14, 0,
6129 AC_VERB_GET_PIN_SENSE
, 0);
6130 spec
->jack_present
= (present
& 0x80000000) != 0;
6131 spec
->sense_updated
= 1;
6133 if (spec
->jack_present
) {
6134 /* mute internal speaker */
6135 snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
6137 snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
6140 /* unmute internal speaker if necessary */
6141 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
6142 snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
6144 mute
= snd_hda_codec_amp_read(codec
, 0x14, 1, HDA_OUTPUT
, 0);
6145 snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
6150 /* unsolicited event for HP jack sensing */
6151 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
6154 if ((res
>> 26) != ALC_HP_EVENT
)
6156 alc262_fujitsu_automute(codec
, 1);
6159 /* bind volumes of both NID 0x0c and 0x0d */
6160 static int alc262_fujitsu_master_vol_put(struct snd_kcontrol
*kcontrol
,
6161 struct snd_ctl_elem_value
*ucontrol
)
6163 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6164 long *valp
= ucontrol
->value
.integer
.value
;
6167 change
= snd_hda_codec_amp_update(codec
, 0x0c, 0, HDA_OUTPUT
, 0,
6168 0x7f, valp
[0] & 0x7f);
6169 change
|= snd_hda_codec_amp_update(codec
, 0x0c, 1, HDA_OUTPUT
, 0,
6170 0x7f, valp
[1] & 0x7f);
6171 snd_hda_codec_amp_update(codec
, 0x0d, 0, HDA_OUTPUT
, 0,
6172 0x7f, valp
[0] & 0x7f);
6173 snd_hda_codec_amp_update(codec
, 0x0d, 1, HDA_OUTPUT
, 0,
6174 0x7f, valp
[1] & 0x7f);
6178 /* bind hp and internal speaker mute (with plug check) */
6179 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
6180 struct snd_ctl_elem_value
*ucontrol
)
6182 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6183 long *valp
= ucontrol
->value
.integer
.value
;
6186 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
6187 0x80, valp
[0] ? 0 : 0x80);
6188 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
6189 0x80, valp
[1] ? 0 : 0x80);
6190 if (change
|| codec
->in_resume
)
6191 alc262_fujitsu_automute(codec
, codec
->in_resume
);
6195 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
6197 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6198 .name
= "Master Playback Volume",
6199 .info
= snd_hda_mixer_amp_volume_info
,
6200 .get
= snd_hda_mixer_amp_volume_get
,
6201 .put
= alc262_fujitsu_master_vol_put
,
6202 .tlv
= { .c
= snd_hda_mixer_amp_tlv
},
6203 .private_value
= HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
6206 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6207 .name
= "Master Playback Switch",
6208 .info
= snd_hda_mixer_amp_switch_info
,
6209 .get
= snd_hda_mixer_amp_switch_get
,
6210 .put
= alc262_fujitsu_master_sw_put
,
6211 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
6213 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6214 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6215 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6217 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6221 /* additional init verbs for Benq laptops */
6222 static struct hda_verb alc262_EAPD_verbs
[] = {
6223 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
6224 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
6228 /* add playback controls from the parsed DAC table */
6229 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
, const struct auto_pin_cfg
*cfg
)
6234 spec
->multiout
.num_dacs
= 1; /* only use one dac */
6235 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
6236 spec
->multiout
.dac_nids
[0] = 2;
6238 nid
= cfg
->line_out_pins
[0];
6240 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "Front Playback Volume",
6241 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
))) < 0)
6243 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Front Playback Switch",
6244 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
6248 nid
= cfg
->speaker_pins
[0];
6251 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "Speaker Playback Volume",
6252 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT
))) < 0)
6254 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Speaker Playback Switch",
6255 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
))) < 0)
6258 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Speaker Playback Switch",
6259 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
6263 nid
= cfg
->hp_pins
[0];
6265 /* spec->multiout.hp_nid = 2; */
6267 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "Headphone Playback Volume",
6268 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT
))) < 0)
6270 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Headphone Playback Switch",
6271 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
))) < 0)
6274 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Headphone Playback Switch",
6275 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
6282 /* identical with ALC880 */
6283 #define alc262_auto_create_analog_input_ctls alc880_auto_create_analog_input_ctls
6286 * generic initialization of ADC, input mixers and output mixers
6288 static struct hda_verb alc262_volume_init_verbs
[] = {
6290 * Unmute ADC0-2 and set the default input to mic-in
6292 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6293 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6294 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6295 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6296 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6297 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6299 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6301 * Note: PASD motherboards uses the Line In 2 as the input for front panel
6304 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6305 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6307 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6308 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
6309 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
6312 * Set up output mixers (0x0c - 0x0f)
6314 /* set vol=0 to output mixers */
6315 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6316 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6317 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6319 /* set up input amps for analog loopback */
6320 /* Amp Indices: DAC = 0, mixer = 1 */
6321 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6322 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6323 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6324 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6325 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6326 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6328 /* FIXME: use matrix-type input source selection */
6329 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6330 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6331 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6332 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6336 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6337 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6338 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6339 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6341 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6342 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6343 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6349 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
6351 * Unmute ADC0-2 and set the default input to mic-in
6353 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6354 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6355 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6356 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6357 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6358 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6360 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6362 * Note: PASD motherboards uses the Line In 2 as the input for front panel
6365 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6366 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6367 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6368 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6369 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
6370 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
6371 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
6372 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(6)},
6375 * Set up output mixers (0x0c - 0x0e)
6377 /* set vol=0 to output mixers */
6378 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6379 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6380 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6382 /* set up input amps for analog loopback */
6383 /* Amp Indices: DAC = 0, mixer = 1 */
6384 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6385 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6386 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6387 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6388 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6389 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6391 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
6392 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6393 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6395 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6396 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6398 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6399 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6401 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6402 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6403 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6404 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6405 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6407 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
6408 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
6409 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
6410 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
6411 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
6412 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
6415 /* FIXME: use matrix-type input source selection */
6416 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6417 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6418 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6419 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
6420 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
6421 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
6423 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6424 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
6425 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
6426 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
6428 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6429 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
6430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
6431 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
6436 /* pcm configuration: identiacal with ALC880 */
6437 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
6438 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
6439 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
6440 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
6443 * BIOS auto configuration
6445 static int alc262_parse_auto_config(struct hda_codec
*codec
)
6447 struct alc_spec
*spec
= codec
->spec
;
6449 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
6451 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
6452 alc262_ignore
)) < 0)
6454 if (! spec
->autocfg
.line_outs
)
6455 return 0; /* can't find valid BIOS pin config */
6456 if ((err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0 ||
6457 (err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
)) < 0)
6460 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
6462 if (spec
->autocfg
.dig_out_pin
)
6463 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
6464 if (spec
->autocfg
.dig_in_pin
)
6465 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
6467 if (spec
->kctl_alloc
)
6468 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
6470 spec
->init_verbs
[spec
->num_init_verbs
++] = alc262_volume_init_verbs
;
6471 spec
->num_mux_defs
= 1;
6472 spec
->input_mux
= &spec
->private_imux
;
6477 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
6478 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
6479 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
6482 /* init callback for auto-configuration model -- overriding the default init */
6483 static void alc262_auto_init(struct hda_codec
*codec
)
6485 alc262_auto_init_multi_out(codec
);
6486 alc262_auto_init_hp_out(codec
);
6487 alc262_auto_init_analog_input(codec
);
6491 * configuration and preset
6493 static const char *alc262_models
[ALC262_MODEL_LAST
] = {
6494 [ALC262_BASIC
] = "basic",
6495 [ALC262_HIPPO
] = "hippo",
6496 [ALC262_HIPPO_1
] = "hippo_1",
6497 [ALC262_FUJITSU
] = "fujitsu",
6498 [ALC262_HP_BPC
] = "hp-bpc",
6499 [ALC262_BENQ_ED8
] = "benq",
6500 [ALC262_AUTO
] = "auto",
6503 static struct snd_pci_quirk alc262_cfg_tbl
[] = {
6504 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO
),
6505 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC
),
6506 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC
),
6507 SND_PCI_QUIRK(0x103c, 0x2801, "HP q954", ALC262_HP_BPC
),
6508 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC
),
6509 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC
),
6510 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO
),
6511 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU
),
6512 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1
),
6513 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8
),
6517 static struct alc_config_preset alc262_presets
[] = {
6519 .mixers
= { alc262_base_mixer
},
6520 .init_verbs
= { alc262_init_verbs
},
6521 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
6522 .dac_nids
= alc262_dac_nids
,
6524 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
6525 .channel_mode
= alc262_modes
,
6526 .input_mux
= &alc262_capture_source
,
6529 .mixers
= { alc262_base_mixer
},
6530 .init_verbs
= { alc262_init_verbs
, alc262_hippo_unsol_verbs
},
6531 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
6532 .dac_nids
= alc262_dac_nids
,
6534 .dig_out_nid
= ALC262_DIGOUT_NID
,
6535 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
6536 .channel_mode
= alc262_modes
,
6537 .input_mux
= &alc262_capture_source
,
6538 .unsol_event
= alc262_hippo_unsol_event
,
6540 [ALC262_HIPPO_1
] = {
6541 .mixers
= { alc262_hippo1_mixer
},
6542 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
6543 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
6544 .dac_nids
= alc262_dac_nids
,
6546 .dig_out_nid
= ALC262_DIGOUT_NID
,
6547 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
6548 .channel_mode
= alc262_modes
,
6549 .input_mux
= &alc262_capture_source
,
6550 .unsol_event
= alc262_hippo1_unsol_event
,
6552 [ALC262_FUJITSU
] = {
6553 .mixers
= { alc262_fujitsu_mixer
},
6554 .init_verbs
= { alc262_init_verbs
, alc262_fujitsu_unsol_verbs
},
6555 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
6556 .dac_nids
= alc262_dac_nids
,
6558 .dig_out_nid
= ALC262_DIGOUT_NID
,
6559 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
6560 .channel_mode
= alc262_modes
,
6561 .input_mux
= &alc262_fujitsu_capture_source
,
6562 .unsol_event
= alc262_fujitsu_unsol_event
,
6565 .mixers
= { alc262_HP_BPC_mixer
},
6566 .init_verbs
= { alc262_HP_BPC_init_verbs
},
6567 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
6568 .dac_nids
= alc262_dac_nids
,
6570 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
6571 .channel_mode
= alc262_modes
,
6572 .input_mux
= &alc262_HP_capture_source
,
6574 [ALC262_BENQ_ED8
] = {
6575 .mixers
= { alc262_base_mixer
},
6576 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
6577 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
6578 .dac_nids
= alc262_dac_nids
,
6580 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
6581 .channel_mode
= alc262_modes
,
6582 .input_mux
= &alc262_capture_source
,
6586 static int patch_alc262(struct hda_codec
*codec
)
6588 struct alc_spec
*spec
;
6592 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
6598 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is under-run */
6601 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
6602 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
6603 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
6604 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
6608 board_config
= snd_hda_check_board_config(codec
, ALC262_MODEL_LAST
,
6612 if (board_config
< 0) {
6613 printk(KERN_INFO
"hda_codec: Unknown model for ALC262, "
6614 "trying auto-probe from BIOS...\n");
6615 board_config
= ALC262_AUTO
;
6618 if (board_config
== ALC262_AUTO
) {
6619 /* automatic parse from the BIOS config */
6620 err
= alc262_parse_auto_config(codec
);
6626 "hda_codec: Cannot set up configuration "
6627 "from BIOS. Using base mode...\n");
6628 board_config
= ALC262_BASIC
;
6632 if (board_config
!= ALC262_AUTO
)
6633 setup_preset(spec
, &alc262_presets
[board_config
]);
6635 spec
->stream_name_analog
= "ALC262 Analog";
6636 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
6637 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
6639 spec
->stream_name_digital
= "ALC262 Digital";
6640 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
6641 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
6643 if (! spec
->adc_nids
&& spec
->input_mux
) {
6644 /* check whether NID 0x07 is valid */
6645 unsigned int wcap
= get_wcaps(codec
, 0x07);
6647 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
6648 if (wcap
!= AC_WID_AUD_IN
) {
6649 spec
->adc_nids
= alc262_adc_nids_alt
;
6650 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids_alt
);
6651 spec
->mixers
[spec
->num_mixers
] = alc262_capture_alt_mixer
;
6654 spec
->adc_nids
= alc262_adc_nids
;
6655 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids
);
6656 spec
->mixers
[spec
->num_mixers
] = alc262_capture_mixer
;
6661 codec
->patch_ops
= alc_patch_ops
;
6662 if (board_config
== ALC262_AUTO
)
6663 spec
->init_hook
= alc262_auto_init
;
6669 * ALC861 channel source setting (2/6 channel selection for 3-stack)
6673 * set the path ways for 2 channel output
6674 * need to set the codec line out and mic 1 pin widgets to inputs
6676 static struct hda_verb alc861_threestack_ch2_init
[] = {
6677 /* set pin widget 1Ah (line in) for input */
6678 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6679 /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */
6680 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6682 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
6684 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
6685 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
6691 * need to set the codec line out and mic 1 pin widgets to outputs
6693 static struct hda_verb alc861_threestack_ch6_init
[] = {
6694 /* set pin widget 1Ah (line in) for output (Back Surround)*/
6695 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6696 /* set pin widget 18h (mic1) for output (CLFE)*/
6697 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6699 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6700 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6702 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
6704 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
6705 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
6710 static struct hda_channel_mode alc861_threestack_modes
[2] = {
6711 { 2, alc861_threestack_ch2_init
},
6712 { 6, alc861_threestack_ch6_init
},
6714 /* Set mic1 as input and unmute the mixer */
6715 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
6716 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6717 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
6720 /* Set mic1 as output and mute mixer */
6721 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
6722 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6723 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
6727 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
6728 { 2, alc861_uniwill_m31_ch2_init
},
6729 { 4, alc861_uniwill_m31_ch4_init
},
6732 /* Set mic1 and line-in as input and unmute the mixer */
6733 static struct hda_verb alc861_asus_ch2_init
[] = {
6734 /* set pin widget 1Ah (line in) for input */
6735 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6736 /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */
6737 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6739 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
6741 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
6742 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
6746 /* Set mic1 nad line-in as output and mute mixer */
6747 static struct hda_verb alc861_asus_ch6_init
[] = {
6748 /* set pin widget 1Ah (line in) for output (Back Surround)*/
6749 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6750 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
6751 /* set pin widget 18h (mic1) for output (CLFE)*/
6752 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6753 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
6754 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6755 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6757 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
6759 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
6760 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
6765 static struct hda_channel_mode alc861_asus_modes
[2] = {
6766 { 2, alc861_asus_ch2_init
},
6767 { 6, alc861_asus_ch6_init
},
6772 static struct snd_kcontrol_new alc861_base_mixer
[] = {
6773 /* output mixer control */
6774 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
6775 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
6776 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
6777 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
6778 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
6780 /*Input mixer control */
6781 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
6782 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
6783 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
6784 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
6785 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
6786 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
6787 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
6788 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
6789 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
6790 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
6792 /* Capture mixer control */
6793 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6794 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6796 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6797 .name
= "Capture Source",
6799 .info
= alc_mux_enum_info
,
6800 .get
= alc_mux_enum_get
,
6801 .put
= alc_mux_enum_put
,
6806 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
6807 /* output mixer control */
6808 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
6809 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
6810 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
6811 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
6812 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
6814 /* Input mixer control */
6815 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
6816 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
6817 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
6818 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
6819 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
6820 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
6821 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
6822 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
6823 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
6824 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
6826 /* Capture mixer control */
6827 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6828 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6830 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6831 .name
= "Capture Source",
6833 .info
= alc_mux_enum_info
,
6834 .get
= alc_mux_enum_get
,
6835 .put
= alc_mux_enum_put
,
6838 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6839 .name
= "Channel Mode",
6840 .info
= alc_ch_mode_info
,
6841 .get
= alc_ch_mode_get
,
6842 .put
= alc_ch_mode_put
,
6843 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
6848 static struct snd_kcontrol_new alc861_toshiba_mixer
[] = {
6849 /* output mixer control */
6850 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
6851 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
6852 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
6854 /*Capture mixer control */
6855 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6856 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6858 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6859 .name
= "Capture Source",
6861 .info
= alc_mux_enum_info
,
6862 .get
= alc_mux_enum_get
,
6863 .put
= alc_mux_enum_put
,
6869 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
6870 /* output mixer control */
6871 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
6872 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
6873 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
6874 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
6875 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
6877 /* Input mixer control */
6878 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
6879 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
6880 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
6881 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
6882 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
6883 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
6884 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
6885 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
6886 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
6887 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
6889 /* Capture mixer control */
6890 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6891 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6893 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6894 .name
= "Capture Source",
6896 .info
= alc_mux_enum_info
,
6897 .get
= alc_mux_enum_get
,
6898 .put
= alc_mux_enum_put
,
6901 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6902 .name
= "Channel Mode",
6903 .info
= alc_ch_mode_info
,
6904 .get
= alc_ch_mode_get
,
6905 .put
= alc_ch_mode_put
,
6906 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
6911 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
6912 /* output mixer control */
6913 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
6914 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
6915 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
6916 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
6917 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
6919 /* Input mixer control */
6920 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
6921 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6922 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
6923 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
6924 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
6925 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
6926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
6927 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
6928 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
6929 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
), /* was HDA_INPUT (why?) */
6931 /* Capture mixer control */
6932 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6933 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6935 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6936 .name
= "Capture Source",
6938 .info
= alc_mux_enum_info
,
6939 .get
= alc_mux_enum_get
,
6940 .put
= alc_mux_enum_put
,
6943 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6944 .name
= "Channel Mode",
6945 .info
= alc_ch_mode_info
,
6946 .get
= alc_ch_mode_get
,
6947 .put
= alc_ch_mode_put
,
6948 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
6953 /* additional mixer */
6954 static struct snd_kcontrol_new alc861_asus_laptop_mixer
[] = {
6955 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
6956 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
6957 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT
),
6958 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT
),
6963 * generic initialization of ADC, input mixers and output mixers
6965 static struct hda_verb alc861_base_init_verbs
[] = {
6967 * Unmute ADC0 and set the default input to mic-in
6969 /* port-A for surround (rear panel) */
6970 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6971 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6972 /* port-B for mic-in (rear panel) with vref */
6973 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6974 /* port-C for line-in (rear panel) */
6975 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6976 /* port-D for Front */
6977 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6978 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6979 /* port-E for HP out (front panel) */
6980 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
6981 /* route front PCM to HP */
6982 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6983 /* port-F for mic-in (front panel) with vref */
6984 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6985 /* port-G for CLFE (rear panel) */
6986 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6987 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6988 /* port-H for side (rear panel) */
6989 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6990 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6992 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6993 /* route front mic to ADC1*/
6994 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6995 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6997 /* Unmute DAC0~3 & spdif out*/
6998 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6999 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7000 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7001 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7002 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7004 /* Unmute Mixer 14 (mic) 1c (Line in)*/
7005 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7006 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7007 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7008 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7010 /* Unmute Stereo Mixer 15 */
7011 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7012 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7013 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7014 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c }, //Output 0~12 step
7016 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7017 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7018 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7019 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7020 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7021 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7022 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7023 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7024 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front)
7025 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7030 static struct hda_verb alc861_threestack_init_verbs
[] = {
7032 * Unmute ADC0 and set the default input to mic-in
7034 /* port-A for surround (rear panel) */
7035 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7036 /* port-B for mic-in (rear panel) with vref */
7037 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
7038 /* port-C for line-in (rear panel) */
7039 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
7040 /* port-D for Front */
7041 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
7042 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7043 /* port-E for HP out (front panel) */
7044 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
7045 /* route front PCM to HP */
7046 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7047 /* port-F for mic-in (front panel) with vref */
7048 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
7049 /* port-G for CLFE (rear panel) */
7050 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7051 /* port-H for side (rear panel) */
7052 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7054 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
7055 /* route front mic to ADC1*/
7056 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7057 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7058 /* Unmute DAC0~3 & spdif out*/
7059 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7060 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7061 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7062 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7063 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7065 /* Unmute Mixer 14 (mic) 1c (Line in)*/
7066 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7067 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7068 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7069 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7071 /* Unmute Stereo Mixer 15 */
7072 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7073 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7074 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7075 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c }, //Output 0~12 step
7077 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7078 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7079 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7080 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7081 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7082 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7083 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7084 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7085 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front)
7086 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7090 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
7092 * Unmute ADC0 and set the default input to mic-in
7094 /* port-A for surround (rear panel) */
7095 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7096 /* port-B for mic-in (rear panel) with vref */
7097 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
7098 /* port-C for line-in (rear panel) */
7099 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
7100 /* port-D for Front */
7101 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
7102 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7103 /* port-E for HP out (front panel) */
7104 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 }, // this has to be set to VREF80
7105 /* route front PCM to HP */
7106 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7107 /* port-F for mic-in (front panel) with vref */
7108 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
7109 /* port-G for CLFE (rear panel) */
7110 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7111 /* port-H for side (rear panel) */
7112 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7114 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
7115 /* route front mic to ADC1*/
7116 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7117 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7118 /* Unmute DAC0~3 & spdif out*/
7119 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7120 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7121 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7122 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7123 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7125 /* Unmute Mixer 14 (mic) 1c (Line in)*/
7126 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7127 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7128 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7129 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7131 /* Unmute Stereo Mixer 15 */
7132 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7133 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7134 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7135 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c }, //Output 0~12 step
7137 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7138 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7139 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7140 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7141 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7142 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7143 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7144 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7145 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front)
7146 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7150 static struct hda_verb alc861_asus_init_verbs
[] = {
7152 * Unmute ADC0 and set the default input to mic-in
7154 /* port-A for surround (rear panel) | according to codec#0 this is the HP jack*/
7155 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
7156 /* route front PCM to HP */
7157 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7158 /* port-B for mic-in (rear panel) with vref */
7159 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
7160 /* port-C for line-in (rear panel) */
7161 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
7162 /* port-D for Front */
7163 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
7164 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7165 /* port-E for HP out (front panel) */
7166 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 }, /* this has to be set to VREF80 */
7167 /* route front PCM to HP */
7168 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7169 /* port-F for mic-in (front panel) with vref */
7170 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
7171 /* port-G for CLFE (rear panel) */
7172 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
7173 /* port-H for side (rear panel) */
7174 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
7176 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
7177 /* route front mic to ADC1*/
7178 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7179 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7180 /* Unmute DAC0~3 & spdif out*/
7181 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7182 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7183 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7184 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7185 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7186 /* Unmute Mixer 14 (mic) 1c (Line in)*/
7187 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7188 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7189 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7190 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7192 /* Unmute Stereo Mixer 15 */
7193 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7194 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7195 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7196 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c }, /* Output 0~12 step */
7198 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7199 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7200 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7201 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7202 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7203 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7204 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7205 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7206 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)}, /* hp used DAC 3 (Front) */
7207 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7211 /* additional init verbs for ASUS laptops */
7212 static struct hda_verb alc861_asus_laptop_init_verbs
[] = {
7213 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x45 }, /* HP-out */
7214 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2) }, /* mute line-in */
7219 * generic initialization of ADC, input mixers and output mixers
7221 static struct hda_verb alc861_auto_init_verbs
[] = {
7223 * Unmute ADC0 and set the default input to mic-in
7225 // {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7226 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7228 /* Unmute DAC0~3 & spdif out*/
7229 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7230 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7231 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7232 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7235 /* Unmute Mixer 14 (mic) 1c (Line in)*/
7236 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7237 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7238 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7239 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7241 /* Unmute Stereo Mixer 15 */
7242 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7243 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7244 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7245 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
7247 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7248 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7249 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7250 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7251 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7252 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7253 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7254 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7256 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7257 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7258 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7259 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
7260 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7261 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7262 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7263 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
7265 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, // set Mic 1
7270 static struct hda_verb alc861_toshiba_init_verbs
[] = {
7271 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
7276 /* toggle speaker-output according to the hp-jack state */
7277 static void alc861_toshiba_automute(struct hda_codec
*codec
)
7279 unsigned int present
;
7281 present
= snd_hda_codec_read(codec
, 0x0f, 0,
7282 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7283 snd_hda_codec_amp_update(codec
, 0x16, 0, HDA_INPUT
, 0,
7284 0x80, present
? 0x80 : 0);
7285 snd_hda_codec_amp_update(codec
, 0x16, 1, HDA_INPUT
, 0,
7286 0x80, present
? 0x80 : 0);
7287 snd_hda_codec_amp_update(codec
, 0x1a, 0, HDA_INPUT
, 3,
7288 0x80, present
? 0 : 0x80);
7289 snd_hda_codec_amp_update(codec
, 0x1a, 1, HDA_INPUT
, 3,
7290 0x80, present
? 0 : 0x80);
7293 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
7296 /* Looks like the unsol event is incompatible with the standard
7297 * definition. 6bit tag is placed at 26 bit!
7299 if ((res
>> 26) == ALC880_HP_EVENT
)
7300 alc861_toshiba_automute(codec
);
7303 /* pcm configuration: identiacal with ALC880 */
7304 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
7305 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
7306 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
7307 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
7310 #define ALC861_DIGOUT_NID 0x07
7312 static struct hda_channel_mode alc861_8ch_modes
[1] = {
7316 static hda_nid_t alc861_dac_nids
[4] = {
7317 /* front, surround, clfe, side */
7318 0x03, 0x06, 0x05, 0x04
7321 static hda_nid_t alc660_dac_nids
[3] = {
7322 /* front, clfe, surround */
7326 static hda_nid_t alc861_adc_nids
[1] = {
7331 static struct hda_input_mux alc861_capture_source
= {
7335 { "Front Mic", 0x3 },
7342 /* fill in the dac_nids table from the parsed pin configuration */
7343 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
, const struct auto_pin_cfg
*cfg
)
7348 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
7349 for (i
= 0; i
< cfg
->line_outs
; i
++) {
7350 nid
= cfg
->line_out_pins
[i
];
7352 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
7354 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
7357 spec
->multiout
.num_dacs
= cfg
->line_outs
;
7361 /* add playback controls from the parsed DAC table */
7362 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
7363 const struct auto_pin_cfg
*cfg
)
7366 static const char *chname
[4] = { "Front", "Surround", NULL
/*CLFE*/, "Side" };
7370 for (i
= 0; i
< cfg
->line_outs
; i
++) {
7371 nid
= spec
->multiout
.dac_nids
[i
];
7376 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, "Center Playback Switch",
7377 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
))) < 0)
7379 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, "LFE Playback Switch",
7380 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
))) < 0)
7383 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1; idx
++)
7384 if (nid
== alc861_dac_nids
[idx
])
7386 sprintf(name
, "%s Playback Switch", chname
[idx
]);
7387 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
7388 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
7395 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
7403 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
7405 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Headphone Playback Switch",
7406 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
7408 spec
->multiout
.hp_nid
= nid
;
7413 /* create playback/capture controls for input pins */
7414 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
, const struct auto_pin_cfg
*cfg
)
7416 struct hda_input_mux
*imux
= &spec
->private_imux
;
7417 int i
, err
, idx
, idx1
;
7419 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
7420 switch(cfg
->input_pins
[i
]) {
7445 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
7446 auto_pin_cfg_labels
[i
], idx
, 0x15);
7450 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
7451 imux
->items
[imux
->num_items
].index
= idx1
;
7457 static struct snd_kcontrol_new alc861_capture_mixer
[] = {
7458 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7459 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7462 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7463 /* The multiple "Capture Source" controls confuse alsamixer
7464 * So call somewhat different..
7465 *FIXME: the controls appear in the "playback" view!
7467 /* .name = "Capture Source", */
7468 .name
= "Input Source",
7470 .info
= alc_mux_enum_info
,
7471 .get
= alc_mux_enum_get
,
7472 .put
= alc_mux_enum_put
,
7477 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
, hda_nid_t nid
,
7478 int pin_type
, int dac_idx
)
7482 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
7483 snd_hda_codec_write(codec
, dac_idx
, 0, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
7487 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
7489 struct alc_spec
*spec
= codec
->spec
;
7492 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
7493 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
7495 alc861_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, spec
->multiout
.dac_nids
[i
]);
7499 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
7501 struct alc_spec
*spec
= codec
->spec
;
7504 pin
= spec
->autocfg
.hp_pins
[0];
7505 if (pin
) /* connect to front */
7506 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, spec
->multiout
.dac_nids
[0]);
7509 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
7511 struct alc_spec
*spec
= codec
->spec
;
7514 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
7515 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
7516 if ((nid
>=0x0c) && (nid
<=0x11)) {
7517 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
7518 i
<= AUTO_PIN_FRONT_MIC
? PIN_VREF80
: PIN_IN
);
7523 /* parse the BIOS configuration and set up the alc_spec */
7524 /* return 1 if successful, 0 if the proper config is not found, or a negative error code */
7525 static int alc861_parse_auto_config(struct hda_codec
*codec
)
7527 struct alc_spec
*spec
= codec
->spec
;
7529 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
7531 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
7532 alc861_ignore
)) < 0)
7534 if (! spec
->autocfg
.line_outs
)
7535 return 0; /* can't find valid BIOS pin config */
7537 if ((err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
)) < 0 ||
7538 (err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0 ||
7539 (err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pins
[0])) < 0 ||
7540 (err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
)) < 0)
7543 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
7545 if (spec
->autocfg
.dig_out_pin
)
7546 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
7548 if (spec
->kctl_alloc
)
7549 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
7551 spec
->init_verbs
[spec
->num_init_verbs
++] = alc861_auto_init_verbs
;
7553 spec
->num_mux_defs
= 1;
7554 spec
->input_mux
= &spec
->private_imux
;
7556 spec
->adc_nids
= alc861_adc_nids
;
7557 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
7558 spec
->mixers
[spec
->num_mixers
] = alc861_capture_mixer
;
7564 /* additional initialization for auto-configuration model */
7565 static void alc861_auto_init(struct hda_codec
*codec
)
7567 alc861_auto_init_multi_out(codec
);
7568 alc861_auto_init_hp_out(codec
);
7569 alc861_auto_init_analog_input(codec
);
7574 * configuration and preset
7576 static const char *alc861_models
[ALC861_MODEL_LAST
] = {
7577 [ALC861_3ST
] = "3stack",
7578 [ALC660_3ST
] = "3stack-660",
7579 [ALC861_3ST_DIG
] = "3stack-dig",
7580 [ALC861_6ST_DIG
] = "6stack-dig",
7581 [ALC861_UNIWILL_M31
] = "uniwill-m31",
7582 [ALC861_TOSHIBA
] = "toshiba",
7583 [ALC861_ASUS
] = "asus",
7584 [ALC861_ASUS_LAPTOP
] = "asus-laptop",
7585 [ALC861_AUTO
] = "auto",
7588 static struct snd_pci_quirk alc861_cfg_tbl
[] = {
7589 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
7590 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP
),
7591 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS
),
7592 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660_3ST
),
7593 SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA
),
7594 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31
),
7595 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST
),
7599 static struct alc_config_preset alc861_presets
[] = {
7601 .mixers
= { alc861_3ST_mixer
},
7602 .init_verbs
= { alc861_threestack_init_verbs
},
7603 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7604 .dac_nids
= alc861_dac_nids
,
7605 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
7606 .channel_mode
= alc861_threestack_modes
,
7608 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7609 .adc_nids
= alc861_adc_nids
,
7610 .input_mux
= &alc861_capture_source
,
7612 [ALC861_3ST_DIG
] = {
7613 .mixers
= { alc861_base_mixer
},
7614 .init_verbs
= { alc861_threestack_init_verbs
},
7615 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7616 .dac_nids
= alc861_dac_nids
,
7617 .dig_out_nid
= ALC861_DIGOUT_NID
,
7618 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
7619 .channel_mode
= alc861_threestack_modes
,
7621 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7622 .adc_nids
= alc861_adc_nids
,
7623 .input_mux
= &alc861_capture_source
,
7625 [ALC861_6ST_DIG
] = {
7626 .mixers
= { alc861_base_mixer
},
7627 .init_verbs
= { alc861_base_init_verbs
},
7628 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7629 .dac_nids
= alc861_dac_nids
,
7630 .dig_out_nid
= ALC861_DIGOUT_NID
,
7631 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
7632 .channel_mode
= alc861_8ch_modes
,
7633 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7634 .adc_nids
= alc861_adc_nids
,
7635 .input_mux
= &alc861_capture_source
,
7638 .mixers
= { alc861_3ST_mixer
},
7639 .init_verbs
= { alc861_threestack_init_verbs
},
7640 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
7641 .dac_nids
= alc660_dac_nids
,
7642 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
7643 .channel_mode
= alc861_threestack_modes
,
7645 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7646 .adc_nids
= alc861_adc_nids
,
7647 .input_mux
= &alc861_capture_source
,
7649 [ALC861_UNIWILL_M31
] = {
7650 .mixers
= { alc861_uniwill_m31_mixer
},
7651 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
7652 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7653 .dac_nids
= alc861_dac_nids
,
7654 .dig_out_nid
= ALC861_DIGOUT_NID
,
7655 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
7656 .channel_mode
= alc861_uniwill_m31_modes
,
7658 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7659 .adc_nids
= alc861_adc_nids
,
7660 .input_mux
= &alc861_capture_source
,
7662 [ALC861_TOSHIBA
] = {
7663 .mixers
= { alc861_toshiba_mixer
},
7664 .init_verbs
= { alc861_base_init_verbs
, alc861_toshiba_init_verbs
},
7665 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7666 .dac_nids
= alc861_dac_nids
,
7667 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7668 .channel_mode
= alc883_3ST_2ch_modes
,
7669 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7670 .adc_nids
= alc861_adc_nids
,
7671 .input_mux
= &alc861_capture_source
,
7672 .unsol_event
= alc861_toshiba_unsol_event
,
7673 .init_hook
= alc861_toshiba_automute
,
7676 .mixers
= { alc861_asus_mixer
},
7677 .init_verbs
= { alc861_asus_init_verbs
},
7678 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7679 .dac_nids
= alc861_dac_nids
,
7680 .dig_out_nid
= ALC861_DIGOUT_NID
,
7681 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
7682 .channel_mode
= alc861_asus_modes
,
7685 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7686 .adc_nids
= alc861_adc_nids
,
7687 .input_mux
= &alc861_capture_source
,
7689 [ALC861_ASUS_LAPTOP
] = {
7690 .mixers
= { alc861_toshiba_mixer
, alc861_asus_laptop_mixer
},
7691 .init_verbs
= { alc861_asus_init_verbs
,
7692 alc861_asus_laptop_init_verbs
},
7693 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7694 .dac_nids
= alc861_dac_nids
,
7695 .dig_out_nid
= ALC861_DIGOUT_NID
,
7696 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7697 .channel_mode
= alc883_3ST_2ch_modes
,
7699 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7700 .adc_nids
= alc861_adc_nids
,
7701 .input_mux
= &alc861_capture_source
,
7706 static int patch_alc861(struct hda_codec
*codec
)
7708 struct alc_spec
*spec
;
7712 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
7718 board_config
= snd_hda_check_board_config(codec
, ALC861_MODEL_LAST
,
7722 if (board_config
< 0) {
7723 printk(KERN_INFO
"hda_codec: Unknown model for ALC861, "
7724 "trying auto-probe from BIOS...\n");
7725 board_config
= ALC861_AUTO
;
7728 if (board_config
== ALC861_AUTO
) {
7729 /* automatic parse from the BIOS config */
7730 err
= alc861_parse_auto_config(codec
);
7736 "hda_codec: Cannot set up configuration "
7737 "from BIOS. Using base mode...\n");
7738 board_config
= ALC861_3ST_DIG
;
7742 if (board_config
!= ALC861_AUTO
)
7743 setup_preset(spec
, &alc861_presets
[board_config
]);
7745 spec
->stream_name_analog
= "ALC861 Analog";
7746 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
7747 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
7749 spec
->stream_name_digital
= "ALC861 Digital";
7750 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
7751 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
7753 codec
->patch_ops
= alc_patch_ops
;
7754 if (board_config
== ALC861_AUTO
)
7755 spec
->init_hook
= alc861_auto_init
;
7763 struct hda_codec_preset snd_hda_preset_realtek
[] = {
7764 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
7765 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
7766 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
7767 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
7768 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
7769 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
7770 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
7771 { .id
= 0x10ec0861, .rev
= 0x100300, .name
= "ALC861",
7772 .patch
= patch_alc861
},
7773 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
7774 .patch
= patch_alc861
},
7775 { .id
= 0x10ec0660, .name
= "ALC660", .patch
= patch_alc861
},