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 */
124 ALC883_TARGA_2ch_DIG
,
133 #define GPIO_MASK 0x03
136 /* codec parameterization */
137 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
138 unsigned int num_mixers
;
140 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
144 unsigned int num_init_verbs
;
146 char *stream_name_analog
; /* analog PCM stream */
147 struct hda_pcm_stream
*stream_analog_playback
;
148 struct hda_pcm_stream
*stream_analog_capture
;
150 char *stream_name_digital
; /* digital PCM stream */
151 struct hda_pcm_stream
*stream_digital_playback
;
152 struct hda_pcm_stream
*stream_digital_capture
;
155 struct hda_multi_out multiout
; /* playback set-up
156 * max_channels, dacs must be set
157 * dig_out_nid and hp_nid are optional
161 unsigned int num_adc_nids
;
163 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
166 unsigned int num_mux_defs
;
167 const struct hda_input_mux
*input_mux
;
168 unsigned int cur_mux
[3];
171 const struct hda_channel_mode
*channel_mode
;
172 int num_channel_mode
;
175 /* PCM information */
176 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
178 /* dynamic controls, init_verbs and input_mux */
179 struct auto_pin_cfg autocfg
;
180 unsigned int num_kctl_alloc
, num_kctl_used
;
181 struct snd_kcontrol_new
*kctl_alloc
;
182 struct hda_input_mux private_imux
;
183 hda_nid_t private_dac_nids
[5];
186 void (*init_hook
)(struct hda_codec
*codec
);
187 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
189 /* for pin sensing */
190 unsigned int sense_updated
: 1;
191 unsigned int jack_present
: 1;
195 * configuration template - to be copied to the spec instance
197 struct alc_config_preset
{
198 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
201 const struct hda_verb
*init_verbs
[5];
202 unsigned int num_dacs
;
204 hda_nid_t dig_out_nid
; /* optional */
205 hda_nid_t hp_nid
; /* optional */
206 unsigned int num_adc_nids
;
208 hda_nid_t dig_in_nid
;
209 unsigned int num_channel_mode
;
210 const struct hda_channel_mode
*channel_mode
;
212 unsigned int num_mux_defs
;
213 const struct hda_input_mux
*input_mux
;
214 void (*unsol_event
)(struct hda_codec
*, unsigned int);
215 void (*init_hook
)(struct hda_codec
*);
222 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
223 struct snd_ctl_elem_info
*uinfo
)
225 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
226 struct alc_spec
*spec
= codec
->spec
;
227 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
228 if (mux_idx
>= spec
->num_mux_defs
)
230 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
233 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
234 struct snd_ctl_elem_value
*ucontrol
)
236 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
237 struct alc_spec
*spec
= codec
->spec
;
238 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
240 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
244 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
245 struct snd_ctl_elem_value
*ucontrol
)
247 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
248 struct alc_spec
*spec
= codec
->spec
;
249 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
250 unsigned int mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
251 return snd_hda_input_mux_put(codec
, &spec
->input_mux
[mux_idx
], ucontrol
,
252 spec
->adc_nids
[adc_idx
],
253 &spec
->cur_mux
[adc_idx
]);
258 * channel mode setting
260 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
261 struct snd_ctl_elem_info
*uinfo
)
263 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
264 struct alc_spec
*spec
= codec
->spec
;
265 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
266 spec
->num_channel_mode
);
269 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
270 struct snd_ctl_elem_value
*ucontrol
)
272 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
273 struct alc_spec
*spec
= codec
->spec
;
274 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
275 spec
->num_channel_mode
,
276 spec
->multiout
.max_channels
);
279 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
280 struct snd_ctl_elem_value
*ucontrol
)
282 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
283 struct alc_spec
*spec
= codec
->spec
;
284 int err
= snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
285 spec
->num_channel_mode
,
286 &spec
->multiout
.max_channels
);
287 if (err
>= 0 && spec
->need_dac_fix
)
288 spec
->multiout
.num_dacs
= spec
->multiout
.max_channels
/ 2;
293 * Control the mode of pin widget settings via the mixer. "pc" is used
294 * instead of "%" to avoid consequences of accidently treating the % as
295 * being part of a format specifier. Maximum allowed length of a value is
296 * 63 characters plus NULL terminator.
298 * Note: some retasking pin complexes seem to ignore requests for input
299 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
300 * are requested. Therefore order this list so that this behaviour will not
301 * cause problems when mixer clients move through the enum sequentially.
302 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
305 static char *alc_pin_mode_names
[] = {
306 "Mic 50pc bias", "Mic 80pc bias",
307 "Line in", "Line out", "Headphone out",
309 static unsigned char alc_pin_mode_values
[] = {
310 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
312 /* The control can present all 5 options, or it can limit the options based
313 * in the pin being assumed to be exclusively an input or an output pin. In
314 * addition, "input" pins may or may not process the mic bias option
315 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
316 * accept requests for bias as of chip versions up to March 2006) and/or
317 * wiring in the computer.
319 #define ALC_PIN_DIR_IN 0x00
320 #define ALC_PIN_DIR_OUT 0x01
321 #define ALC_PIN_DIR_INOUT 0x02
322 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
323 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
325 /* Info about the pin modes supported by the different pin direction modes.
326 * For each direction the minimum and maximum values are given.
328 static signed char alc_pin_mode_dir_info
[5][2] = {
329 { 0, 2 }, /* ALC_PIN_DIR_IN */
330 { 3, 4 }, /* ALC_PIN_DIR_OUT */
331 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
332 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
333 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
335 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
336 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
337 #define alc_pin_mode_n_items(_dir) \
338 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
340 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
341 struct snd_ctl_elem_info
*uinfo
)
343 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
344 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
346 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
348 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
350 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
351 item_num
= alc_pin_mode_min(dir
);
352 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
356 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
357 struct snd_ctl_elem_value
*ucontrol
)
360 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
361 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
362 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
363 long *valp
= ucontrol
->value
.integer
.value
;
364 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
365 AC_VERB_GET_PIN_WIDGET_CONTROL
,
368 /* Find enumerated value for current pinctl setting */
369 i
= alc_pin_mode_min(dir
);
370 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
372 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
376 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
377 struct snd_ctl_elem_value
*ucontrol
)
380 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
381 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
382 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
383 long val
= *ucontrol
->value
.integer
.value
;
384 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
385 AC_VERB_GET_PIN_WIDGET_CONTROL
,
388 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
389 val
= alc_pin_mode_min(dir
);
391 change
= pinctl
!= alc_pin_mode_values
[val
];
393 /* Set pin mode to that requested */
394 snd_hda_codec_write(codec
,nid
,0,AC_VERB_SET_PIN_WIDGET_CONTROL
,
395 alc_pin_mode_values
[val
]);
397 /* Also enable the retasking pin's input/output as required
398 * for the requested pin mode. Enum values of 2 or less are
401 * Dynamically switching the input/output buffers probably
402 * reduces noise slightly (particularly on input) so we'll
403 * do it. However, having both input and output buffers
404 * enabled simultaneously doesn't seem to be problematic if
405 * this turns out to be necessary in the future.
408 snd_hda_codec_write(codec
, nid
, 0,
409 AC_VERB_SET_AMP_GAIN_MUTE
,
411 snd_hda_codec_write(codec
, nid
, 0,
412 AC_VERB_SET_AMP_GAIN_MUTE
,
415 snd_hda_codec_write(codec
, nid
, 0,
416 AC_VERB_SET_AMP_GAIN_MUTE
,
418 snd_hda_codec_write(codec
, nid
, 0,
419 AC_VERB_SET_AMP_GAIN_MUTE
,
426 #define ALC_PIN_MODE(xname, nid, dir) \
427 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
428 .info = alc_pin_mode_info, \
429 .get = alc_pin_mode_get, \
430 .put = alc_pin_mode_put, \
431 .private_value = nid | (dir<<16) }
433 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
434 * together using a mask with more than one bit set. This control is
435 * currently used only by the ALC260 test model. At this stage they are not
436 * needed for any "production" models.
438 #ifdef CONFIG_SND_DEBUG
439 static int alc_gpio_data_info(struct snd_kcontrol
*kcontrol
,
440 struct snd_ctl_elem_info
*uinfo
)
442 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_BOOLEAN
;
444 uinfo
->value
.integer
.min
= 0;
445 uinfo
->value
.integer
.max
= 1;
448 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
449 struct snd_ctl_elem_value
*ucontrol
)
451 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
452 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
453 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
454 long *valp
= ucontrol
->value
.integer
.value
;
455 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
456 AC_VERB_GET_GPIO_DATA
, 0x00);
458 *valp
= (val
& mask
) != 0;
461 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
462 struct snd_ctl_elem_value
*ucontrol
)
465 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
466 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
467 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
468 long val
= *ucontrol
->value
.integer
.value
;
469 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
470 AC_VERB_GET_GPIO_DATA
,
473 /* Set/unset the masked GPIO bit(s) as needed */
474 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
479 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_GPIO_DATA
, gpio_data
);
483 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
484 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
485 .info = alc_gpio_data_info, \
486 .get = alc_gpio_data_get, \
487 .put = alc_gpio_data_put, \
488 .private_value = nid | (mask<<16) }
489 #endif /* CONFIG_SND_DEBUG */
491 /* A switch control to allow the enabling of the digital IO pins on the
492 * ALC260. This is incredibly simplistic; the intention of this control is
493 * to provide something in the test model allowing digital outputs to be
494 * identified if present. If models are found which can utilise these
495 * outputs a more complete mixer control can be devised for those models if
498 #ifdef CONFIG_SND_DEBUG
499 static int alc_spdif_ctrl_info(struct snd_kcontrol
*kcontrol
,
500 struct snd_ctl_elem_info
*uinfo
)
502 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_BOOLEAN
;
504 uinfo
->value
.integer
.min
= 0;
505 uinfo
->value
.integer
.max
= 1;
508 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
509 struct snd_ctl_elem_value
*ucontrol
)
511 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
512 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
513 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
514 long *valp
= ucontrol
->value
.integer
.value
;
515 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
516 AC_VERB_GET_DIGI_CONVERT
, 0x00);
518 *valp
= (val
& mask
) != 0;
521 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
522 struct snd_ctl_elem_value
*ucontrol
)
525 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
526 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
527 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
528 long val
= *ucontrol
->value
.integer
.value
;
529 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
530 AC_VERB_GET_DIGI_CONVERT
,
533 /* Set/unset the masked control bit(s) as needed */
534 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
539 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
544 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
545 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
546 .info = alc_spdif_ctrl_info, \
547 .get = alc_spdif_ctrl_get, \
548 .put = alc_spdif_ctrl_put, \
549 .private_value = nid | (mask<<16) }
550 #endif /* CONFIG_SND_DEBUG */
553 * set up from the preset table
555 static void setup_preset(struct alc_spec
*spec
,
556 const struct alc_config_preset
*preset
)
560 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
561 spec
->mixers
[spec
->num_mixers
++] = preset
->mixers
[i
];
562 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
564 spec
->init_verbs
[spec
->num_init_verbs
++] =
565 preset
->init_verbs
[i
];
567 spec
->channel_mode
= preset
->channel_mode
;
568 spec
->num_channel_mode
= preset
->num_channel_mode
;
569 spec
->need_dac_fix
= preset
->need_dac_fix
;
571 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
573 spec
->multiout
.num_dacs
= preset
->num_dacs
;
574 spec
->multiout
.dac_nids
= preset
->dac_nids
;
575 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
576 spec
->multiout
.hp_nid
= preset
->hp_nid
;
578 spec
->num_mux_defs
= preset
->num_mux_defs
;
579 if (! spec
->num_mux_defs
)
580 spec
->num_mux_defs
= 1;
581 spec
->input_mux
= preset
->input_mux
;
583 spec
->num_adc_nids
= preset
->num_adc_nids
;
584 spec
->adc_nids
= preset
->adc_nids
;
585 spec
->dig_in_nid
= preset
->dig_in_nid
;
587 spec
->unsol_event
= preset
->unsol_event
;
588 spec
->init_hook
= preset
->init_hook
;
592 * ALC880 3-stack model
594 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
595 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
596 * F-Mic = 0x1b, HP = 0x19
599 static hda_nid_t alc880_dac_nids
[4] = {
600 /* front, rear, clfe, rear_surr */
601 0x02, 0x05, 0x04, 0x03
604 static hda_nid_t alc880_adc_nids
[3] = {
609 /* The datasheet says the node 0x07 is connected from inputs,
610 * but it shows zero connection in the real implementation on some devices.
611 * Note: this is a 915GAV bug, fixed on 915GLV
613 static hda_nid_t alc880_adc_nids_alt
[2] = {
618 #define ALC880_DIGOUT_NID 0x06
619 #define ALC880_DIGIN_NID 0x0a
621 static struct hda_input_mux alc880_capture_source
= {
625 { "Front Mic", 0x3 },
631 /* channel source setting (2/6 channel selection for 3-stack) */
633 static struct hda_verb alc880_threestack_ch2_init
[] = {
634 /* set line-in to input, mute it */
635 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
636 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
637 /* set mic-in to input vref 80%, mute it */
638 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
639 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
644 static struct hda_verb alc880_threestack_ch6_init
[] = {
645 /* set line-in to output, unmute it */
646 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
647 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
648 /* set mic-in to output, unmute it */
649 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
650 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
654 static struct hda_channel_mode alc880_threestack_modes
[2] = {
655 { 2, alc880_threestack_ch2_init
},
656 { 6, alc880_threestack_ch6_init
},
659 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
660 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
661 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
662 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
663 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
664 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
665 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
666 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
667 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
668 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
669 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
670 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
671 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
672 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
673 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
674 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
675 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
676 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
677 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
678 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
680 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
681 .name
= "Channel Mode",
682 .info
= alc_ch_mode_info
,
683 .get
= alc_ch_mode_get
,
684 .put
= alc_ch_mode_put
,
689 /* capture mixer elements */
690 static struct snd_kcontrol_new alc880_capture_mixer
[] = {
691 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
692 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
693 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
694 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
695 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
696 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
698 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
699 /* The multiple "Capture Source" controls confuse alsamixer
700 * So call somewhat different..
701 * FIXME: the controls appear in the "playback" view!
703 /* .name = "Capture Source", */
704 .name
= "Input Source",
706 .info
= alc_mux_enum_info
,
707 .get
= alc_mux_enum_get
,
708 .put
= alc_mux_enum_put
,
713 /* capture mixer elements (in case NID 0x07 not available) */
714 static struct snd_kcontrol_new alc880_capture_alt_mixer
[] = {
715 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
716 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
717 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
718 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
720 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
721 /* The multiple "Capture Source" controls confuse alsamixer
722 * So call somewhat different..
723 * FIXME: the controls appear in the "playback" view!
725 /* .name = "Capture Source", */
726 .name
= "Input Source",
728 .info
= alc_mux_enum_info
,
729 .get
= alc_mux_enum_get
,
730 .put
= alc_mux_enum_put
,
738 * ALC880 5-stack model
740 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
742 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
743 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
746 /* additional mixers to alc880_three_stack_mixer */
747 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
748 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
749 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
753 /* channel source setting (6/8 channel selection for 5-stack) */
755 static struct hda_verb alc880_fivestack_ch6_init
[] = {
756 /* set line-in to input, mute it */
757 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
758 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
763 static struct hda_verb alc880_fivestack_ch8_init
[] = {
764 /* set line-in to output, unmute it */
765 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
766 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
770 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
771 { 6, alc880_fivestack_ch6_init
},
772 { 8, alc880_fivestack_ch8_init
},
777 * ALC880 6-stack model
779 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
781 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
782 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
785 static hda_nid_t alc880_6st_dac_nids
[4] = {
786 /* front, rear, clfe, rear_surr */
787 0x02, 0x03, 0x04, 0x05
790 static struct hda_input_mux alc880_6stack_capture_source
= {
794 { "Front Mic", 0x1 },
800 /* fixed 8-channels */
801 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
805 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
806 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
807 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
808 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
809 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
810 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
811 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
812 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
813 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
814 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
815 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
816 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
817 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
818 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
819 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
820 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
821 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
822 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
823 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
824 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
825 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
827 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
828 .name
= "Channel Mode",
829 .info
= alc_ch_mode_info
,
830 .get
= alc_ch_mode_get
,
831 .put
= alc_ch_mode_put
,
840 * W810 has rear IO for:
843 * Center/LFE (DAC 04)
846 * The system also has a pair of internal speakers, and a headphone jack.
847 * These are both connected to Line2 on the codec, hence to DAC 02.
849 * There is a variable resistor to control the speaker or headphone
850 * volume. This is a hardware-only device without a software API.
852 * Plugging headphones in will disable the internal speakers. This is
853 * implemented in hardware, not via the driver using jack sense. In
854 * a similar fashion, plugging into the rear socket marked "front" will
855 * disable both the speakers and headphones.
857 * For input, there's a microphone jack, and an "audio in" jack.
858 * These may not do anything useful with this driver yet, because I
859 * haven't setup any initialization verbs for these yet...
862 static hda_nid_t alc880_w810_dac_nids
[3] = {
863 /* front, rear/surround, clfe */
867 /* fixed 6 channels */
868 static struct hda_channel_mode alc880_w810_modes
[1] = {
872 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
873 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
874 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
875 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
876 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
877 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
878 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
879 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
880 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
881 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
882 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
890 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
891 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
895 static hda_nid_t alc880_z71v_dac_nids
[1] = {
898 #define ALC880_Z71V_HP_DAC 0x03
900 /* fixed 2 channels */
901 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
905 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
906 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
907 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
908 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
909 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
910 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
911 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
913 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
922 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
923 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
926 static hda_nid_t alc880_f1734_dac_nids
[1] = {
929 #define ALC880_F1734_HP_DAC 0x02
931 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
932 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
933 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
934 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
935 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
936 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
937 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
938 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
939 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
948 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
949 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
950 * Mic = 0x18, Line = 0x1a
953 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
954 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
956 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
957 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
958 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
959 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
960 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
961 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
962 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
963 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
964 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
965 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
966 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
968 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
970 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
972 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
973 .name
= "Channel Mode",
974 .info
= alc_ch_mode_info
,
975 .get
= alc_ch_mode_get
,
976 .put
= alc_ch_mode_put
,
983 * ALC880 ASUS W1V model
985 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
986 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
987 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
990 /* additional mixers to alc880_asus_mixer */
991 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
992 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
993 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
997 /* additional mixers to alc880_asus_mixer */
998 static struct snd_kcontrol_new alc880_pcbeep_mixer
[] = {
999 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1000 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1005 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
1006 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1007 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
1008 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
1009 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
1010 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
1011 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
1012 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
1013 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
1014 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
1016 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1017 /* The multiple "Capture Source" controls confuse alsamixer
1018 * So call somewhat different..
1019 * FIXME: the controls appear in the "playback" view!
1021 /* .name = "Capture Source", */
1022 .name
= "Input Source",
1024 .info
= alc_mux_enum_info
,
1025 .get
= alc_mux_enum_get
,
1026 .put
= alc_mux_enum_put
,
1032 static struct snd_kcontrol_new alc880_uniwill_mixer
[] = {
1033 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1034 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT
),
1035 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1036 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1037 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
1038 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
1039 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
1040 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
1041 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
1042 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
1043 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
1044 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
1045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1046 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1047 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1048 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1049 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
1050 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
1052 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1053 .name
= "Channel Mode",
1054 .info
= alc_ch_mode_info
,
1055 .get
= alc_ch_mode_get
,
1056 .put
= alc_ch_mode_put
,
1061 static struct snd_kcontrol_new alc880_uniwill_p53_mixer
[] = {
1062 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1063 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT
),
1064 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
1065 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT
),
1066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1067 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1072 * build control elements
1074 static int alc_build_controls(struct hda_codec
*codec
)
1076 struct alc_spec
*spec
= codec
->spec
;
1080 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1081 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1086 if (spec
->multiout
.dig_out_nid
) {
1087 err
= snd_hda_create_spdif_out_ctls(codec
,
1088 spec
->multiout
.dig_out_nid
);
1092 if (spec
->dig_in_nid
) {
1093 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1102 * initialize the codec volumes, etc
1106 * generic initialization of ADC, input mixers and output mixers
1108 static struct hda_verb alc880_volume_init_verbs
[] = {
1110 * Unmute ADC0-2 and set the default input to mic-in
1112 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
1113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1114 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
1115 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1116 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
1117 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1119 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1121 * Note: PASD motherboards uses the Line In 2 as the input for front
1124 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1125 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1126 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1127 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
1128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
1129 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
1132 * Set up output mixers (0x0c - 0x0f)
1134 /* set vol=0 to output mixers */
1135 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1136 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1137 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1138 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1139 /* set up input amps for analog loopback */
1140 /* Amp Indices: DAC = 0, mixer = 1 */
1141 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1142 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1143 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1144 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1145 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1146 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1147 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1148 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1154 * 3-stack pin configuration:
1155 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1157 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
1159 * preset connection lists of input pins
1160 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1162 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
1163 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1164 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
1167 * Set pin mode and muting
1169 /* set front pin widgets 0x14 for output */
1170 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1171 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1172 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1173 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1174 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1175 /* Mic2 (as headphone out) for HP output */
1176 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1177 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1178 /* Line In pin widget for input */
1179 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1180 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1181 /* Line2 (as front mic) pin widget for input and vref at 80% */
1182 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1183 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1184 /* CD pin widget for input */
1185 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1191 * 5-stack pin configuration:
1192 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1193 * line-in/side = 0x1a, f-mic = 0x1b
1195 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
1197 * preset connection lists of input pins
1198 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1200 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1201 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
1204 * Set pin mode and muting
1206 /* set pin widgets 0x14-0x17 for output */
1207 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1208 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1209 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1210 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1211 /* unmute pins for output (no gain on this amp) */
1212 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1213 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1214 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1215 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1217 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1218 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1219 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1220 /* Mic2 (as headphone out) for HP output */
1221 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1222 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1223 /* Line In pin widget for input */
1224 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1225 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1226 /* Line2 (as front mic) pin widget for input and vref at 80% */
1227 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1228 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1229 /* CD pin widget for input */
1230 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1236 * W810 pin configuration:
1237 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1239 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
1240 /* hphone/speaker input selector: front DAC */
1241 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
1243 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1244 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1245 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1246 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1247 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1248 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1250 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1251 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1257 * Z71V pin configuration:
1258 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1260 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
1261 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1262 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1263 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1264 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1266 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1267 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1268 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1269 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1275 * 6-stack pin configuration:
1276 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1277 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1279 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
1280 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1282 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1283 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1284 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1285 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1286 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1287 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1288 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1289 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1291 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1292 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1293 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1294 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1295 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1296 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1297 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1298 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1299 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1305 * Uniwill pin configuration:
1306 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
1309 static struct hda_verb alc880_uniwill_init_verbs
[] = {
1310 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1313 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1314 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1315 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1316 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1317 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1318 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1319 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1320 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1321 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1322 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1323 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1324 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1325 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1327 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1328 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1329 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1330 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1331 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1332 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1333 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
1334 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
1335 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1337 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1338 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_MIC_EVENT
},
1345 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
1347 static struct hda_verb alc880_uniwill_p53_init_verbs
[] = {
1348 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1350 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1351 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1352 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1353 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1354 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1355 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1356 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1357 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1358 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1359 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1360 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
1361 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
1363 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1364 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1365 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1366 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1367 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1368 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1370 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
1371 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_DCVOL_EVENT
},
1376 /* toggle speaker-output according to the hp-jack state */
1377 static void alc880_uniwill_automute(struct hda_codec
*codec
)
1379 unsigned int present
;
1381 present
= snd_hda_codec_read(codec
, 0x14, 0,
1382 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1383 snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
1384 0x80, present
? 0x80 : 0);
1385 snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
1386 0x80, present
? 0x80 : 0);
1387 snd_hda_codec_amp_update(codec
, 0x16, 0, HDA_OUTPUT
, 0,
1388 0x80, present
? 0x80 : 0);
1389 snd_hda_codec_amp_update(codec
, 0x16, 1, HDA_OUTPUT
, 0,
1390 0x80, present
? 0x80 : 0);
1392 present
= snd_hda_codec_read(codec
, 0x18, 0,
1393 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1394 snd_hda_codec_write(codec
, 0x0b, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
1395 0x7000 | (0x01 << 8) | (present
? 0x80 : 0));
1398 static void alc880_uniwill_unsol_event(struct hda_codec
*codec
,
1401 /* Looks like the unsol event is incompatible with the standard
1402 * definition. 4bit tag is placed at 28 bit!
1404 if ((res
>> 28) == ALC880_HP_EVENT
||
1405 (res
>> 28) == ALC880_MIC_EVENT
)
1406 alc880_uniwill_automute(codec
);
1409 static void alc880_uniwill_p53_hp_automute(struct hda_codec
*codec
)
1411 unsigned int present
;
1413 present
= snd_hda_codec_read(codec
, 0x14, 0,
1414 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1416 snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_INPUT
, 0,
1417 0x80, present
? 0x80 : 0);
1418 snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_INPUT
, 0,
1419 0x80, present
? 0x80 : 0);
1422 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec
*codec
)
1424 unsigned int present
;
1426 present
= snd_hda_codec_read(codec
, 0x21, 0,
1427 AC_VERB_GET_VOLUME_KNOB_CONTROL
, 0) & 0x7f;
1429 snd_hda_codec_amp_update(codec
, 0x0c, 0, HDA_OUTPUT
, 0,
1431 snd_hda_codec_amp_update(codec
, 0x0c, 1, HDA_OUTPUT
, 0,
1434 snd_hda_codec_amp_update(codec
, 0x0d, 0, HDA_OUTPUT
, 0,
1436 snd_hda_codec_amp_update(codec
, 0x0d, 1, HDA_OUTPUT
, 0,
1440 static void alc880_uniwill_p53_unsol_event(struct hda_codec
*codec
,
1443 /* Looks like the unsol event is incompatible with the standard
1444 * definition. 4bit tag is placed at 28 bit!
1446 if ((res
>> 28) == ALC880_HP_EVENT
)
1447 alc880_uniwill_p53_hp_automute(codec
);
1448 if ((res
>> 28) == ALC880_DCVOL_EVENT
)
1449 alc880_uniwill_p53_dcvol_automute(codec
);
1454 * F1734 pin configuration:
1455 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1457 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
1458 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1459 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1460 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
1461 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1464 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1466 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1468 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1469 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1470 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1471 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1472 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1473 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1474 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1475 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1476 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1483 * ASUS pin configuration:
1484 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1486 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
1487 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1488 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1489 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
1490 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1492 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1493 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1494 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1495 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1496 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1498 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1499 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1501 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1502 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1503 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1504 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1505 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1506 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1508 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1509 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1514 /* Enable GPIO mask and set output */
1515 static struct hda_verb alc880_gpio1_init_verbs
[] = {
1516 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
1517 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
1518 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
1523 /* Enable GPIO mask and set output */
1524 static struct hda_verb alc880_gpio2_init_verbs
[] = {
1525 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
1526 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
1527 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
1532 /* Clevo m520g init */
1533 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
1534 /* headphone output */
1535 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
1537 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1538 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1540 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1541 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1543 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1544 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1545 /* Mic1 (rear panel) */
1546 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1547 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1548 /* Mic2 (front panel) */
1549 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1550 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1552 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1553 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1554 /* change to EAPD mode */
1555 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1556 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
1561 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
1562 /* change to EAPD mode */
1563 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1564 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
1566 /* Headphone output */
1567 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1569 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1570 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
1572 /* Line In pin widget for input */
1573 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1574 /* CD pin widget for input */
1575 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1576 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1577 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1579 /* change to EAPD mode */
1580 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1581 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
1587 * LG m1 express dual
1590 * Rear Line-In/Out (blue): 0x14
1591 * Build-in Mic-In: 0x15
1593 * HP-Out (green): 0x1b
1594 * Mic-In/Out (red): 0x19
1598 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
1599 static hda_nid_t alc880_lg_dac_nids
[3] = {
1603 /* seems analog CD is not working */
1604 static struct hda_input_mux alc880_lg_capture_source
= {
1609 { "Internal Mic", 0x6 },
1613 /* 2,4,6 channel modes */
1614 static struct hda_verb alc880_lg_ch2_init
[] = {
1615 /* set line-in and mic-in to input */
1616 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1617 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1621 static struct hda_verb alc880_lg_ch4_init
[] = {
1622 /* set line-in to out and mic-in to input */
1623 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1624 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1628 static struct hda_verb alc880_lg_ch6_init
[] = {
1629 /* set line-in and mic-in to output */
1630 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1631 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1635 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
1636 { 2, alc880_lg_ch2_init
},
1637 { 4, alc880_lg_ch4_init
},
1638 { 6, alc880_lg_ch6_init
},
1641 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
1642 /* FIXME: it's not really "master" but front channels */
1643 HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1644 HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT
),
1645 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1646 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
1647 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
1648 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
1649 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
1650 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
1651 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1652 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1653 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
1654 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
1655 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
1656 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
1658 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1659 .name
= "Channel Mode",
1660 .info
= alc_ch_mode_info
,
1661 .get
= alc_ch_mode_get
,
1662 .put
= alc_ch_mode_put
,
1667 static struct hda_verb alc880_lg_init_verbs
[] = {
1668 /* set capture source to mic-in */
1669 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1670 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1671 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1672 /* mute all amp mixer inputs */
1673 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
1674 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(6)},
1675 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(7)},
1676 /* line-in to input */
1677 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1678 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1680 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1681 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1683 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1684 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1685 /* mic-in to input */
1686 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
1687 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1688 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1690 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
1691 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1692 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1694 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
1698 /* toggle speaker-output according to the hp-jack state */
1699 static void alc880_lg_automute(struct hda_codec
*codec
)
1701 unsigned int present
;
1703 present
= snd_hda_codec_read(codec
, 0x1b, 0,
1704 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1705 snd_hda_codec_amp_update(codec
, 0x17, 0, HDA_OUTPUT
, 0,
1706 0x80, present
? 0x80 : 0);
1707 snd_hda_codec_amp_update(codec
, 0x17, 1, HDA_OUTPUT
, 0,
1708 0x80, present
? 0x80 : 0);
1711 static void alc880_lg_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1713 /* Looks like the unsol event is incompatible with the standard
1714 * definition. 4bit tag is placed at 28 bit!
1716 if ((res
>> 28) == 0x01)
1717 alc880_lg_automute(codec
);
1726 * Built-in Mic-In: 0x19 (?)
1731 /* seems analog CD is not working */
1732 static struct hda_input_mux alc880_lg_lw_capture_source
= {
1736 { "Internal Mic", 0x1 },
1740 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
1741 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1742 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
1743 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1744 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1745 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
1746 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
1750 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
1751 /* set capture source to mic-in */
1752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1753 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1754 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1755 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(7)},
1757 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1758 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1760 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1761 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1762 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1763 /* mic-in to input */
1764 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1765 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1767 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1768 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1770 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
1774 /* toggle speaker-output according to the hp-jack state */
1775 static void alc880_lg_lw_automute(struct hda_codec
*codec
)
1777 unsigned int present
;
1779 present
= snd_hda_codec_read(codec
, 0x1b, 0,
1780 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1781 snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
1782 0x80, present
? 0x80 : 0);
1783 snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
1784 0x80, present
? 0x80 : 0);
1787 static void alc880_lg_lw_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1789 /* Looks like the unsol event is incompatible with the standard
1790 * definition. 4bit tag is placed at 28 bit!
1792 if ((res
>> 28) == 0x01)
1793 alc880_lg_lw_automute(codec
);
1800 static int alc_init(struct hda_codec
*codec
)
1802 struct alc_spec
*spec
= codec
->spec
;
1805 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
1806 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
1808 if (spec
->init_hook
)
1809 spec
->init_hook(codec
);
1814 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1816 struct alc_spec
*spec
= codec
->spec
;
1818 if (spec
->unsol_event
)
1819 spec
->unsol_event(codec
, res
);
1826 static int alc_resume(struct hda_codec
*codec
)
1828 struct alc_spec
*spec
= codec
->spec
;
1832 for (i
= 0; i
< spec
->num_mixers
; i
++)
1833 snd_hda_resume_ctls(codec
, spec
->mixers
[i
]);
1834 if (spec
->multiout
.dig_out_nid
)
1835 snd_hda_resume_spdif_out(codec
);
1836 if (spec
->dig_in_nid
)
1837 snd_hda_resume_spdif_in(codec
);
1844 * Analog playback callbacks
1846 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
1847 struct hda_codec
*codec
,
1848 struct snd_pcm_substream
*substream
)
1850 struct alc_spec
*spec
= codec
->spec
;
1851 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
);
1854 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
1855 struct hda_codec
*codec
,
1856 unsigned int stream_tag
,
1857 unsigned int format
,
1858 struct snd_pcm_substream
*substream
)
1860 struct alc_spec
*spec
= codec
->spec
;
1861 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
1862 stream_tag
, format
, substream
);
1865 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
1866 struct hda_codec
*codec
,
1867 struct snd_pcm_substream
*substream
)
1869 struct alc_spec
*spec
= codec
->spec
;
1870 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
1876 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
1877 struct hda_codec
*codec
,
1878 struct snd_pcm_substream
*substream
)
1880 struct alc_spec
*spec
= codec
->spec
;
1881 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
1884 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
1885 struct hda_codec
*codec
,
1886 struct snd_pcm_substream
*substream
)
1888 struct alc_spec
*spec
= codec
->spec
;
1889 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
1895 static int alc880_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
1896 struct hda_codec
*codec
,
1897 unsigned int stream_tag
,
1898 unsigned int format
,
1899 struct snd_pcm_substream
*substream
)
1901 struct alc_spec
*spec
= codec
->spec
;
1903 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
1904 stream_tag
, 0, format
);
1908 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
1909 struct hda_codec
*codec
,
1910 struct snd_pcm_substream
*substream
)
1912 struct alc_spec
*spec
= codec
->spec
;
1914 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
1922 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
1926 /* NID is set in alc_build_pcms */
1928 .open
= alc880_playback_pcm_open
,
1929 .prepare
= alc880_playback_pcm_prepare
,
1930 .cleanup
= alc880_playback_pcm_cleanup
1934 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
1938 /* NID is set in alc_build_pcms */
1940 .prepare
= alc880_capture_pcm_prepare
,
1941 .cleanup
= alc880_capture_pcm_cleanup
1945 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
1949 /* NID is set in alc_build_pcms */
1951 .open
= alc880_dig_playback_pcm_open
,
1952 .close
= alc880_dig_playback_pcm_close
1956 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
1960 /* NID is set in alc_build_pcms */
1963 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
1964 static struct hda_pcm_stream alc_pcm_null_playback
= {
1970 static int alc_build_pcms(struct hda_codec
*codec
)
1972 struct alc_spec
*spec
= codec
->spec
;
1973 struct hda_pcm
*info
= spec
->pcm_rec
;
1976 codec
->num_pcms
= 1;
1977 codec
->pcm_info
= info
;
1979 info
->name
= spec
->stream_name_analog
;
1980 if (spec
->stream_analog_playback
) {
1981 snd_assert(spec
->multiout
.dac_nids
, return -EINVAL
);
1982 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
1983 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
1985 if (spec
->stream_analog_capture
) {
1986 snd_assert(spec
->adc_nids
, return -EINVAL
);
1987 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
1988 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
1991 if (spec
->channel_mode
) {
1992 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
1993 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
1994 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
1995 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
2000 /* SPDIF for stream index #1 */
2001 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
2002 codec
->num_pcms
= 2;
2003 info
= spec
->pcm_rec
+ 1;
2004 info
->name
= spec
->stream_name_digital
;
2005 if (spec
->multiout
.dig_out_nid
&&
2006 spec
->stream_digital_playback
) {
2007 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
2008 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
2010 if (spec
->dig_in_nid
&&
2011 spec
->stream_digital_capture
) {
2012 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
2013 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
2017 /* If the use of more than one ADC is requested for the current
2018 * model, configure a second analog capture-only PCM.
2020 /* Additional Analaog capture for index #2 */
2021 if (spec
->num_adc_nids
> 1 && spec
->stream_analog_capture
&&
2023 codec
->num_pcms
= 3;
2024 info
= spec
->pcm_rec
+ 2;
2025 info
->name
= spec
->stream_name_analog
;
2026 /* No playback stream for second PCM */
2027 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = alc_pcm_null_playback
;
2028 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
2029 if (spec
->stream_analog_capture
) {
2030 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
2031 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[1];
2038 static void alc_free(struct hda_codec
*codec
)
2040 struct alc_spec
*spec
= codec
->spec
;
2046 if (spec
->kctl_alloc
) {
2047 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
2048 kfree(spec
->kctl_alloc
[i
].name
);
2049 kfree(spec
->kctl_alloc
);
2056 static struct hda_codec_ops alc_patch_ops
= {
2057 .build_controls
= alc_build_controls
,
2058 .build_pcms
= alc_build_pcms
,
2061 .unsol_event
= alc_unsol_event
,
2063 .resume
= alc_resume
,
2069 * Test configuration for debugging
2071 * Almost all inputs/outputs are enabled. I/O pins can be configured via
2074 #ifdef CONFIG_SND_DEBUG
2075 static hda_nid_t alc880_test_dac_nids
[4] = {
2076 0x02, 0x03, 0x04, 0x05
2079 static struct hda_input_mux alc880_test_capture_source
= {
2088 { "Surround", 0x6 },
2092 static struct hda_channel_mode alc880_test_modes
[4] = {
2099 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
2100 struct snd_ctl_elem_info
*uinfo
)
2102 static char *texts
[] = {
2103 "N/A", "Line Out", "HP Out",
2104 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
2106 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2108 uinfo
->value
.enumerated
.items
= 8;
2109 if (uinfo
->value
.enumerated
.item
>= 8)
2110 uinfo
->value
.enumerated
.item
= 7;
2111 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2115 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
2116 struct snd_ctl_elem_value
*ucontrol
)
2118 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2119 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2120 unsigned int pin_ctl
, item
= 0;
2122 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2123 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2124 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
2125 if (pin_ctl
& AC_PINCTL_HP_EN
)
2129 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
2130 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
2131 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
2132 case AC_PINCTL_VREF_50
: item
= 4; break;
2133 case AC_PINCTL_VREF_GRD
: item
= 5; break;
2134 case AC_PINCTL_VREF_80
: item
= 6; break;
2135 case AC_PINCTL_VREF_100
: item
= 7; break;
2138 ucontrol
->value
.enumerated
.item
[0] = item
;
2142 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
2143 struct snd_ctl_elem_value
*ucontrol
)
2145 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2146 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2147 static unsigned int ctls
[] = {
2148 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
2149 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
2150 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
2151 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
2152 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
2153 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
2155 unsigned int old_ctl
, new_ctl
;
2157 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
2158 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
2159 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
2160 if (old_ctl
!= new_ctl
) {
2161 snd_hda_codec_write(codec
, nid
, 0,
2162 AC_VERB_SET_PIN_WIDGET_CONTROL
, new_ctl
);
2163 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
2164 (ucontrol
->value
.enumerated
.item
[0] >= 3 ?
2171 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
2172 struct snd_ctl_elem_info
*uinfo
)
2174 static char *texts
[] = {
2175 "Front", "Surround", "CLFE", "Side"
2177 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
2179 uinfo
->value
.enumerated
.items
= 4;
2180 if (uinfo
->value
.enumerated
.item
>= 4)
2181 uinfo
->value
.enumerated
.item
= 3;
2182 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
2186 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
2187 struct snd_ctl_elem_value
*ucontrol
)
2189 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2190 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2193 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
2194 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
2198 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
2199 struct snd_ctl_elem_value
*ucontrol
)
2201 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
2202 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
2205 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
2206 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
2207 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
2208 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, sel
);
2214 #define PIN_CTL_TEST(xname,nid) { \
2215 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2217 .info = alc_test_pin_ctl_info, \
2218 .get = alc_test_pin_ctl_get, \
2219 .put = alc_test_pin_ctl_put, \
2220 .private_value = nid \
2223 #define PIN_SRC_TEST(xname,nid) { \
2224 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2226 .info = alc_test_pin_src_info, \
2227 .get = alc_test_pin_src_get, \
2228 .put = alc_test_pin_src_put, \
2229 .private_value = nid \
2232 static struct snd_kcontrol_new alc880_test_mixer
[] = {
2233 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2234 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2235 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
2236 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2237 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2238 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2239 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
2240 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2241 PIN_CTL_TEST("Front Pin Mode", 0x14),
2242 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2243 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2244 PIN_CTL_TEST("Side Pin Mode", 0x17),
2245 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2246 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2247 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2248 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2249 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2250 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2251 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2252 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2253 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2254 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2255 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2256 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2257 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
2258 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
2259 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2260 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2261 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
2262 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
2264 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2265 .name
= "Channel Mode",
2266 .info
= alc_ch_mode_info
,
2267 .get
= alc_ch_mode_get
,
2268 .put
= alc_ch_mode_put
,
2273 static struct hda_verb alc880_test_init_verbs
[] = {
2274 /* Unmute inputs of 0x0c - 0x0f */
2275 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2276 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2277 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2278 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2279 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2280 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2281 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2282 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2283 /* Vol output for 0x0c-0x0f */
2284 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2285 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2286 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2287 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2288 /* Set output pins 0x14-0x17 */
2289 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2291 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2292 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2293 /* Unmute output pins 0x14-0x17 */
2294 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2295 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2296 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2297 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2298 /* Set input pins 0x18-0x1c */
2299 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2300 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2301 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2302 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2303 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2304 /* Mute input pins 0x18-0x1b */
2305 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2306 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2307 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2308 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2310 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2311 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2312 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2313 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2314 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2315 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2316 /* Analog input/passthru */
2317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
2320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
2321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
2329 static struct hda_board_config alc880_cfg_tbl
[] = {
2330 /* Back 3 jack, front 2 jack */
2331 { .modelname
= "3stack", .config
= ALC880_3ST
},
2332 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe200, .config
= ALC880_3ST
},
2333 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe201, .config
= ALC880_3ST
},
2334 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe202, .config
= ALC880_3ST
},
2335 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe203, .config
= ALC880_3ST
},
2336 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe204, .config
= ALC880_3ST
},
2337 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe205, .config
= ALC880_3ST
},
2338 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe206, .config
= ALC880_3ST
},
2339 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe207, .config
= ALC880_3ST
},
2340 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe208, .config
= ALC880_3ST
},
2341 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe209, .config
= ALC880_3ST
},
2342 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe20a, .config
= ALC880_3ST
},
2343 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe20b, .config
= ALC880_3ST
},
2344 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe20c, .config
= ALC880_3ST
},
2345 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe20d, .config
= ALC880_3ST
},
2346 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe20e, .config
= ALC880_3ST
},
2347 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe20f, .config
= ALC880_3ST
},
2348 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe210, .config
= ALC880_3ST
},
2349 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe211, .config
= ALC880_3ST
},
2350 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe212, .config
= ALC880_3ST
},
2351 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe213, .config
= ALC880_3ST
},
2352 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe214, .config
= ALC880_3ST
},
2353 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe234, .config
= ALC880_3ST
},
2354 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe302, .config
= ALC880_3ST
},
2355 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe303, .config
= ALC880_3ST
},
2356 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe304, .config
= ALC880_3ST
},
2357 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe306, .config
= ALC880_3ST
},
2358 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe307, .config
= ALC880_3ST
},
2359 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe404, .config
= ALC880_3ST
},
2360 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xa101, .config
= ALC880_3ST
},
2361 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x3031, .config
= ALC880_3ST
},
2362 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x4036, .config
= ALC880_3ST
},
2363 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x4037, .config
= ALC880_3ST
},
2364 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x4038, .config
= ALC880_3ST
},
2365 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x4040, .config
= ALC880_3ST
},
2366 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x4041, .config
= ALC880_3ST
},
2368 { .modelname
= "tcl", .config
= ALC880_TCL_S700
},
2369 { .pci_subvendor
= 0x19db, .pci_subdevice
= 0x4188, .config
= ALC880_TCL_S700
},
2371 /* Back 3 jack, front 2 jack (Internal add Aux-In) */
2372 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0xe310, .config
= ALC880_3ST
},
2373 { .pci_subvendor
= 0x104d, .pci_subdevice
= 0x81d6, .config
= ALC880_3ST
},
2374 { .pci_subvendor
= 0x104d, .pci_subdevice
= 0x81a0, .config
= ALC880_3ST
},
2376 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */
2377 { .modelname
= "3stack-digout", .config
= ALC880_3ST_DIG
},
2378 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe308, .config
= ALC880_3ST_DIG
},
2379 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0x0070, .config
= ALC880_3ST_DIG
},
2382 { .modelname
= "clevo", .config
= ALC880_CLEVO
},
2383 { .pci_subvendor
= 0x1558, .pci_subdevice
= 0x0520,
2384 .config
= ALC880_CLEVO
}, /* Clevo m520G NB */
2385 { .pci_subvendor
= 0x1558, .pci_subdevice
= 0x0660,
2386 .config
= ALC880_CLEVO
}, /* Clevo m665n */
2388 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack (Internal add Aux-In)*/
2389 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe305, .config
= ALC880_3ST_DIG
},
2390 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xd402, .config
= ALC880_3ST_DIG
},
2391 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0xe309, .config
= ALC880_3ST_DIG
},
2393 /* Back 5 jack, front 2 jack */
2394 { .modelname
= "5stack", .config
= ALC880_5ST
},
2395 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x3033, .config
= ALC880_5ST
},
2396 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x4039, .config
= ALC880_5ST
},
2397 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x3032, .config
= ALC880_5ST
},
2398 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x2a09, .config
= ALC880_5ST
},
2399 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x814e, .config
= ALC880_5ST
},
2401 /* Back 5 jack plus 1 SPDIF out jack, front 2 jack */
2402 { .modelname
= "5stack-digout", .config
= ALC880_5ST_DIG
},
2403 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe224, .config
= ALC880_5ST_DIG
},
2404 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe400, .config
= ALC880_5ST_DIG
},
2405 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe401, .config
= ALC880_5ST_DIG
},
2406 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe402, .config
= ALC880_5ST_DIG
},
2407 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xd400, .config
= ALC880_5ST_DIG
},
2408 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xd401, .config
= ALC880_5ST_DIG
},
2409 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xa100, .config
= ALC880_5ST_DIG
},
2410 { .pci_subvendor
= 0x1565, .pci_subdevice
= 0x8202, .config
= ALC880_5ST_DIG
},
2411 { .pci_subvendor
= 0x1019, .pci_subdevice
= 0xa880, .config
= ALC880_5ST_DIG
},
2412 { .pci_subvendor
= 0xa0a0, .pci_subdevice
= 0x0560,
2413 .config
= ALC880_5ST_DIG
}, /* Aopen i915GMm-HFS */
2414 /* { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_5ST_DIG }, */ /* conflict with 6stack */
2415 { .pci_subvendor
= 0x1695, .pci_subdevice
= 0x400d, .config
= ALC880_5ST_DIG
},
2416 /* note subvendor = 0 below */
2417 /* { .pci_subvendor = 0x0000, .pci_subdevice = 0x8086, .config = ALC880_5ST_DIG }, */
2419 { .modelname
= "w810", .config
= ALC880_W810
},
2420 { .pci_subvendor
= 0x161f, .pci_subdevice
= 0x203d, .config
= ALC880_W810
},
2422 { .modelname
= "z71v", .config
= ALC880_Z71V
},
2423 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1964, .config
= ALC880_Z71V
},
2425 { .modelname
= "6stack", .config
= ALC880_6ST
},
2426 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x8196, .config
= ALC880_6ST
}, /* ASUS P5GD1-HVM */
2427 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x81b4, .config
= ALC880_6ST
},
2428 { .pci_subvendor
= 0x1019, .pci_subdevice
= 0xa884, .config
= ALC880_6ST
}, /* Acer APFV */
2429 { .pci_subvendor
= 0x1458, .pci_subdevice
= 0xa102, .config
= ALC880_6ST
}, /* Gigabyte K8N51 */
2431 { .modelname
= "6stack-digout", .config
= ALC880_6ST_DIG
},
2432 { .pci_subvendor
= 0x2668, .pci_subdevice
= 0x8086, .config
= ALC880_6ST_DIG
},
2433 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0x2668, .config
= ALC880_6ST_DIG
},
2434 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x1150, .config
= ALC880_6ST_DIG
},
2435 { .pci_subvendor
= 0xe803, .pci_subdevice
= 0x1019, .config
= ALC880_6ST_DIG
},
2436 { .pci_subvendor
= 0x1039, .pci_subdevice
= 0x1234, .config
= ALC880_6ST_DIG
},
2437 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0x0077, .config
= ALC880_6ST_DIG
},
2438 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0x0078, .config
= ALC880_6ST_DIG
},
2439 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0x0087, .config
= ALC880_6ST_DIG
},
2440 { .pci_subvendor
= 0x1297, .pci_subdevice
= 0xc790, .config
= ALC880_6ST_DIG
}, /* Shuttle ST20G5 */
2441 { .pci_subvendor
= 0x1509, .pci_subdevice
= 0x925d, .config
= ALC880_6ST_DIG
}, /* FIC P4M-915GD1 */
2442 { .pci_subvendor
= 0x1695, .pci_subdevice
= 0x4012, .config
= ALC880_5ST_DIG
}, /* Epox EP-5LDA+ GLi */
2444 { .modelname
= "asus", .config
= ALC880_ASUS
},
2445 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1964, .config
= ALC880_ASUS_DIG
},
2446 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1973, .config
= ALC880_ASUS_DIG
},
2447 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x19b3, .config
= ALC880_ASUS_DIG
},
2448 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1113, .config
= ALC880_ASUS_DIG
},
2449 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1173, .config
= ALC880_ASUS_DIG
},
2450 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1993, .config
= ALC880_ASUS
},
2451 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x10c2, .config
= ALC880_ASUS_DIG
}, /* Asus W6A */
2452 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x10c3, .config
= ALC880_ASUS_DIG
},
2453 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1133, .config
= ALC880_ASUS
},
2454 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1123, .config
= ALC880_ASUS_DIG
},
2455 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1143, .config
= ALC880_ASUS
},
2456 { .modelname
= "asus-w1v", .config
= ALC880_ASUS_W1V
},
2457 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x10b3, .config
= ALC880_ASUS_W1V
},
2458 { .modelname
= "asus-dig", .config
= ALC880_ASUS_DIG
},
2459 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x8181, .config
= ALC880_ASUS_DIG
}, /* ASUS P4GPL-X */
2460 { .modelname
= "asus-dig2", .config
= ALC880_ASUS_DIG2
},
2461 { .pci_subvendor
= 0x1558, .pci_subdevice
= 0x5401, .config
= ALC880_ASUS_DIG2
},
2463 { .modelname
= "uniwill", .config
= ALC880_UNIWILL_DIG
},
2464 { .pci_subvendor
= 0x1584, .pci_subdevice
= 0x9050, .config
= ALC880_UNIWILL_DIG
},
2465 { .pci_subvendor
= 0x1584, .pci_subdevice
= 0x9070, .config
= ALC880_UNIWILL
},
2466 { .pci_subvendor
= 0x1734, .pci_subdevice
= 0x10ac, .config
= ALC880_UNIWILL
},
2467 { .pci_subvendor
= 0x1584, .pci_subdevice
= 0x9077, .config
= ALC880_UNIWILL_P53
},
2469 { .modelname
= "F1734", .config
= ALC880_F1734
},
2470 { .pci_subvendor
= 0x1734, .pci_subdevice
= 0x107c, .config
= ALC880_F1734
},
2471 { .pci_subvendor
= 0x1584, .pci_subdevice
= 0x9054, .config
= ALC880_F1734
},
2473 { .modelname
= "lg", .config
= ALC880_LG
},
2474 { .pci_subvendor
= 0x1854, .pci_subdevice
= 0x003b, .config
= ALC880_LG
},
2475 { .pci_subvendor
= 0x1854, .pci_subdevice
= 0x0068, .config
= ALC880_LG
},
2477 { .modelname
= "lg-lw", .config
= ALC880_LG_LW
},
2478 { .pci_subvendor
= 0x1854, .pci_subdevice
= 0x0018, .config
= ALC880_LG_LW
},
2479 { .pci_subvendor
= 0x1854, .pci_subdevice
= 0x0077, .config
= ALC880_LG_LW
},
2481 #ifdef CONFIG_SND_DEBUG
2482 { .modelname
= "test", .config
= ALC880_TEST
},
2484 { .modelname
= "auto", .config
= ALC880_AUTO
},
2490 * ALC880 codec presets
2492 static struct alc_config_preset alc880_presets
[] = {
2494 .mixers
= { alc880_three_stack_mixer
},
2495 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_3stack_init_verbs
},
2496 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2497 .dac_nids
= alc880_dac_nids
,
2498 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2499 .channel_mode
= alc880_threestack_modes
,
2501 .input_mux
= &alc880_capture_source
,
2503 [ALC880_3ST_DIG
] = {
2504 .mixers
= { alc880_three_stack_mixer
},
2505 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_3stack_init_verbs
},
2506 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2507 .dac_nids
= alc880_dac_nids
,
2508 .dig_out_nid
= ALC880_DIGOUT_NID
,
2509 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2510 .channel_mode
= alc880_threestack_modes
,
2512 .input_mux
= &alc880_capture_source
,
2514 [ALC880_TCL_S700
] = {
2515 .mixers
= { alc880_tcl_s700_mixer
},
2516 .init_verbs
= { alc880_volume_init_verbs
,
2517 alc880_pin_tcl_S700_init_verbs
,
2518 alc880_gpio2_init_verbs
},
2519 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2520 .dac_nids
= alc880_dac_nids
,
2522 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2523 .channel_mode
= alc880_2_jack_modes
,
2524 .input_mux
= &alc880_capture_source
,
2527 .mixers
= { alc880_three_stack_mixer
, alc880_five_stack_mixer
},
2528 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_5stack_init_verbs
},
2529 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2530 .dac_nids
= alc880_dac_nids
,
2531 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
2532 .channel_mode
= alc880_fivestack_modes
,
2533 .input_mux
= &alc880_capture_source
,
2535 [ALC880_5ST_DIG
] = {
2536 .mixers
= { alc880_three_stack_mixer
, alc880_five_stack_mixer
},
2537 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_5stack_init_verbs
},
2538 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2539 .dac_nids
= alc880_dac_nids
,
2540 .dig_out_nid
= ALC880_DIGOUT_NID
,
2541 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
2542 .channel_mode
= alc880_fivestack_modes
,
2543 .input_mux
= &alc880_capture_source
,
2546 .mixers
= { alc880_six_stack_mixer
},
2547 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_6stack_init_verbs
},
2548 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
2549 .dac_nids
= alc880_6st_dac_nids
,
2550 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
2551 .channel_mode
= alc880_sixstack_modes
,
2552 .input_mux
= &alc880_6stack_capture_source
,
2554 [ALC880_6ST_DIG
] = {
2555 .mixers
= { alc880_six_stack_mixer
},
2556 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_6stack_init_verbs
},
2557 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
2558 .dac_nids
= alc880_6st_dac_nids
,
2559 .dig_out_nid
= ALC880_DIGOUT_NID
,
2560 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
2561 .channel_mode
= alc880_sixstack_modes
,
2562 .input_mux
= &alc880_6stack_capture_source
,
2565 .mixers
= { alc880_w810_base_mixer
},
2566 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_w810_init_verbs
,
2567 alc880_gpio2_init_verbs
},
2568 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
2569 .dac_nids
= alc880_w810_dac_nids
,
2570 .dig_out_nid
= ALC880_DIGOUT_NID
,
2571 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
2572 .channel_mode
= alc880_w810_modes
,
2573 .input_mux
= &alc880_capture_source
,
2576 .mixers
= { alc880_z71v_mixer
},
2577 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_z71v_init_verbs
},
2578 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
2579 .dac_nids
= alc880_z71v_dac_nids
,
2580 .dig_out_nid
= ALC880_DIGOUT_NID
,
2582 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2583 .channel_mode
= alc880_2_jack_modes
,
2584 .input_mux
= &alc880_capture_source
,
2587 .mixers
= { alc880_f1734_mixer
},
2588 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_f1734_init_verbs
},
2589 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
2590 .dac_nids
= alc880_f1734_dac_nids
,
2592 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2593 .channel_mode
= alc880_2_jack_modes
,
2594 .input_mux
= &alc880_capture_source
,
2597 .mixers
= { alc880_asus_mixer
},
2598 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
,
2599 alc880_gpio1_init_verbs
},
2600 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2601 .dac_nids
= alc880_asus_dac_nids
,
2602 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2603 .channel_mode
= alc880_asus_modes
,
2605 .input_mux
= &alc880_capture_source
,
2607 [ALC880_ASUS_DIG
] = {
2608 .mixers
= { alc880_asus_mixer
},
2609 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
,
2610 alc880_gpio1_init_verbs
},
2611 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2612 .dac_nids
= alc880_asus_dac_nids
,
2613 .dig_out_nid
= ALC880_DIGOUT_NID
,
2614 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2615 .channel_mode
= alc880_asus_modes
,
2617 .input_mux
= &alc880_capture_source
,
2619 [ALC880_ASUS_DIG2
] = {
2620 .mixers
= { alc880_asus_mixer
},
2621 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
,
2622 alc880_gpio2_init_verbs
}, /* use GPIO2 */
2623 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2624 .dac_nids
= alc880_asus_dac_nids
,
2625 .dig_out_nid
= ALC880_DIGOUT_NID
,
2626 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2627 .channel_mode
= alc880_asus_modes
,
2629 .input_mux
= &alc880_capture_source
,
2631 [ALC880_ASUS_W1V
] = {
2632 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
2633 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
,
2634 alc880_gpio1_init_verbs
},
2635 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2636 .dac_nids
= alc880_asus_dac_nids
,
2637 .dig_out_nid
= ALC880_DIGOUT_NID
,
2638 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2639 .channel_mode
= alc880_asus_modes
,
2641 .input_mux
= &alc880_capture_source
,
2643 [ALC880_UNIWILL_DIG
] = {
2644 .mixers
= { alc880_asus_mixer
, alc880_pcbeep_mixer
},
2645 .init_verbs
= { alc880_volume_init_verbs
,
2646 alc880_pin_asus_init_verbs
},
2647 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2648 .dac_nids
= alc880_asus_dac_nids
,
2649 .dig_out_nid
= ALC880_DIGOUT_NID
,
2650 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2651 .channel_mode
= alc880_asus_modes
,
2653 .input_mux
= &alc880_capture_source
,
2655 [ALC880_UNIWILL
] = {
2656 .mixers
= { alc880_uniwill_mixer
},
2657 .init_verbs
= { alc880_volume_init_verbs
,
2658 alc880_uniwill_init_verbs
},
2659 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2660 .dac_nids
= alc880_asus_dac_nids
,
2661 .dig_out_nid
= ALC880_DIGOUT_NID
,
2662 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2663 .channel_mode
= alc880_threestack_modes
,
2665 .input_mux
= &alc880_capture_source
,
2666 .unsol_event
= alc880_uniwill_unsol_event
,
2667 .init_hook
= alc880_uniwill_automute
,
2669 [ALC880_UNIWILL_P53
] = {
2670 .mixers
= { alc880_uniwill_p53_mixer
},
2671 .init_verbs
= { alc880_volume_init_verbs
,
2672 alc880_uniwill_p53_init_verbs
},
2673 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2674 .dac_nids
= alc880_asus_dac_nids
,
2675 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
2676 .channel_mode
= alc880_w810_modes
,
2677 .input_mux
= &alc880_capture_source
,
2678 .unsol_event
= alc880_uniwill_p53_unsol_event
,
2679 .init_hook
= alc880_uniwill_p53_hp_automute
,
2682 .mixers
= { alc880_three_stack_mixer
},
2683 .init_verbs
= { alc880_volume_init_verbs
,
2684 alc880_pin_clevo_init_verbs
},
2685 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2686 .dac_nids
= alc880_dac_nids
,
2688 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2689 .channel_mode
= alc880_threestack_modes
,
2691 .input_mux
= &alc880_capture_source
,
2694 .mixers
= { alc880_lg_mixer
},
2695 .init_verbs
= { alc880_volume_init_verbs
,
2696 alc880_lg_init_verbs
},
2697 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
2698 .dac_nids
= alc880_lg_dac_nids
,
2699 .dig_out_nid
= ALC880_DIGOUT_NID
,
2700 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
2701 .channel_mode
= alc880_lg_ch_modes
,
2703 .input_mux
= &alc880_lg_capture_source
,
2704 .unsol_event
= alc880_lg_unsol_event
,
2705 .init_hook
= alc880_lg_automute
,
2708 .mixers
= { alc880_lg_lw_mixer
},
2709 .init_verbs
= { alc880_volume_init_verbs
,
2710 alc880_lg_lw_init_verbs
},
2712 .dac_nids
= alc880_dac_nids
,
2713 .dig_out_nid
= ALC880_DIGOUT_NID
,
2714 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2715 .channel_mode
= alc880_2_jack_modes
,
2716 .input_mux
= &alc880_lg_lw_capture_source
,
2717 .unsol_event
= alc880_lg_lw_unsol_event
,
2718 .init_hook
= alc880_lg_lw_automute
,
2720 #ifdef CONFIG_SND_DEBUG
2722 .mixers
= { alc880_test_mixer
},
2723 .init_verbs
= { alc880_test_init_verbs
},
2724 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
2725 .dac_nids
= alc880_test_dac_nids
,
2726 .dig_out_nid
= ALC880_DIGOUT_NID
,
2727 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
2728 .channel_mode
= alc880_test_modes
,
2729 .input_mux
= &alc880_test_capture_source
,
2735 * Automatic parse of I/O pins from the BIOS configuration
2738 #define NUM_CONTROL_ALLOC 32
2739 #define NUM_VERB_ALLOC 32
2743 ALC_CTL_WIDGET_MUTE
,
2746 static struct snd_kcontrol_new alc880_control_templates
[] = {
2747 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
2748 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
2749 HDA_BIND_MUTE(NULL
, 0, 0, 0),
2752 /* add dynamic controls */
2753 static int add_control(struct alc_spec
*spec
, int type
, const char *name
, unsigned long val
)
2755 struct snd_kcontrol_new
*knew
;
2757 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
2758 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
2760 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
); /* array + terminator */
2763 if (spec
->kctl_alloc
) {
2764 memcpy(knew
, spec
->kctl_alloc
, sizeof(*knew
) * spec
->num_kctl_alloc
);
2765 kfree(spec
->kctl_alloc
);
2767 spec
->kctl_alloc
= knew
;
2768 spec
->num_kctl_alloc
= num
;
2771 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
2772 *knew
= alc880_control_templates
[type
];
2773 knew
->name
= kstrdup(name
, GFP_KERNEL
);
2776 knew
->private_value
= val
;
2777 spec
->num_kctl_used
++;
2781 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
2782 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
2783 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
2784 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
2785 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
2786 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
2787 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
2788 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
2789 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
2790 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
2791 #define ALC880_PIN_CD_NID 0x1c
2793 /* fill in the dac_nids table from the parsed pin configuration */
2794 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
, const struct auto_pin_cfg
*cfg
)
2800 memset(assigned
, 0, sizeof(assigned
));
2801 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
2803 /* check the pins hardwired to audio widget */
2804 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2805 nid
= cfg
->line_out_pins
[i
];
2806 if (alc880_is_fixed_pin(nid
)) {
2807 int idx
= alc880_fixed_pin_idx(nid
);
2808 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
2812 /* left pins can be connect to any audio widget */
2813 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2814 nid
= cfg
->line_out_pins
[i
];
2815 if (alc880_is_fixed_pin(nid
))
2817 /* search for an empty channel */
2818 for (j
= 0; j
< cfg
->line_outs
; j
++) {
2819 if (! assigned
[j
]) {
2820 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(j
);
2826 spec
->multiout
.num_dacs
= cfg
->line_outs
;
2830 /* add playback controls from the parsed DAC table */
2831 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
2832 const struct auto_pin_cfg
*cfg
)
2835 static const char *chname
[4] = { "Front", "Surround", NULL
/*CLFE*/, "Side" };
2839 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2840 if (! spec
->multiout
.dac_nids
[i
])
2842 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
2845 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "Center Playback Volume",
2846 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
))) < 0)
2848 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "LFE Playback Volume",
2849 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
))) < 0)
2851 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, "Center Playback Switch",
2852 HDA_COMPOSE_AMP_VAL(nid
, 1, 2, HDA_INPUT
))) < 0)
2854 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, "LFE Playback Switch",
2855 HDA_COMPOSE_AMP_VAL(nid
, 2, 2, HDA_INPUT
))) < 0)
2858 sprintf(name
, "%s Playback Volume", chname
[i
]);
2859 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
2860 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
2862 sprintf(name
, "%s Playback Switch", chname
[i
]);
2863 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
2864 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
))) < 0)
2871 /* add playback controls for speaker and HP outputs */
2872 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
2882 if (alc880_is_fixed_pin(pin
)) {
2883 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
2884 /* specify the DAC as the extra output */
2885 if (! spec
->multiout
.hp_nid
)
2886 spec
->multiout
.hp_nid
= nid
;
2888 spec
->multiout
.extra_out_nid
[0] = nid
;
2889 /* control HP volume/switch on the output mixer amp */
2890 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
2891 sprintf(name
, "%s Playback Volume", pfx
);
2892 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
2893 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
2895 sprintf(name
, "%s Playback Switch", pfx
);
2896 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
2897 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
))) < 0)
2899 } else if (alc880_is_multi_pin(pin
)) {
2900 /* set manual connection */
2901 /* we have only a switch on HP-out PIN */
2902 sprintf(name
, "%s Playback Switch", pfx
);
2903 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
2904 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
))) < 0)
2910 /* create input playback/capture controls for the given pin */
2911 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
, const char *ctlname
,
2912 int idx
, hda_nid_t mix_nid
)
2917 sprintf(name
, "%s Playback Volume", ctlname
);
2918 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
2919 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
))) < 0)
2921 sprintf(name
, "%s Playback Switch", ctlname
);
2922 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
2923 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
))) < 0)
2928 /* create playback/capture controls for input pins */
2929 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
2930 const struct auto_pin_cfg
*cfg
)
2932 struct hda_input_mux
*imux
= &spec
->private_imux
;
2935 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
2936 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
2937 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
2938 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
2939 auto_pin_cfg_labels
[i
],
2943 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
2944 imux
->items
[imux
->num_items
].index
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
2951 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
2952 hda_nid_t nid
, int pin_type
,
2956 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
2957 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
2958 /* need the manual connection? */
2959 if (alc880_is_multi_pin(nid
)) {
2960 struct alc_spec
*spec
= codec
->spec
;
2961 int idx
= alc880_multi_pin_idx(nid
);
2962 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
2963 AC_VERB_SET_CONNECT_SEL
,
2964 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
2968 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
2970 struct alc_spec
*spec
= codec
->spec
;
2973 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
2974 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
2975 alc880_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, i
);
2979 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
2981 struct alc_spec
*spec
= codec
->spec
;
2984 pin
= spec
->autocfg
.speaker_pins
[0];
2985 if (pin
) /* connect to front */
2986 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
2987 pin
= spec
->autocfg
.hp_pins
[0];
2988 if (pin
) /* connect to front */
2989 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
2992 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
2994 struct alc_spec
*spec
= codec
->spec
;
2997 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
2998 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
2999 if (alc880_is_input_pin(nid
)) {
3000 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
3001 i
<= AUTO_PIN_FRONT_MIC
? PIN_VREF80
: PIN_IN
);
3002 if (nid
!= ALC880_PIN_CD_NID
)
3003 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
3009 /* parse the BIOS configuration and set up the alc_spec */
3010 /* return 1 if successful, 0 if the proper config is not found, or a negative error code */
3011 static int alc880_parse_auto_config(struct hda_codec
*codec
)
3013 struct alc_spec
*spec
= codec
->spec
;
3015 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
3017 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
3018 alc880_ignore
)) < 0)
3020 if (! spec
->autocfg
.line_outs
)
3021 return 0; /* can't find valid BIOS pin config */
3023 if ((err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
)) < 0 ||
3024 (err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0 ||
3025 (err
= alc880_auto_create_extra_out(spec
,
3026 spec
->autocfg
.speaker_pins
[0],
3028 (err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pins
[0],
3029 "Headphone")) < 0 ||
3030 (err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
)) < 0)
3033 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
3035 if (spec
->autocfg
.dig_out_pin
)
3036 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
3037 if (spec
->autocfg
.dig_in_pin
)
3038 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
3040 if (spec
->kctl_alloc
)
3041 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3043 spec
->init_verbs
[spec
->num_init_verbs
++] = alc880_volume_init_verbs
;
3045 spec
->num_mux_defs
= 1;
3046 spec
->input_mux
= &spec
->private_imux
;
3051 /* additional initialization for auto-configuration model */
3052 static void alc880_auto_init(struct hda_codec
*codec
)
3054 alc880_auto_init_multi_out(codec
);
3055 alc880_auto_init_extra_out(codec
);
3056 alc880_auto_init_analog_input(codec
);
3060 * OK, here we have finally the patch for ALC880
3063 static int patch_alc880(struct hda_codec
*codec
)
3065 struct alc_spec
*spec
;
3069 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
3075 board_config
= snd_hda_check_board_config(codec
, alc880_cfg_tbl
);
3076 if (board_config
< 0 || board_config
>= ALC880_MODEL_LAST
) {
3077 printk(KERN_INFO
"hda_codec: Unknown model for ALC880, "
3078 "trying auto-probe from BIOS...\n");
3079 board_config
= ALC880_AUTO
;
3082 if (board_config
== ALC880_AUTO
) {
3083 /* automatic parse from the BIOS config */
3084 err
= alc880_parse_auto_config(codec
);
3090 "hda_codec: Cannot set up configuration "
3091 "from BIOS. Using 3-stack mode...\n");
3092 board_config
= ALC880_3ST
;
3096 if (board_config
!= ALC880_AUTO
)
3097 setup_preset(spec
, &alc880_presets
[board_config
]);
3099 spec
->stream_name_analog
= "ALC880 Analog";
3100 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
3101 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
3103 spec
->stream_name_digital
= "ALC880 Digital";
3104 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
3105 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
3107 if (! spec
->adc_nids
&& spec
->input_mux
) {
3108 /* check whether NID 0x07 is valid */
3109 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
3110 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
3111 if (wcap
!= AC_WID_AUD_IN
) {
3112 spec
->adc_nids
= alc880_adc_nids_alt
;
3113 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
3114 spec
->mixers
[spec
->num_mixers
] = alc880_capture_alt_mixer
;
3117 spec
->adc_nids
= alc880_adc_nids
;
3118 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
3119 spec
->mixers
[spec
->num_mixers
] = alc880_capture_mixer
;
3124 codec
->patch_ops
= alc_patch_ops
;
3125 if (board_config
== ALC880_AUTO
)
3126 spec
->init_hook
= alc880_auto_init
;
3136 static hda_nid_t alc260_dac_nids
[1] = {
3141 static hda_nid_t alc260_adc_nids
[1] = {
3146 static hda_nid_t alc260_adc_nids_alt
[1] = {
3151 static hda_nid_t alc260_hp_adc_nids
[2] = {
3156 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
3157 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
3159 static hda_nid_t alc260_dual_adc_nids
[2] = {
3164 #define ALC260_DIGOUT_NID 0x03
3165 #define ALC260_DIGIN_NID 0x06
3167 static struct hda_input_mux alc260_capture_source
= {
3171 { "Front Mic", 0x1 },
3177 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
3178 * headphone jack and the internal CD lines since these are the only pins at
3179 * which audio can appear. For flexibility, also allow the option of
3180 * recording the mixer output on the second ADC (ADC0 doesn't have a
3181 * connection to the mixer output).
3183 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
3187 { "Mic/Line", 0x0 },
3189 { "Headphone", 0x2 },
3195 { "Mic/Line", 0x0 },
3197 { "Headphone", 0x2 },
3204 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
3205 * the Fujitsu S702x, but jacks are marked differently.
3207 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
3214 { "Headphone", 0x5 },
3223 { "Headphone", 0x6 },
3229 * This is just place-holder, so there's something for alc_build_pcms to look
3230 * at when it calculates the maximum number of channels. ALC260 has no mixer
3231 * element which allows changing the channel mode, so the verb list is
3234 static struct hda_channel_mode alc260_modes
[1] = {
3239 /* Mixer combinations
3241 * basic: base_output + input + pc_beep + capture
3242 * HP: base_output + input + capture_alt
3243 * HP_3013: hp_3013 + input + capture
3244 * fujitsu: fujitsu + capture
3245 * acer: acer + capture
3248 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
3249 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3250 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
3251 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3252 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
3253 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3254 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
3258 static struct snd_kcontrol_new alc260_input_mixer
[] = {
3259 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3260 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3261 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3262 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3263 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3264 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3265 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
3266 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
3270 static struct snd_kcontrol_new alc260_pc_beep_mixer
[] = {
3271 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT
),
3272 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT
),
3276 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
3277 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3278 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
3279 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
3280 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
3281 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3282 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
3283 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3284 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
3288 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3289 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3291 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
3292 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3293 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
3294 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3295 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3296 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3297 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
3298 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
3299 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3300 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3301 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3302 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3303 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
3307 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3308 * versions of the ALC260 don't act on requests to enable mic bias from NID
3309 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3310 * datasheet doesn't mention this restriction. At this stage it's not clear
3311 * whether this behaviour is intentional or is a hardware bug in chip
3312 * revisions available in early 2006. Therefore for now allow the
3313 * "Headphone Jack Mode" control to span all choices, but if it turns out
3314 * that the lack of mic bias for this NID is intentional we could change the
3315 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3317 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3318 * don't appear to make the mic bias available from the "line" jack, even
3319 * though the NID used for this jack (0x14) can supply it. The theory is
3320 * that perhaps Acer have included blocking capacitors between the ALC260
3321 * and the output jack. If this turns out to be the case for all such
3322 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3323 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3325 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
3326 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3327 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
3328 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
3329 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3330 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3332 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3333 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3334 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3335 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3336 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3337 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3338 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3342 /* capture mixer elements */
3343 static struct snd_kcontrol_new alc260_capture_mixer
[] = {
3344 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT
),
3345 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT
),
3346 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT
),
3347 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT
),
3349 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3350 /* The multiple "Capture Source" controls confuse alsamixer
3351 * So call somewhat different..
3352 * FIXME: the controls appear in the "playback" view!
3354 /* .name = "Capture Source", */
3355 .name
= "Input Source",
3357 .info
= alc_mux_enum_info
,
3358 .get
= alc_mux_enum_get
,
3359 .put
= alc_mux_enum_put
,
3364 static struct snd_kcontrol_new alc260_capture_alt_mixer
[] = {
3365 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT
),
3366 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT
),
3368 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3369 /* The multiple "Capture Source" controls confuse alsamixer
3370 * So call somewhat different..
3371 * FIXME: the controls appear in the "playback" view!
3373 /* .name = "Capture Source", */
3374 .name
= "Input Source",
3376 .info
= alc_mux_enum_info
,
3377 .get
= alc_mux_enum_get
,
3378 .put
= alc_mux_enum_put
,
3384 * initialization verbs
3386 static struct hda_verb alc260_init_verbs
[] = {
3387 /* Line In pin widget for input */
3388 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3389 /* CD pin widget for input */
3390 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3391 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3392 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3393 /* Mic2 (front panel) pin widget for input and vref at 80% */
3394 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3395 /* LINE-2 is used for line-out in rear */
3396 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3397 /* select line-out */
3398 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
3400 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3402 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3404 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3405 /* mute capture amp left and right */
3406 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3407 /* set connection select to line in (default select for this ADC) */
3408 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3409 /* mute capture amp left and right */
3410 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3411 /* set connection select to line in (default select for this ADC) */
3412 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
3413 /* set vol=0 Line-Out mixer amp left and right */
3414 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3415 /* unmute pin widget amp left and right (no gain on this amp) */
3416 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3417 /* set vol=0 HP mixer amp left and right */
3418 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3419 /* unmute pin widget amp left and right (no gain on this amp) */
3420 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3421 /* set vol=0 Mono mixer amp left and right */
3422 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3423 /* unmute pin widget amp left and right (no gain on this amp) */
3424 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3425 /* unmute LINE-2 out pin */
3426 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3427 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */
3429 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
3431 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
3433 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3434 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3435 /* mute Front out path */
3436 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3437 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3438 /* mute Headphone out path */
3439 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3440 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3441 /* mute Mono out path */
3442 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3443 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3447 #if 0 /* should be identical with alc260_init_verbs? */
3448 static struct hda_verb alc260_hp_init_verbs
[] = {
3449 /* Headphone and output */
3450 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
3452 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3453 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3454 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3455 /* Mic2 (front panel) pin widget for input and vref at 80% */
3456 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3457 /* Line In pin widget for input */
3458 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3459 /* Line-2 pin widget for output */
3460 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3461 /* CD pin widget for input */
3462 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3463 /* unmute amp left and right */
3464 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
3465 /* set connection select to line in (default select for this ADC) */
3466 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3467 /* unmute Line-Out mixer amp left and right (volume = 0) */
3468 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3469 /* mute pin widget amp left and right (no gain on this amp) */
3470 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3471 /* unmute HP mixer amp left and right (volume = 0) */
3472 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3473 /* mute pin widget amp left and right (no gain on this amp) */
3474 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3475 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */
3477 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
3478 /* unmute Line In */
3479 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
3481 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3482 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3483 /* Unmute Front out path */
3484 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3485 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3486 /* Unmute Headphone out path */
3487 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3488 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3489 /* Unmute Mono out path */
3490 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3491 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3496 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
3497 /* Line out and output */
3498 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3500 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3501 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3502 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3503 /* Mic2 (front panel) pin widget for input and vref at 80% */
3504 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3505 /* Line In pin widget for input */
3506 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3507 /* Headphone pin widget for output */
3508 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
3509 /* CD pin widget for input */
3510 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3511 /* unmute amp left and right */
3512 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
3513 /* set connection select to line in (default select for this ADC) */
3514 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3515 /* unmute Line-Out mixer amp left and right (volume = 0) */
3516 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3517 /* mute pin widget amp left and right (no gain on this amp) */
3518 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3519 /* unmute HP mixer amp left and right (volume = 0) */
3520 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3521 /* mute pin widget amp left and right (no gain on this amp) */
3522 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3523 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */
3525 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
3526 /* unmute Line In */
3527 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
3529 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3530 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3531 /* Unmute Front out path */
3532 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3533 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3534 /* Unmute Headphone out path */
3535 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3536 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3537 /* Unmute Mono out path */
3538 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3539 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3543 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
3544 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
3545 * audio = 0x16, internal speaker = 0x10.
3547 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
3548 /* Disable all GPIOs */
3549 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
3550 /* Internal speaker is connected to headphone pin */
3551 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3552 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
3553 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3554 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
3555 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3556 /* Ensure all other unused pins are disabled and muted. */
3557 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3558 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3559 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3560 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3561 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3562 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3563 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3564 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3566 /* Disable digital (SPDIF) pins */
3567 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3568 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3570 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
3571 * when acting as an output.
3573 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
3575 /* Start with output sum widgets muted and their output gains at min */
3576 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3577 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3578 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3579 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3580 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3581 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3582 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3583 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3584 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3586 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
3587 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3588 /* Unmute Line1 pin widget output buffer since it starts as an output.
3589 * If the pin mode is changed by the user the pin mode control will
3590 * take care of enabling the pin's input/output buffers as needed.
3591 * Therefore there's no need to enable the input buffer at this
3594 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3595 /* Unmute input buffer of pin widget used for Line-in (no equiv
3598 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3600 /* Mute capture amp left and right */
3601 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3602 /* Set ADC connection select to match default mixer setting - line
3605 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
3607 /* Do the same for the second ADC: mute capture input amp and
3608 * set ADC connection to line in (on mic1 pin)
3610 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3611 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
3613 /* Mute all inputs to mixer widget (even unconnected ones) */
3614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
3615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
3616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
3617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
3618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
3619 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3620 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
3621 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
3626 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
3627 * similar laptops (adapted from Fujitsu init verbs).
3629 static struct hda_verb alc260_acer_init_verbs
[] = {
3630 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
3631 * the headphone jack. Turn this on and rely on the standard mute
3632 * methods whenever the user wants to turn these outputs off.
3634 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
3635 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
3636 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
3637 /* Internal speaker/Headphone jack is connected to Line-out pin */
3638 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3639 /* Internal microphone/Mic jack is connected to Mic1 pin */
3640 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
3641 /* Line In jack is connected to Line1 pin */
3642 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3643 /* Ensure all other unused pins are disabled and muted. */
3644 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3645 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3646 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3647 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3648 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3649 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3650 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3651 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3652 /* Disable digital (SPDIF) pins */
3653 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3654 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3656 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
3657 * bus when acting as outputs.
3659 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
3660 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
3662 /* Start with output sum widgets muted and their output gains at min */
3663 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3664 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3665 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3666 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3667 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3668 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3669 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3670 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3671 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3673 /* Unmute Line-out pin widget amp left and right (no equiv mixer ctrl) */
3674 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3675 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
3676 * inputs. If the pin mode is changed by the user the pin mode control
3677 * will take care of enabling the pin's input/output buffers as needed.
3678 * Therefore there's no need to enable the input buffer at this
3681 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3682 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3684 /* Mute capture amp left and right */
3685 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3686 /* Set ADC connection select to match default mixer setting - mic
3689 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
3691 /* Do similar with the second ADC: mute capture input amp and
3692 * set ADC connection to mic to match ALSA's default state.
3694 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3695 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
3697 /* Mute all inputs to mixer widget (even unconnected ones) */
3698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
3699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
3700 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
3701 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
3702 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
3703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3704 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
3705 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
3710 /* Test configuration for debugging, modelled after the ALC880 test
3713 #ifdef CONFIG_SND_DEBUG
3714 static hda_nid_t alc260_test_dac_nids
[1] = {
3717 static hda_nid_t alc260_test_adc_nids
[2] = {
3720 /* For testing the ALC260, each input MUX needs its own definition since
3721 * the signal assignments are different. This assumes that the first ADC
3724 static struct hda_input_mux alc260_test_capture_sources
[2] = {
3728 { "MIC1 pin", 0x0 },
3729 { "MIC2 pin", 0x1 },
3730 { "LINE1 pin", 0x2 },
3731 { "LINE2 pin", 0x3 },
3733 { "LINE-OUT pin", 0x5 },
3734 { "HP-OUT pin", 0x6 },
3740 { "MIC1 pin", 0x0 },
3741 { "MIC2 pin", 0x1 },
3742 { "LINE1 pin", 0x2 },
3743 { "LINE2 pin", 0x3 },
3746 { "LINE-OUT pin", 0x6 },
3747 { "HP-OUT pin", 0x7 },
3751 static struct snd_kcontrol_new alc260_test_mixer
[] = {
3752 /* Output driver widgets */
3753 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3754 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
3755 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3756 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
3757 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3758 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
3760 /* Modes for retasking pin widgets
3761 * Note: the ALC260 doesn't seem to act on requests to enable mic
3762 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
3763 * mention this restriction. At this stage it's not clear whether
3764 * this behaviour is intentional or is a hardware bug in chip
3765 * revisions available at least up until early 2006. Therefore for
3766 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
3767 * choices, but if it turns out that the lack of mic bias for these
3768 * NIDs is intentional we could change their modes from
3769 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3771 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
3772 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
3773 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
3774 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
3775 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
3776 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
3778 /* Loopback mixer controls */
3779 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
3780 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
3781 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
3782 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
3783 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
3784 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
3785 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
3786 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
3787 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3788 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3789 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3790 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3791 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
3792 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
3793 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
3794 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
3796 /* Controls for GPIO pins, assuming they are configured as outputs */
3797 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
3798 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
3799 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
3800 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
3802 /* Switches to allow the digital IO pins to be enabled. The datasheet
3803 * is ambigious as to which NID is which; testing on laptops which
3804 * make this output available should provide clarification.
3806 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
3807 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
3811 static struct hda_verb alc260_test_init_verbs
[] = {
3812 /* Enable all GPIOs as outputs with an initial value of 0 */
3813 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
3814 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
3815 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
3817 /* Enable retasking pins as output, initially without power amp */
3818 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3819 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3820 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3821 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3822 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3823 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3825 /* Disable digital (SPDIF) pins initially, but users can enable
3826 * them via a mixer switch. In the case of SPDIF-out, this initverb
3827 * payload also sets the generation to 0, output to be in "consumer"
3828 * PCM format, copyright asserted, no pre-emphasis and no validity
3831 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3832 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3834 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
3835 * OUT1 sum bus when acting as an output.
3837 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
3838 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
3839 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
3840 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
3842 /* Start with output sum widgets muted and their output gains at min */
3843 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3844 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3845 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3846 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3847 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3848 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3849 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3850 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3851 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3853 /* Unmute retasking pin widget output buffers since the default
3854 * state appears to be output. As the pin mode is changed by the
3855 * user the pin mode control will take care of enabling the pin's
3856 * input/output buffers as needed.
3858 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3859 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3860 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3861 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3862 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3863 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3864 /* Also unmute the mono-out pin widget */
3865 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3867 /* Mute capture amp left and right */
3868 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3869 /* Set ADC connection select to match default mixer setting (mic1
3872 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
3874 /* Do the same for the second ADC: mute capture input amp and
3875 * set ADC connection to mic1 pin
3877 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3878 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
3880 /* Mute all inputs to mixer widget (even unconnected ones) */
3881 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
3882 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
3883 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
3884 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
3885 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
3886 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3887 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
3888 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
3894 static struct hda_pcm_stream alc260_pcm_analog_playback
= {
3900 static struct hda_pcm_stream alc260_pcm_analog_capture
= {
3906 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
3907 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
3910 * for BIOS auto-configuration
3913 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
3917 unsigned long vol_val
, sw_val
;
3921 if (nid
>= 0x0f && nid
< 0x11) {
3922 nid_vol
= nid
- 0x7;
3923 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
3924 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
3925 } else if (nid
== 0x11) {
3926 nid_vol
= nid
- 0x7;
3927 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
3928 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
3929 } else if (nid
>= 0x12 && nid
<= 0x15) {
3931 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
3932 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
3936 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
3937 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
)) < 0)
3939 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
3940 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
)) < 0)
3945 /* add playback controls from the parsed DAC table */
3946 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
3947 const struct auto_pin_cfg
*cfg
)
3952 spec
->multiout
.num_dacs
= 1;
3953 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
3954 spec
->multiout
.dac_nids
[0] = 0x02;
3956 nid
= cfg
->line_out_pins
[0];
3958 err
= alc260_add_playback_controls(spec
, nid
, "Front");
3963 nid
= cfg
->speaker_pins
[0];
3965 err
= alc260_add_playback_controls(spec
, nid
, "Speaker");
3970 nid
= cfg
->hp_pins
[0];
3972 err
= alc260_add_playback_controls(spec
, nid
, "Headphone");
3979 /* create playback/capture controls for input pins */
3980 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
3981 const struct auto_pin_cfg
*cfg
)
3983 struct hda_input_mux
*imux
= &spec
->private_imux
;
3986 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3987 if (cfg
->input_pins
[i
] >= 0x12) {
3988 idx
= cfg
->input_pins
[i
] - 0x12;
3989 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
3990 auto_pin_cfg_labels
[i
], idx
, 0x07);
3993 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
3994 imux
->items
[imux
->num_items
].index
= idx
;
3997 if ((cfg
->input_pins
[i
] >= 0x0f) && (cfg
->input_pins
[i
] <= 0x10)){
3998 idx
= cfg
->input_pins
[i
] - 0x09;
3999 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
4000 auto_pin_cfg_labels
[i
], idx
, 0x07);
4003 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
4004 imux
->items
[imux
->num_items
].index
= idx
;
4011 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
4012 hda_nid_t nid
, int pin_type
,
4016 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
4017 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
4018 /* need the manual connection? */
4020 int idx
= nid
- 0x12;
4021 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
4022 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
4027 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
4029 struct alc_spec
*spec
= codec
->spec
;
4032 nid
= spec
->autocfg
.line_out_pins
[0];
4034 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
4036 nid
= spec
->autocfg
.speaker_pins
[0];
4038 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
4040 nid
= spec
->autocfg
.hp_pins
[0];
4042 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
4045 #define ALC260_PIN_CD_NID 0x16
4046 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
4048 struct alc_spec
*spec
= codec
->spec
;
4051 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4052 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
4054 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4055 i
<= AUTO_PIN_FRONT_MIC
? PIN_VREF80
: PIN_IN
);
4056 if (nid
!= ALC260_PIN_CD_NID
)
4057 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4064 * generic initialization of ADC, input mixers and output mixers
4066 static struct hda_verb alc260_volume_init_verbs
[] = {
4068 * Unmute ADC0-1 and set the default input to mic-in
4070 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
4071 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4072 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
4073 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4075 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4077 * Note: PASD motherboards uses the Line In 2 as the input for front panel
4080 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4081 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4082 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4083 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
4084 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
4085 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
4088 * Set up output mixers (0x08 - 0x0a)
4090 /* set vol=0 to output mixers */
4091 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4092 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4093 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4094 /* set up input amps for analog loopback */
4095 /* Amp Indices: DAC = 0, mixer = 1 */
4096 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4097 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4098 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4099 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4100 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4101 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4106 static int alc260_parse_auto_config(struct hda_codec
*codec
)
4108 struct alc_spec
*spec
= codec
->spec
;
4111 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
4113 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
4114 alc260_ignore
)) < 0)
4116 if ((err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0)
4118 if (! spec
->kctl_alloc
)
4119 return 0; /* can't find valid BIOS pin config */
4120 if ((err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
)) < 0)
4123 spec
->multiout
.max_channels
= 2;
4125 if (spec
->autocfg
.dig_out_pin
)
4126 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
4127 if (spec
->kctl_alloc
)
4128 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
4130 spec
->init_verbs
[spec
->num_init_verbs
++] = alc260_volume_init_verbs
;
4132 spec
->num_mux_defs
= 1;
4133 spec
->input_mux
= &spec
->private_imux
;
4135 /* check whether NID 0x04 is valid */
4136 wcap
= get_wcaps(codec
, 0x04);
4137 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
4138 if (wcap
!= AC_WID_AUD_IN
) {
4139 spec
->adc_nids
= alc260_adc_nids_alt
;
4140 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
4141 spec
->mixers
[spec
->num_mixers
] = alc260_capture_alt_mixer
;
4143 spec
->adc_nids
= alc260_adc_nids
;
4144 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
4145 spec
->mixers
[spec
->num_mixers
] = alc260_capture_mixer
;
4152 /* additional initialization for auto-configuration model */
4153 static void alc260_auto_init(struct hda_codec
*codec
)
4155 alc260_auto_init_multi_out(codec
);
4156 alc260_auto_init_analog_input(codec
);
4160 * ALC260 configurations
4162 static struct hda_board_config alc260_cfg_tbl
[] = {
4163 { .modelname
= "basic", .config
= ALC260_BASIC
},
4164 { .pci_subvendor
= 0x104d, .pci_subdevice
= 0x81bb,
4165 .config
= ALC260_BASIC
}, /* Sony VAIO */
4166 { .pci_subvendor
= 0x104d, .pci_subdevice
= 0x81cc,
4167 .config
= ALC260_BASIC
}, /* Sony VAIO VGN-S3HP */
4168 { .pci_subvendor
= 0x104d, .pci_subdevice
= 0x81cd,
4169 .config
= ALC260_BASIC
}, /* Sony VAIO */
4170 { .pci_subvendor
= 0x152d, .pci_subdevice
= 0x0729,
4171 .config
= ALC260_BASIC
}, /* CTL Travel Master U553W */
4172 { .modelname
= "hp", .config
= ALC260_HP
},
4173 { .modelname
= "hp-3013", .config
= ALC260_HP_3013
},
4174 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3010, .config
= ALC260_HP_3013
},
4175 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3011, .config
= ALC260_HP
},
4176 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3012, .config
= ALC260_HP_3013
},
4177 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3013, .config
= ALC260_HP_3013
},
4178 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3014, .config
= ALC260_HP
},
4179 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3015, .config
= ALC260_HP
},
4180 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3016, .config
= ALC260_HP
},
4181 { .modelname
= "fujitsu", .config
= ALC260_FUJITSU_S702X
},
4182 { .pci_subvendor
= 0x10cf, .pci_subdevice
= 0x1326, .config
= ALC260_FUJITSU_S702X
},
4183 { .modelname
= "acer", .config
= ALC260_ACER
},
4184 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0x008f, .config
= ALC260_ACER
},
4185 #ifdef CONFIG_SND_DEBUG
4186 { .modelname
= "test", .config
= ALC260_TEST
},
4188 { .modelname
= "auto", .config
= ALC260_AUTO
},
4192 static struct alc_config_preset alc260_presets
[] = {
4194 .mixers
= { alc260_base_output_mixer
,
4196 alc260_pc_beep_mixer
,
4197 alc260_capture_mixer
},
4198 .init_verbs
= { alc260_init_verbs
},
4199 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4200 .dac_nids
= alc260_dac_nids
,
4201 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
4202 .adc_nids
= alc260_adc_nids
,
4203 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4204 .channel_mode
= alc260_modes
,
4205 .input_mux
= &alc260_capture_source
,
4208 .mixers
= { alc260_base_output_mixer
,
4210 alc260_capture_alt_mixer
},
4211 .init_verbs
= { alc260_init_verbs
},
4212 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4213 .dac_nids
= alc260_dac_nids
,
4214 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
4215 .adc_nids
= alc260_hp_adc_nids
,
4216 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4217 .channel_mode
= alc260_modes
,
4218 .input_mux
= &alc260_capture_source
,
4220 [ALC260_HP_3013
] = {
4221 .mixers
= { alc260_hp_3013_mixer
,
4223 alc260_capture_alt_mixer
},
4224 .init_verbs
= { alc260_hp_3013_init_verbs
},
4225 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4226 .dac_nids
= alc260_dac_nids
,
4227 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
4228 .adc_nids
= alc260_hp_adc_nids
,
4229 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4230 .channel_mode
= alc260_modes
,
4231 .input_mux
= &alc260_capture_source
,
4233 [ALC260_FUJITSU_S702X
] = {
4234 .mixers
= { alc260_fujitsu_mixer
,
4235 alc260_capture_mixer
},
4236 .init_verbs
= { alc260_fujitsu_init_verbs
},
4237 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4238 .dac_nids
= alc260_dac_nids
,
4239 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
4240 .adc_nids
= alc260_dual_adc_nids
,
4241 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4242 .channel_mode
= alc260_modes
,
4243 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
4244 .input_mux
= alc260_fujitsu_capture_sources
,
4247 .mixers
= { alc260_acer_mixer
,
4248 alc260_capture_mixer
},
4249 .init_verbs
= { alc260_acer_init_verbs
},
4250 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
4251 .dac_nids
= alc260_dac_nids
,
4252 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
4253 .adc_nids
= alc260_dual_adc_nids
,
4254 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4255 .channel_mode
= alc260_modes
,
4256 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
4257 .input_mux
= alc260_acer_capture_sources
,
4259 #ifdef CONFIG_SND_DEBUG
4261 .mixers
= { alc260_test_mixer
,
4262 alc260_capture_mixer
},
4263 .init_verbs
= { alc260_test_init_verbs
},
4264 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
4265 .dac_nids
= alc260_test_dac_nids
,
4266 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
4267 .adc_nids
= alc260_test_adc_nids
,
4268 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
4269 .channel_mode
= alc260_modes
,
4270 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
4271 .input_mux
= alc260_test_capture_sources
,
4276 static int patch_alc260(struct hda_codec
*codec
)
4278 struct alc_spec
*spec
;
4279 int err
, board_config
;
4281 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4287 board_config
= snd_hda_check_board_config(codec
, alc260_cfg_tbl
);
4288 if (board_config
< 0 || board_config
>= ALC260_MODEL_LAST
) {
4289 snd_printd(KERN_INFO
"hda_codec: Unknown model for ALC260, "
4290 "trying auto-probe from BIOS...\n");
4291 board_config
= ALC260_AUTO
;
4294 if (board_config
== ALC260_AUTO
) {
4295 /* automatic parse from the BIOS config */
4296 err
= alc260_parse_auto_config(codec
);
4302 "hda_codec: Cannot set up configuration "
4303 "from BIOS. Using base mode...\n");
4304 board_config
= ALC260_BASIC
;
4308 if (board_config
!= ALC260_AUTO
)
4309 setup_preset(spec
, &alc260_presets
[board_config
]);
4311 spec
->stream_name_analog
= "ALC260 Analog";
4312 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
4313 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
4315 spec
->stream_name_digital
= "ALC260 Digital";
4316 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
4317 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
4319 codec
->patch_ops
= alc_patch_ops
;
4320 if (board_config
== ALC260_AUTO
)
4321 spec
->init_hook
= alc260_auto_init
;
4330 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
4331 * configuration. Each pin widget can choose any input DACs and a mixer.
4332 * Each ADC is connected from a mixer of all inputs. This makes possible
4333 * 6-channel independent captures.
4335 * In addition, an independent DAC for the multi-playback (not used in this
4338 #define ALC882_DIGOUT_NID 0x06
4339 #define ALC882_DIGIN_NID 0x0a
4341 static struct hda_channel_mode alc882_ch_modes
[1] = {
4345 static hda_nid_t alc882_dac_nids
[4] = {
4346 /* front, rear, clfe, rear_surr */
4347 0x02, 0x03, 0x04, 0x05
4350 /* identical with ALC880 */
4351 #define alc882_adc_nids alc880_adc_nids
4352 #define alc882_adc_nids_alt alc880_adc_nids_alt
4355 /* FIXME: should be a matrix-type input source selection */
4357 static struct hda_input_mux alc882_capture_source
= {
4361 { "Front Mic", 0x1 },
4366 #define alc882_mux_enum_info alc_mux_enum_info
4367 #define alc882_mux_enum_get alc_mux_enum_get
4369 static int alc882_mux_enum_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
4371 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4372 struct alc_spec
*spec
= codec
->spec
;
4373 const struct hda_input_mux
*imux
= spec
->input_mux
;
4374 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
4375 static hda_nid_t capture_mixers
[3] = { 0x24, 0x23, 0x22 };
4376 hda_nid_t nid
= capture_mixers
[adc_idx
];
4377 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
4378 unsigned int i
, idx
;
4380 idx
= ucontrol
->value
.enumerated
.item
[0];
4381 if (idx
>= imux
->num_items
)
4382 idx
= imux
->num_items
- 1;
4383 if (*cur_val
== idx
&& ! codec
->in_resume
)
4385 for (i
= 0; i
< imux
->num_items
; i
++) {
4386 unsigned int v
= (i
== idx
) ? 0x7000 : 0x7080;
4387 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4388 v
| (imux
->items
[i
].index
<< 8));
4397 static struct hda_verb alc882_sixstack_ch6_init
[] = {
4398 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
4399 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4400 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4401 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4408 static struct hda_verb alc882_sixstack_ch8_init
[] = {
4409 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4410 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4411 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4412 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4416 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
4417 { 6, alc882_sixstack_ch6_init
},
4418 { 8, alc882_sixstack_ch8_init
},
4421 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
4422 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
4424 static struct snd_kcontrol_new alc882_base_mixer
[] = {
4425 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4426 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4427 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
4428 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
4429 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
4430 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
4431 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
4432 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
4433 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
4434 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
4435 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
4436 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
4437 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
4438 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
4439 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
4440 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4441 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4442 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4443 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4444 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
4445 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
4449 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
4451 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4452 .name
= "Channel Mode",
4453 .info
= alc_ch_mode_info
,
4454 .get
= alc_ch_mode_get
,
4455 .put
= alc_ch_mode_put
,
4460 static struct hda_verb alc882_init_verbs
[] = {
4461 /* Front mixer: unmute input/output amp left and right (volume = 0) */
4462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4466 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4467 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4468 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4470 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4471 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4472 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4474 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4475 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4476 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4478 /* Front Pin: output 0 (0x0c) */
4479 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4480 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4481 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
4482 /* Rear Pin: output 1 (0x0d) */
4483 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4484 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4485 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
4486 /* CLFE Pin: output 2 (0x0e) */
4487 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4488 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4489 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
4490 /* Side Pin: output 3 (0x0f) */
4491 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4492 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4493 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
4494 /* Mic (rear) pin: input vref at 80% */
4495 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4496 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4497 /* Front Mic pin: input vref at 80% */
4498 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4499 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4500 /* Line In pin: input */
4501 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4502 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4503 /* Line-2 In: Headphone output (output 0 - 0x0c) */
4504 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4505 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4506 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
4507 /* CD pin widget for input */
4508 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4510 /* FIXME: use matrix-type input source selection */
4511 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
4512 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
4513 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4514 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4515 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4516 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4518 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4519 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4520 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4523 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4524 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4525 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4527 /* ADC1: mute amp left and right */
4528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4529 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4530 /* ADC2: mute amp left and right */
4531 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4532 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4533 /* ADC3: mute amp left and right */
4534 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4535 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4540 static struct hda_verb alc882_eapd_verbs
[] = {
4541 /* change to EAPD mode */
4542 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
4543 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
4548 * generic initialization of ADC, input mixers and output mixers
4550 static struct hda_verb alc882_auto_init_verbs
[] = {
4552 * Unmute ADC0-2 and set the default input to mic-in
4554 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4555 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4556 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4557 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4558 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4559 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4561 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4563 * Note: PASD motherboards uses the Line In 2 as the input for front panel
4566 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4567 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
4570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
4571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
4574 * Set up output mixers (0x0c - 0x0f)
4576 /* set vol=0 to output mixers */
4577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4578 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4579 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4580 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4581 /* set up input amps for analog loopback */
4582 /* Amp Indices: DAC = 0, mixer = 1 */
4583 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4584 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4586 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4587 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4588 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4589 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4590 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4591 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4592 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4594 /* FIXME: use matrix-type input source selection */
4595 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
4596 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
4597 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4598 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
4599 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
4600 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
4602 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4603 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
4604 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
4605 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
4607 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4608 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
4609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
4610 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
4615 /* capture mixer elements */
4616 static struct snd_kcontrol_new alc882_capture_alt_mixer
[] = {
4617 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
4618 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
4619 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
4620 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
4622 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4623 /* The multiple "Capture Source" controls confuse alsamixer
4624 * So call somewhat different..
4625 * FIXME: the controls appear in the "playback" view!
4627 /* .name = "Capture Source", */
4628 .name
= "Input Source",
4630 .info
= alc882_mux_enum_info
,
4631 .get
= alc882_mux_enum_get
,
4632 .put
= alc882_mux_enum_put
,
4637 static struct snd_kcontrol_new alc882_capture_mixer
[] = {
4638 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
4639 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
4640 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
4641 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
4642 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
4643 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
4645 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4646 /* The multiple "Capture Source" controls confuse alsamixer
4647 * So call somewhat different..
4648 * FIXME: the controls appear in the "playback" view!
4650 /* .name = "Capture Source", */
4651 .name
= "Input Source",
4653 .info
= alc882_mux_enum_info
,
4654 .get
= alc882_mux_enum_get
,
4655 .put
= alc882_mux_enum_put
,
4660 /* pcm configuration: identiacal with ALC880 */
4661 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
4662 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
4663 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
4664 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
4667 * configuration and preset
4669 static struct hda_board_config alc882_cfg_tbl
[] = {
4670 { .modelname
= "3stack-dig", .config
= ALC882_3ST_DIG
},
4671 { .modelname
= "6stack-dig", .config
= ALC882_6ST_DIG
},
4672 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x6668,
4673 .config
= ALC882_6ST_DIG
}, /* MSI */
4674 { .pci_subvendor
= 0x105b, .pci_subdevice
= 0x6668,
4675 .config
= ALC882_6ST_DIG
}, /* Foxconn */
4676 { .pci_subvendor
= 0x1019, .pci_subdevice
= 0x6668,
4677 .config
= ALC882_6ST_DIG
}, /* ECS to Intel*/
4678 { .modelname
= "arima", .config
= ALC882_ARIMA
},
4679 { .pci_subvendor
= 0x161f, .pci_subdevice
= 0x2054,
4680 .config
= ALC882_ARIMA
}, /* Arima W820Di1 */
4681 { .modelname
= "auto", .config
= ALC882_AUTO
},
4685 static struct alc_config_preset alc882_presets
[] = {
4686 [ALC882_3ST_DIG
] = {
4687 .mixers
= { alc882_base_mixer
},
4688 .init_verbs
= { alc882_init_verbs
},
4689 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
4690 .dac_nids
= alc882_dac_nids
,
4691 .dig_out_nid
= ALC882_DIGOUT_NID
,
4692 .dig_in_nid
= ALC882_DIGIN_NID
,
4693 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
4694 .channel_mode
= alc882_ch_modes
,
4696 .input_mux
= &alc882_capture_source
,
4698 [ALC882_6ST_DIG
] = {
4699 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
4700 .init_verbs
= { alc882_init_verbs
},
4701 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
4702 .dac_nids
= alc882_dac_nids
,
4703 .dig_out_nid
= ALC882_DIGOUT_NID
,
4704 .dig_in_nid
= ALC882_DIGIN_NID
,
4705 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
4706 .channel_mode
= alc882_sixstack_modes
,
4707 .input_mux
= &alc882_capture_source
,
4710 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
4711 .init_verbs
= { alc882_init_verbs
, alc882_eapd_verbs
},
4712 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
4713 .dac_nids
= alc882_dac_nids
,
4714 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
4715 .channel_mode
= alc882_sixstack_modes
,
4716 .input_mux
= &alc882_capture_source
,
4722 * BIOS auto configuration
4724 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
4725 hda_nid_t nid
, int pin_type
,
4729 struct alc_spec
*spec
= codec
->spec
;
4732 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
4735 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
4737 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
4738 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
4739 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
4743 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
4745 struct alc_spec
*spec
= codec
->spec
;
4748 for (i
= 0; i
<= HDA_SIDE
; i
++) {
4749 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
4751 alc882_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, i
);
4755 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
4757 struct alc_spec
*spec
= codec
->spec
;
4760 pin
= spec
->autocfg
.hp_pins
[0];
4761 if (pin
) /* connect to front */
4762 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0); /* use dac 0 */
4765 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
4766 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
4768 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
4770 struct alc_spec
*spec
= codec
->spec
;
4773 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4774 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
4775 if (alc882_is_input_pin(nid
)) {
4776 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4777 i
<= AUTO_PIN_FRONT_MIC
? PIN_VREF80
: PIN_IN
);
4778 if (nid
!= ALC882_PIN_CD_NID
)
4779 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4785 /* almost identical with ALC880 parser... */
4786 static int alc882_parse_auto_config(struct hda_codec
*codec
)
4788 struct alc_spec
*spec
= codec
->spec
;
4789 int err
= alc880_parse_auto_config(codec
);
4794 /* hack - override the init verbs */
4795 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
4799 /* additional initialization for auto-configuration model */
4800 static void alc882_auto_init(struct hda_codec
*codec
)
4802 alc882_auto_init_multi_out(codec
);
4803 alc882_auto_init_hp_out(codec
);
4804 alc882_auto_init_analog_input(codec
);
4807 static int patch_alc882(struct hda_codec
*codec
)
4809 struct alc_spec
*spec
;
4810 int err
, board_config
;
4812 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4818 board_config
= snd_hda_check_board_config(codec
, alc882_cfg_tbl
);
4820 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
4821 printk(KERN_INFO
"hda_codec: Unknown model for ALC882, "
4822 "trying auto-probe from BIOS...\n");
4823 board_config
= ALC882_AUTO
;
4826 if (board_config
== ALC882_AUTO
) {
4827 /* automatic parse from the BIOS config */
4828 err
= alc882_parse_auto_config(codec
);
4834 "hda_codec: Cannot set up configuration "
4835 "from BIOS. Using base mode...\n");
4836 board_config
= ALC882_3ST_DIG
;
4840 if (board_config
!= ALC882_AUTO
)
4841 setup_preset(spec
, &alc882_presets
[board_config
]);
4843 spec
->stream_name_analog
= "ALC882 Analog";
4844 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
4845 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
4847 spec
->stream_name_digital
= "ALC882 Digital";
4848 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
4849 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
4851 if (! spec
->adc_nids
&& spec
->input_mux
) {
4852 /* check whether NID 0x07 is valid */
4853 unsigned int wcap
= get_wcaps(codec
, 0x07);
4854 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
4855 if (wcap
!= AC_WID_AUD_IN
) {
4856 spec
->adc_nids
= alc882_adc_nids_alt
;
4857 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
4858 spec
->mixers
[spec
->num_mixers
] = alc882_capture_alt_mixer
;
4861 spec
->adc_nids
= alc882_adc_nids
;
4862 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
4863 spec
->mixers
[spec
->num_mixers
] = alc882_capture_mixer
;
4868 codec
->patch_ops
= alc_patch_ops
;
4869 if (board_config
== ALC882_AUTO
)
4870 spec
->init_hook
= alc882_auto_init
;
4878 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
4879 * configuration. Each pin widget can choose any input DACs and a mixer.
4880 * Each ADC is connected from a mixer of all inputs. This makes possible
4881 * 6-channel independent captures.
4883 * In addition, an independent DAC for the multi-playback (not used in this
4886 #define ALC883_DIGOUT_NID 0x06
4887 #define ALC883_DIGIN_NID 0x0a
4889 static hda_nid_t alc883_dac_nids
[4] = {
4890 /* front, rear, clfe, rear_surr */
4891 0x02, 0x04, 0x03, 0x05
4894 static hda_nid_t alc883_adc_nids
[2] = {
4899 /* FIXME: should be a matrix-type input source selection */
4901 static struct hda_input_mux alc883_capture_source
= {
4905 { "Front Mic", 0x1 },
4910 #define alc883_mux_enum_info alc_mux_enum_info
4911 #define alc883_mux_enum_get alc_mux_enum_get
4913 static int alc883_mux_enum_put(struct snd_kcontrol
*kcontrol
,
4914 struct snd_ctl_elem_value
*ucontrol
)
4916 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4917 struct alc_spec
*spec
= codec
->spec
;
4918 const struct hda_input_mux
*imux
= spec
->input_mux
;
4919 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
4920 static hda_nid_t capture_mixers
[3] = { 0x24, 0x23, 0x22 };
4921 hda_nid_t nid
= capture_mixers
[adc_idx
];
4922 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
4923 unsigned int i
, idx
;
4925 idx
= ucontrol
->value
.enumerated
.item
[0];
4926 if (idx
>= imux
->num_items
)
4927 idx
= imux
->num_items
- 1;
4928 if (*cur_val
== idx
&& ! codec
->in_resume
)
4930 for (i
= 0; i
< imux
->num_items
; i
++) {
4931 unsigned int v
= (i
== idx
) ? 0x7000 : 0x7080;
4932 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4933 v
| (imux
->items
[i
].index
<< 8));
4941 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
4948 static struct hda_verb alc883_3ST_ch2_init
[] = {
4949 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4950 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4951 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4952 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4959 static struct hda_verb alc883_3ST_ch6_init
[] = {
4960 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4961 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4962 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
4963 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4964 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4965 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
4969 static struct hda_channel_mode alc883_3ST_6ch_modes
[2] = {
4970 { 2, alc883_3ST_ch2_init
},
4971 { 6, alc883_3ST_ch6_init
},
4977 static struct hda_verb alc883_sixstack_ch6_init
[] = {
4978 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
4979 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4980 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4981 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4988 static struct hda_verb alc883_sixstack_ch8_init
[] = {
4989 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4990 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4991 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4992 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4996 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
4997 { 6, alc883_sixstack_ch6_init
},
4998 { 8, alc883_sixstack_ch8_init
},
5001 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
5002 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
5005 static struct snd_kcontrol_new alc883_base_mixer
[] = {
5006 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5007 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5008 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5009 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5010 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5011 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5012 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5013 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5014 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
5015 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
5016 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5017 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5018 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5019 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5020 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5021 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5022 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5023 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5024 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5025 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5026 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5027 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5028 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5029 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5030 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5032 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5033 /* .name = "Capture Source", */
5034 .name
= "Input Source",
5036 .info
= alc883_mux_enum_info
,
5037 .get
= alc883_mux_enum_get
,
5038 .put
= alc883_mux_enum_put
,
5043 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
5044 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5045 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5046 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5047 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5048 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5049 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5050 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5051 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5052 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5053 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5054 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5055 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5056 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5057 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5058 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5059 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5060 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5062 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5063 /* .name = "Capture Source", */
5064 .name
= "Input Source",
5066 .info
= alc883_mux_enum_info
,
5067 .get
= alc883_mux_enum_get
,
5068 .put
= alc883_mux_enum_put
,
5073 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
5074 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5075 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
5076 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5077 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5078 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5079 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5080 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5081 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5082 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5083 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5084 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5085 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5086 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5087 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5088 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5089 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5090 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5091 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5092 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5093 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5094 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5095 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5096 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5098 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5099 /* .name = "Capture Source", */
5100 .name
= "Input Source",
5102 .info
= alc883_mux_enum_info
,
5103 .get
= alc883_mux_enum_get
,
5104 .put
= alc883_mux_enum_put
,
5109 static snd_kcontrol_new_t alc883_fivestack_mixer
[] = {
5110 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5111 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5112 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5113 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5114 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5115 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5116 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT
),
5117 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
5118 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5119 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5120 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5121 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5122 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5125 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
5126 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
5127 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5128 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5129 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5130 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5133 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5134 /* .name = "Capture Source", */
5135 .name
= "Input Source",
5137 .info
= alc883_mux_enum_info
,
5138 .get
= alc883_mux_enum_get
,
5139 .put
= alc883_mux_enum_put
,
5144 static struct snd_kcontrol_new alc883_tagra_mixer
[] = {
5145 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5146 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5147 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5148 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
5149 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
5150 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
5151 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5152 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
5153 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
5154 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5155 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5156 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5157 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5158 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5159 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5160 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5161 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5162 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5163 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5165 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5166 /* .name = "Capture Source", */
5167 .name
= "Input Source",
5169 .info
= alc883_mux_enum_info
,
5170 .get
= alc883_mux_enum_get
,
5171 .put
= alc883_mux_enum_put
,
5176 static struct snd_kcontrol_new alc883_tagra_2ch_mixer
[] = {
5177 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5178 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5179 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5180 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5181 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5182 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5183 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5184 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5185 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5186 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5187 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5189 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5190 /* .name = "Capture Source", */
5191 .name
= "Input Source",
5193 .info
= alc883_mux_enum_info
,
5194 .get
= alc883_mux_enum_get
,
5195 .put
= alc883_mux_enum_put
,
5200 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
5202 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5203 .name
= "Channel Mode",
5204 .info
= alc_ch_mode_info
,
5205 .get
= alc_ch_mode_get
,
5206 .put
= alc_ch_mode_put
,
5211 static struct hda_verb alc883_init_verbs
[] = {
5212 /* ADC1: mute amp left and right */
5213 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5214 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5215 /* ADC2: mute amp left and right */
5216 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5217 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5218 /* Front mixer: unmute input/output amp left and right (volume = 0) */
5219 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5220 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5221 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5223 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5224 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5225 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5227 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5228 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5229 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5231 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5232 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
5233 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
5235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5237 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5238 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
5239 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5241 /* Front Pin: output 0 (0x0c) */
5242 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5243 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5244 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5245 /* Rear Pin: output 1 (0x0d) */
5246 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5247 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5248 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5249 /* CLFE Pin: output 2 (0x0e) */
5250 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5251 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5252 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
5253 /* Side Pin: output 3 (0x0f) */
5254 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5255 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5256 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
5257 /* Mic (rear) pin: input vref at 80% */
5258 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5259 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5260 /* Front Mic pin: input vref at 80% */
5261 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
5262 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5263 /* Line In pin: input */
5264 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5265 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
5266 /* Line-2 In: Headphone output (output 0 - 0x0c) */
5267 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5268 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5269 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5270 /* CD pin widget for input */
5271 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
5273 /* FIXME: use matrix-type input source selection */
5274 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5276 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5277 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5278 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5279 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5281 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5282 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5283 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5284 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5288 static struct hda_verb alc883_tagra_verbs
[] = {
5289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5292 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5293 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5295 {0x18, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
5296 {0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/surround */
5297 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
5299 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, ALC880_HP_EVENT
| AC_USRSP_EN
},
5300 {0x01, AC_VERB_SET_GPIO_MASK
, 0x03},
5301 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x03},
5302 {0x01, AC_VERB_SET_GPIO_DATA
, 0x03},
5307 /* toggle speaker-output according to the hp-jack state */
5308 static void alc883_tagra_automute(struct hda_codec
*codec
)
5310 unsigned int present
;
5312 present
= snd_hda_codec_read(codec
, 0x14, 0,
5313 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
5314 snd_hda_codec_amp_update(codec
, 0x1b, 0, HDA_OUTPUT
, 0,
5315 0x80, present
? 0x80 : 0);
5316 snd_hda_codec_amp_update(codec
, 0x1b, 1, HDA_OUTPUT
, 0,
5317 0x80, present
? 0x80 : 0);
5318 snd_hda_codec_write(codec
, 1, 0, AC_VERB_SET_GPIO_DATA
, present
? 1 : 3);
5321 static void alc883_tagra_unsol_event(struct hda_codec
*codec
, unsigned int res
)
5323 if ((res
>> 26) == ALC880_HP_EVENT
)
5324 alc883_tagra_automute(codec
);
5328 * generic initialization of ADC, input mixers and output mixers
5330 static struct hda_verb alc883_auto_init_verbs
[] = {
5332 * Unmute ADC0-2 and set the default input to mic-in
5334 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5335 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5336 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5337 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5339 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5341 * Note: PASD motherboards uses the Line In 2 as the input for front panel
5344 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5345 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5346 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5347 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5348 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
5349 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5352 * Set up output mixers (0x0c - 0x0f)
5354 /* set vol=0 to output mixers */
5355 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5356 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5358 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5359 /* set up input amps for analog loopback */
5360 /* Amp Indices: DAC = 0, mixer = 1 */
5361 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5363 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5364 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5365 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5366 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5367 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5368 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5369 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5370 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5372 /* FIXME: use matrix-type input source selection */
5373 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5378 //{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
5379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5381 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5384 //{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
5385 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5390 /* capture mixer elements */
5391 static struct snd_kcontrol_new alc883_capture_mixer
[] = {
5392 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5393 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5394 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
5395 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
5397 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5398 /* The multiple "Capture Source" controls confuse alsamixer
5399 * So call somewhat different..
5400 * FIXME: the controls appear in the "playback" view!
5402 /* .name = "Capture Source", */
5403 .name
= "Input Source",
5405 .info
= alc882_mux_enum_info
,
5406 .get
= alc882_mux_enum_get
,
5407 .put
= alc882_mux_enum_put
,
5412 /* pcm configuration: identiacal with ALC880 */
5413 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
5414 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
5415 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
5416 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
5419 * configuration and preset
5421 static struct hda_board_config alc883_cfg_tbl
[] = {
5422 { .modelname
= "3stack-dig", .config
= ALC883_3ST_2ch_DIG
},
5423 { .modelname
= "3stack-6ch-dig", .config
= ALC883_3ST_6ch_DIG
},
5424 { .pci_subvendor
= 0x1019, .pci_subdevice
= 0x6668,
5425 .config
= ALC883_3ST_6ch_DIG
}, /* ECS to Intel*/
5426 { .modelname
= "3stack-6ch", .config
= ALC883_3ST_6ch
},
5427 { .pci_subvendor
= 0x108e, .pci_subdevice
= 0x534d,
5428 .config
= ALC883_3ST_6ch
},
5429 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xd601,
5430 .config
= ALC883_3ST_6ch
}, /* D102GGC */
5431 { .modelname
= "6stack-dig", .config
= ALC883_6ST_DIG
},
5432 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x6668,
5433 .config
= ALC883_6ST_DIG
}, /* MSI */
5434 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x7280,
5435 .config
= ALC883_6ST_DIG
}, /* MSI K9A Platinum (MS-7280) */
5436 { .pci_subvendor
= 0x105b, .pci_subdevice
= 0x6668,
5437 .config
= ALC883_6ST_DIG
}, /* Foxconn */
5438 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x7187,
5439 .config
= ALC883_6ST_DIG
}, /* MSI */
5440 { .modelname
= "targa-dig", .config
= ALC883_TARGA_DIG
},
5441 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x4314,
5442 .config
= ALC883_TARGA_DIG
}, /* MSI */
5443 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x3fcc,
5444 .config
= ALC883_TARGA_DIG
}, /* MSI */
5445 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x3fc1,
5446 .config
= ALC883_TARGA_DIG
}, /* MSI */
5447 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x3fc3,
5448 .config
= ALC883_TARGA_DIG
}, /* MSI */
5449 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x4314,
5450 .config
= ALC883_TARGA_DIG
}, /* MSI */
5451 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x4319,
5452 .config
= ALC883_TARGA_DIG
}, /* MSI */
5453 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x3ef9,
5454 .config
= ALC883_TARGA_DIG
}, /* MSI */
5455 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x4324,
5456 .config
= ALC883_TARGA_DIG
}, /* MSI */
5457 { .modelname
= "targa-2ch-dig", .config
= ALC883_TARGA_2ch_DIG
},
5458 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x0579,
5459 .config
= ALC883_TARGA_2ch_DIG
}, /* MSI */
5460 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0xa422,
5461 .config
= ALC883_TARGA_2ch_DIG
}, /* MSI */
5462 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x3b7f,
5463 .config
= ALC883_TARGA_2ch_DIG
}, /* MSI */
5464 { .modelname
= "6stack-dig-demo", .config
= ALC888_DEMO_BOARD
},
5465 { .modelname
= "acer", .config
= ALC883_ACER
},
5466 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0/*0x0102*/,
5467 .config
= ALC883_ACER
},
5468 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0x0102,
5469 .config
= ALC883_ACER
},
5470 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0x009f,
5471 .config
= ALC883_ACER
},
5472 { .pci_subvendor
= 0x161f, .pci_subdevice
= 0x2054,
5473 .modelname
= "medion", .config
= ALC883_MEDION
},
5474 { .modelname
= "auto", .config
= ALC883_AUTO
},
5478 static struct alc_config_preset alc883_presets
[] = {
5479 [ALC883_3ST_2ch_DIG
] = {
5480 .mixers
= { alc883_3ST_2ch_mixer
},
5481 .init_verbs
= { alc883_init_verbs
},
5482 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5483 .dac_nids
= alc883_dac_nids
,
5484 .dig_out_nid
= ALC883_DIGOUT_NID
,
5485 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5486 .adc_nids
= alc883_adc_nids
,
5487 .dig_in_nid
= ALC883_DIGIN_NID
,
5488 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
5489 .channel_mode
= alc883_3ST_2ch_modes
,
5490 .input_mux
= &alc883_capture_source
,
5492 [ALC883_3ST_6ch_DIG
] = {
5493 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
5494 .init_verbs
= { alc883_init_verbs
},
5495 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5496 .dac_nids
= alc883_dac_nids
,
5497 .dig_out_nid
= ALC883_DIGOUT_NID
,
5498 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5499 .adc_nids
= alc883_adc_nids
,
5500 .dig_in_nid
= ALC883_DIGIN_NID
,
5501 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
5502 .channel_mode
= alc883_3ST_6ch_modes
,
5504 .input_mux
= &alc883_capture_source
,
5506 [ALC883_3ST_6ch
] = {
5507 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
5508 .init_verbs
= { alc883_init_verbs
},
5509 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5510 .dac_nids
= alc883_dac_nids
,
5511 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5512 .adc_nids
= alc883_adc_nids
,
5513 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
5514 .channel_mode
= alc883_3ST_6ch_modes
,
5516 .input_mux
= &alc883_capture_source
,
5518 [ALC883_6ST_DIG
] = {
5519 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
5520 .init_verbs
= { alc883_init_verbs
},
5521 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5522 .dac_nids
= alc883_dac_nids
,
5523 .dig_out_nid
= ALC883_DIGOUT_NID
,
5524 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5525 .adc_nids
= alc883_adc_nids
,
5526 .dig_in_nid
= ALC883_DIGIN_NID
,
5527 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
5528 .channel_mode
= alc883_sixstack_modes
,
5529 .input_mux
= &alc883_capture_source
,
5531 [ALC883_TARGA_DIG
] = {
5532 .mixers
= { alc883_tagra_mixer
, alc883_chmode_mixer
},
5533 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
5534 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5535 .dac_nids
= alc883_dac_nids
,
5536 .dig_out_nid
= ALC883_DIGOUT_NID
,
5537 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5538 .adc_nids
= alc883_adc_nids
,
5539 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
5540 .channel_mode
= alc883_3ST_6ch_modes
,
5542 .input_mux
= &alc883_capture_source
,
5543 .unsol_event
= alc883_tagra_unsol_event
,
5544 .init_hook
= alc883_tagra_automute
,
5546 [ALC883_TARGA_2ch_DIG
] = {
5547 .mixers
= { alc883_tagra_2ch_mixer
},
5548 .init_verbs
= { alc883_init_verbs
, alc883_tagra_verbs
},
5549 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5550 .dac_nids
= alc883_dac_nids
,
5551 .dig_out_nid
= ALC883_DIGOUT_NID
,
5552 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5553 .adc_nids
= alc883_adc_nids
,
5554 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
5555 .channel_mode
= alc883_3ST_2ch_modes
,
5556 .input_mux
= &alc883_capture_source
,
5557 .unsol_event
= alc883_tagra_unsol_event
,
5558 .init_hook
= alc883_tagra_automute
,
5560 [ALC888_DEMO_BOARD
] = {
5561 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
5562 .init_verbs
= { alc883_init_verbs
},
5563 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5564 .dac_nids
= alc883_dac_nids
,
5565 .dig_out_nid
= ALC883_DIGOUT_NID
,
5566 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5567 .adc_nids
= alc883_adc_nids
,
5568 .dig_in_nid
= ALC883_DIGIN_NID
,
5569 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
5570 .channel_mode
= alc883_sixstack_modes
,
5571 .input_mux
= &alc883_capture_source
,
5574 .mixers
= { alc883_base_mixer
,
5575 alc883_chmode_mixer
},
5576 /* On TravelMate laptops, GPIO 0 enables the internal speaker
5577 * and the headphone jack. Turn this on and rely on the
5578 * standard mute methods whenever the user wants to turn
5579 * these outputs off.
5581 .init_verbs
= { alc883_init_verbs
, alc880_gpio1_init_verbs
},
5582 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5583 .dac_nids
= alc883_dac_nids
,
5584 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5585 .adc_nids
= alc883_adc_nids
,
5586 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
5587 .channel_mode
= alc883_3ST_2ch_modes
,
5588 .input_mux
= &alc883_capture_source
,
5591 .mixers
= { alc883_fivestack_mixer
,
5592 alc883_chmode_mixer
},
5593 .init_verbs
= { alc883_init_verbs
,
5594 alc882_eapd_verbs
},
5595 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5596 .dac_nids
= alc883_dac_nids
,
5597 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5598 .adc_nids
= alc883_adc_nids
,
5599 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
5600 .channel_mode
= alc883_sixstack_modes
,
5601 .input_mux
= &alc883_capture_source
,
5608 * BIOS auto configuration
5610 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
5611 hda_nid_t nid
, int pin_type
,
5615 struct alc_spec
*spec
= codec
->spec
;
5618 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
5621 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
5623 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5625 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
5627 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
5631 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
5633 struct alc_spec
*spec
= codec
->spec
;
5636 for (i
= 0; i
<= HDA_SIDE
; i
++) {
5637 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
5639 alc883_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, i
);
5643 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
5645 struct alc_spec
*spec
= codec
->spec
;
5648 pin
= spec
->autocfg
.hp_pins
[0];
5649 if (pin
) /* connect to front */
5651 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
5654 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
5655 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
5657 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
5659 struct alc_spec
*spec
= codec
->spec
;
5662 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5663 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5664 if (alc883_is_input_pin(nid
)) {
5665 snd_hda_codec_write(codec
, nid
, 0,
5666 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5667 (i
<= AUTO_PIN_FRONT_MIC
?
5668 PIN_VREF80
: PIN_IN
));
5669 if (nid
!= ALC883_PIN_CD_NID
)
5670 snd_hda_codec_write(codec
, nid
, 0,
5671 AC_VERB_SET_AMP_GAIN_MUTE
,
5677 /* almost identical with ALC880 parser... */
5678 static int alc883_parse_auto_config(struct hda_codec
*codec
)
5680 struct alc_spec
*spec
= codec
->spec
;
5681 int err
= alc880_parse_auto_config(codec
);
5686 /* hack - override the init verbs */
5687 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
5688 spec
->mixers
[spec
->num_mixers
] = alc883_capture_mixer
;
5693 /* additional initialization for auto-configuration model */
5694 static void alc883_auto_init(struct hda_codec
*codec
)
5696 alc883_auto_init_multi_out(codec
);
5697 alc883_auto_init_hp_out(codec
);
5698 alc883_auto_init_analog_input(codec
);
5701 static int patch_alc883(struct hda_codec
*codec
)
5703 struct alc_spec
*spec
;
5704 int err
, board_config
;
5706 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5712 board_config
= snd_hda_check_board_config(codec
, alc883_cfg_tbl
);
5713 if (board_config
< 0 || board_config
>= ALC883_MODEL_LAST
) {
5714 printk(KERN_INFO
"hda_codec: Unknown model for ALC883, "
5715 "trying auto-probe from BIOS...\n");
5716 board_config
= ALC883_AUTO
;
5719 if (board_config
== ALC883_AUTO
) {
5720 /* automatic parse from the BIOS config */
5721 err
= alc883_parse_auto_config(codec
);
5727 "hda_codec: Cannot set up configuration "
5728 "from BIOS. Using base mode...\n");
5729 board_config
= ALC883_3ST_2ch_DIG
;
5733 if (board_config
!= ALC883_AUTO
)
5734 setup_preset(spec
, &alc883_presets
[board_config
]);
5736 spec
->stream_name_analog
= "ALC883 Analog";
5737 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
5738 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
5740 spec
->stream_name_digital
= "ALC883 Digital";
5741 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
5742 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
5744 if (! spec
->adc_nids
&& spec
->input_mux
) {
5745 spec
->adc_nids
= alc883_adc_nids
;
5746 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
5749 codec
->patch_ops
= alc_patch_ops
;
5750 if (board_config
== ALC883_AUTO
)
5751 spec
->init_hook
= alc883_auto_init
;
5760 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
5761 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
5763 #define alc262_dac_nids alc260_dac_nids
5764 #define alc262_adc_nids alc882_adc_nids
5765 #define alc262_adc_nids_alt alc882_adc_nids_alt
5767 #define alc262_modes alc260_modes
5768 #define alc262_capture_source alc882_capture_source
5770 static struct snd_kcontrol_new alc262_base_mixer
[] = {
5771 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5772 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5773 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5774 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5775 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5776 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5778 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5779 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5780 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5781 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
5782 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
5783 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
5784 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5785 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5786 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
5790 static struct snd_kcontrol_new alc262_hippo1_mixer
[] = {
5791 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5792 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5793 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5794 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5795 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5796 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5799 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5800 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5801 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
5802 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
5803 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
5804 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5808 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
5809 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5810 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5811 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5812 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5813 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
5815 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5816 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5817 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5818 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5819 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5820 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5821 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5822 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5823 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5824 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5825 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
5826 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
5830 #define alc262_capture_mixer alc882_capture_mixer
5831 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
5834 * generic initialization of ADC, input mixers and output mixers
5836 static struct hda_verb alc262_init_verbs
[] = {
5838 * Unmute ADC0-2 and set the default input to mic-in
5840 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5841 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5842 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5843 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5844 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5845 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5847 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5849 * Note: PASD motherboards uses the Line In 2 as the input for front panel
5852 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5853 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5855 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5856 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
5857 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5860 * Set up output mixers (0x0c - 0x0e)
5862 /* set vol=0 to output mixers */
5863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5864 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5865 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5866 /* set up input amps for analog loopback */
5867 /* Amp Indices: DAC = 0, mixer = 1 */
5868 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5869 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5870 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5871 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5872 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5873 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5875 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5876 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
5877 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5878 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5879 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5880 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5882 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5883 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5884 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5885 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5886 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5888 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5889 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5891 /* FIXME: use matrix-type input source selection */
5892 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5893 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5894 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5895 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5896 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5897 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5899 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5900 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5901 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5902 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5904 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5905 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5907 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5912 static struct hda_verb alc262_hippo_unsol_verbs
[] = {
5913 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5914 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5918 static struct hda_verb alc262_hippo1_unsol_verbs
[] = {
5919 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
5920 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5921 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5923 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
5924 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5928 /* mute/unmute internal speaker according to the hp jack and mute state */
5929 static void alc262_hippo_automute(struct hda_codec
*codec
, int force
)
5931 struct alc_spec
*spec
= codec
->spec
;
5934 if (force
|| ! spec
->sense_updated
) {
5935 unsigned int present
;
5936 /* need to execute and sync at first */
5937 snd_hda_codec_read(codec
, 0x15, 0, AC_VERB_SET_PIN_SENSE
, 0);
5938 present
= snd_hda_codec_read(codec
, 0x15, 0,
5939 AC_VERB_GET_PIN_SENSE
, 0);
5940 spec
->jack_present
= (present
& 0x80000000) != 0;
5941 spec
->sense_updated
= 1;
5943 if (spec
->jack_present
) {
5944 /* mute internal speaker */
5945 snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
5947 snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
5950 /* unmute internal speaker if necessary */
5951 mute
= snd_hda_codec_amp_read(codec
, 0x15, 0, HDA_OUTPUT
, 0);
5952 snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
5954 mute
= snd_hda_codec_amp_read(codec
, 0x15, 1, HDA_OUTPUT
, 0);
5955 snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
5960 /* unsolicited event for HP jack sensing */
5961 static void alc262_hippo_unsol_event(struct hda_codec
*codec
,
5964 if ((res
>> 26) != ALC880_HP_EVENT
)
5966 alc262_hippo_automute(codec
, 1);
5969 static void alc262_hippo1_automute(struct hda_codec
*codec
, int force
)
5971 struct alc_spec
*spec
= codec
->spec
;
5974 if (force
|| ! spec
->sense_updated
) {
5975 unsigned int present
;
5976 /* need to execute and sync at first */
5977 snd_hda_codec_read(codec
, 0x1b, 0, AC_VERB_SET_PIN_SENSE
, 0);
5978 present
= snd_hda_codec_read(codec
, 0x1b, 0,
5979 AC_VERB_GET_PIN_SENSE
, 0);
5980 spec
->jack_present
= (present
& 0x80000000) != 0;
5981 spec
->sense_updated
= 1;
5983 if (spec
->jack_present
) {
5984 /* mute internal speaker */
5985 snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
5987 snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
5990 /* unmute internal speaker if necessary */
5991 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 0, HDA_OUTPUT
, 0);
5992 snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
5994 mute
= snd_hda_codec_amp_read(codec
, 0x1b, 1, HDA_OUTPUT
, 0);
5995 snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
6000 /* unsolicited event for HP jack sensing */
6001 static void alc262_hippo1_unsol_event(struct hda_codec
*codec
,
6004 if ((res
>> 26) != ALC880_HP_EVENT
)
6006 alc262_hippo1_automute(codec
, 1);
6011 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
6014 #define ALC_HP_EVENT 0x37
6016 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
6017 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
6018 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
6022 static struct hda_input_mux alc262_fujitsu_capture_source
= {
6030 static struct hda_input_mux alc262_HP_capture_source
= {
6034 { "Front Mic", 0x3 },
6041 /* mute/unmute internal speaker according to the hp jack and mute state */
6042 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
6044 struct alc_spec
*spec
= codec
->spec
;
6047 if (force
|| ! spec
->sense_updated
) {
6048 unsigned int present
;
6049 /* need to execute and sync at first */
6050 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
6051 present
= snd_hda_codec_read(codec
, 0x14, 0,
6052 AC_VERB_GET_PIN_SENSE
, 0);
6053 spec
->jack_present
= (present
& 0x80000000) != 0;
6054 spec
->sense_updated
= 1;
6056 if (spec
->jack_present
) {
6057 /* mute internal speaker */
6058 snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
6060 snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
6063 /* unmute internal speaker if necessary */
6064 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
6065 snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
6067 mute
= snd_hda_codec_amp_read(codec
, 0x14, 1, HDA_OUTPUT
, 0);
6068 snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
6073 /* unsolicited event for HP jack sensing */
6074 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
6077 if ((res
>> 26) != ALC_HP_EVENT
)
6079 alc262_fujitsu_automute(codec
, 1);
6082 /* bind volumes of both NID 0x0c and 0x0d */
6083 static int alc262_fujitsu_master_vol_put(struct snd_kcontrol
*kcontrol
,
6084 struct snd_ctl_elem_value
*ucontrol
)
6086 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6087 long *valp
= ucontrol
->value
.integer
.value
;
6090 change
= snd_hda_codec_amp_update(codec
, 0x0c, 0, HDA_OUTPUT
, 0,
6091 0x7f, valp
[0] & 0x7f);
6092 change
|= snd_hda_codec_amp_update(codec
, 0x0c, 1, HDA_OUTPUT
, 0,
6093 0x7f, valp
[1] & 0x7f);
6094 snd_hda_codec_amp_update(codec
, 0x0d, 0, HDA_OUTPUT
, 0,
6095 0x7f, valp
[0] & 0x7f);
6096 snd_hda_codec_amp_update(codec
, 0x0d, 1, HDA_OUTPUT
, 0,
6097 0x7f, valp
[1] & 0x7f);
6101 /* bind hp and internal speaker mute (with plug check) */
6102 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
6103 struct snd_ctl_elem_value
*ucontrol
)
6105 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
6106 long *valp
= ucontrol
->value
.integer
.value
;
6109 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
6110 0x80, valp
[0] ? 0 : 0x80);
6111 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
6112 0x80, valp
[1] ? 0 : 0x80);
6113 if (change
|| codec
->in_resume
)
6114 alc262_fujitsu_automute(codec
, codec
->in_resume
);
6118 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
6120 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6121 .name
= "Master Playback Volume",
6122 .info
= snd_hda_mixer_amp_volume_info
,
6123 .get
= snd_hda_mixer_amp_volume_get
,
6124 .put
= alc262_fujitsu_master_vol_put
,
6125 .tlv
= { .c
= snd_hda_mixer_amp_tlv
},
6126 .private_value
= HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
6129 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6130 .name
= "Master Playback Switch",
6131 .info
= snd_hda_mixer_amp_switch_info
,
6132 .get
= snd_hda_mixer_amp_switch_get
,
6133 .put
= alc262_fujitsu_master_sw_put
,
6134 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
6136 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
6137 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
6138 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
6139 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
6140 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
6144 /* additional init verbs for Benq laptops */
6145 static struct hda_verb alc262_EAPD_verbs
[] = {
6146 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
6147 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
6151 /* add playback controls from the parsed DAC table */
6152 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
, const struct auto_pin_cfg
*cfg
)
6157 spec
->multiout
.num_dacs
= 1; /* only use one dac */
6158 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
6159 spec
->multiout
.dac_nids
[0] = 2;
6161 nid
= cfg
->line_out_pins
[0];
6163 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "Front Playback Volume",
6164 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
))) < 0)
6166 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Front Playback Switch",
6167 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
6171 nid
= cfg
->speaker_pins
[0];
6174 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "Speaker Playback Volume",
6175 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT
))) < 0)
6177 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Speaker Playback Switch",
6178 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
))) < 0)
6181 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Speaker Playback Switch",
6182 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
6186 nid
= cfg
->hp_pins
[0];
6188 /* spec->multiout.hp_nid = 2; */
6190 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "Headphone Playback Volume",
6191 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT
))) < 0)
6193 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Headphone Playback Switch",
6194 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
))) < 0)
6197 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Headphone Playback Switch",
6198 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
6205 /* identical with ALC880 */
6206 #define alc262_auto_create_analog_input_ctls alc880_auto_create_analog_input_ctls
6209 * generic initialization of ADC, input mixers and output mixers
6211 static struct hda_verb alc262_volume_init_verbs
[] = {
6213 * Unmute ADC0-2 and set the default input to mic-in
6215 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6216 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6217 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6218 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6219 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6220 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6222 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6224 * Note: PASD motherboards uses the Line In 2 as the input for front panel
6227 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6228 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6229 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
6232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
6235 * Set up output mixers (0x0c - 0x0f)
6237 /* set vol=0 to output mixers */
6238 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6239 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6240 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6242 /* set up input amps for analog loopback */
6243 /* Amp Indices: DAC = 0, mixer = 1 */
6244 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6245 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6246 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6247 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6248 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6249 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6251 /* FIXME: use matrix-type input source selection */
6252 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6253 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6254 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6255 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6256 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6257 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6259 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6260 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6261 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6262 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6264 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6265 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
6266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
6267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
6272 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
6274 * Unmute ADC0-2 and set the default input to mic-in
6276 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
6277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6278 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6279 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6280 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
6281 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6283 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6285 * Note: PASD motherboards uses the Line In 2 as the input for front panel
6288 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6291 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6292 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
6293 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
6294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
6295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(6)},
6298 * Set up output mixers (0x0c - 0x0e)
6300 /* set vol=0 to output mixers */
6301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6302 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6303 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
6305 /* set up input amps for analog loopback */
6306 /* Amp Indices: DAC = 0, mixer = 1 */
6307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6309 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6314 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
6315 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6316 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
6318 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6319 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6321 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
6322 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
6324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6325 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6326 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
6327 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6328 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
6330 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
6331 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
6332 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
6333 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
6334 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
6335 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
6338 /* FIXME: use matrix-type input source selection */
6339 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6340 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6341 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6342 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
6343 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
6344 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
6346 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
6348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
6349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
6351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
6352 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
6353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
6354 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
6359 /* pcm configuration: identiacal with ALC880 */
6360 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
6361 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
6362 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
6363 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
6366 * BIOS auto configuration
6368 static int alc262_parse_auto_config(struct hda_codec
*codec
)
6370 struct alc_spec
*spec
= codec
->spec
;
6372 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
6374 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
6375 alc262_ignore
)) < 0)
6377 if (! spec
->autocfg
.line_outs
)
6378 return 0; /* can't find valid BIOS pin config */
6379 if ((err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0 ||
6380 (err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
)) < 0)
6383 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
6385 if (spec
->autocfg
.dig_out_pin
)
6386 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
6387 if (spec
->autocfg
.dig_in_pin
)
6388 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
6390 if (spec
->kctl_alloc
)
6391 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
6393 spec
->init_verbs
[spec
->num_init_verbs
++] = alc262_volume_init_verbs
;
6394 spec
->num_mux_defs
= 1;
6395 spec
->input_mux
= &spec
->private_imux
;
6400 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
6401 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
6402 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
6405 /* init callback for auto-configuration model -- overriding the default init */
6406 static void alc262_auto_init(struct hda_codec
*codec
)
6408 alc262_auto_init_multi_out(codec
);
6409 alc262_auto_init_hp_out(codec
);
6410 alc262_auto_init_analog_input(codec
);
6414 * configuration and preset
6416 static struct hda_board_config alc262_cfg_tbl
[] = {
6417 { .modelname
= "basic", .config
= ALC262_BASIC
},
6418 { .modelname
= "hippo",
6419 .pci_subvendor
=0x1002, .pci_subdevice
= 0x437b,
6420 .config
= ALC262_HIPPO
},
6421 { .modelname
= "hippo_1",
6422 .pci_subvendor
=0x17ff, .pci_subdevice
= 0x058f,
6423 .config
= ALC262_HIPPO_1
},
6424 { .modelname
= "fujitsu", .config
= ALC262_FUJITSU
},
6425 { .pci_subvendor
= 0x10cf, .pci_subdevice
= 0x1397,
6426 .config
= ALC262_FUJITSU
},
6427 { .modelname
= "hp-bpc", .config
= ALC262_HP_BPC
},
6428 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x280c,
6429 .config
= ALC262_HP_BPC
}, /* xw4400 */
6430 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x2801,
6431 .config
= ALC262_HP_BPC
}, /* q965 */
6432 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3014,
6433 .config
= ALC262_HP_BPC
}, /* xw6400 */
6434 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3015,
6435 .config
= ALC262_HP_BPC
}, /* xw8400 */
6436 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x12fe,
6437 .config
= ALC262_HP_BPC
}, /* xw9400 */
6438 { .modelname
= "benq", .config
= ALC262_BENQ_ED8
},
6439 { .pci_subvendor
= 0x17ff, .pci_subdevice
= 0x0560,
6440 .config
= ALC262_BENQ_ED8
},
6441 { .modelname
= "auto", .config
= ALC262_AUTO
},
6445 static struct alc_config_preset alc262_presets
[] = {
6447 .mixers
= { alc262_base_mixer
},
6448 .init_verbs
= { alc262_init_verbs
},
6449 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
6450 .dac_nids
= alc262_dac_nids
,
6452 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
6453 .channel_mode
= alc262_modes
,
6454 .input_mux
= &alc262_capture_source
,
6457 .mixers
= { alc262_base_mixer
},
6458 .init_verbs
= { alc262_init_verbs
, alc262_hippo_unsol_verbs
},
6459 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
6460 .dac_nids
= alc262_dac_nids
,
6462 .dig_out_nid
= ALC262_DIGOUT_NID
,
6463 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
6464 .channel_mode
= alc262_modes
,
6465 .input_mux
= &alc262_capture_source
,
6466 .unsol_event
= alc262_hippo_unsol_event
,
6468 [ALC262_HIPPO_1
] = {
6469 .mixers
= { alc262_hippo1_mixer
},
6470 .init_verbs
= { alc262_init_verbs
, alc262_hippo1_unsol_verbs
},
6471 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
6472 .dac_nids
= alc262_dac_nids
,
6474 .dig_out_nid
= ALC262_DIGOUT_NID
,
6475 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
6476 .channel_mode
= alc262_modes
,
6477 .input_mux
= &alc262_capture_source
,
6478 .unsol_event
= alc262_hippo1_unsol_event
,
6480 [ALC262_FUJITSU
] = {
6481 .mixers
= { alc262_fujitsu_mixer
},
6482 .init_verbs
= { alc262_init_verbs
, alc262_fujitsu_unsol_verbs
},
6483 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
6484 .dac_nids
= alc262_dac_nids
,
6486 .dig_out_nid
= ALC262_DIGOUT_NID
,
6487 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
6488 .channel_mode
= alc262_modes
,
6489 .input_mux
= &alc262_fujitsu_capture_source
,
6490 .unsol_event
= alc262_fujitsu_unsol_event
,
6493 .mixers
= { alc262_HP_BPC_mixer
},
6494 .init_verbs
= { alc262_HP_BPC_init_verbs
},
6495 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
6496 .dac_nids
= alc262_dac_nids
,
6498 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
6499 .channel_mode
= alc262_modes
,
6500 .input_mux
= &alc262_HP_capture_source
,
6502 [ALC262_BENQ_ED8
] = {
6503 .mixers
= { alc262_base_mixer
},
6504 .init_verbs
= { alc262_init_verbs
, alc262_EAPD_verbs
},
6505 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
6506 .dac_nids
= alc262_dac_nids
,
6508 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
6509 .channel_mode
= alc262_modes
,
6510 .input_mux
= &alc262_capture_source
,
6514 static int patch_alc262(struct hda_codec
*codec
)
6516 struct alc_spec
*spec
;
6520 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
6526 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is under-run */
6529 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
6530 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
6531 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
6532 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
6536 board_config
= snd_hda_check_board_config(codec
, alc262_cfg_tbl
);
6538 if (board_config
< 0 || board_config
>= ALC262_MODEL_LAST
) {
6539 printk(KERN_INFO
"hda_codec: Unknown model for ALC262, "
6540 "trying auto-probe from BIOS...\n");
6541 board_config
= ALC262_AUTO
;
6544 if (board_config
== ALC262_AUTO
) {
6545 /* automatic parse from the BIOS config */
6546 err
= alc262_parse_auto_config(codec
);
6552 "hda_codec: Cannot set up configuration "
6553 "from BIOS. Using base mode...\n");
6554 board_config
= ALC262_BASIC
;
6558 if (board_config
!= ALC262_AUTO
)
6559 setup_preset(spec
, &alc262_presets
[board_config
]);
6561 spec
->stream_name_analog
= "ALC262 Analog";
6562 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
6563 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
6565 spec
->stream_name_digital
= "ALC262 Digital";
6566 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
6567 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
6569 if (! spec
->adc_nids
&& spec
->input_mux
) {
6570 /* check whether NID 0x07 is valid */
6571 unsigned int wcap
= get_wcaps(codec
, 0x07);
6573 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
6574 if (wcap
!= AC_WID_AUD_IN
) {
6575 spec
->adc_nids
= alc262_adc_nids_alt
;
6576 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids_alt
);
6577 spec
->mixers
[spec
->num_mixers
] = alc262_capture_alt_mixer
;
6580 spec
->adc_nids
= alc262_adc_nids
;
6581 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids
);
6582 spec
->mixers
[spec
->num_mixers
] = alc262_capture_mixer
;
6587 codec
->patch_ops
= alc_patch_ops
;
6588 if (board_config
== ALC262_AUTO
)
6589 spec
->init_hook
= alc262_auto_init
;
6595 * ALC861 channel source setting (2/6 channel selection for 3-stack)
6599 * set the path ways for 2 channel output
6600 * need to set the codec line out and mic 1 pin widgets to inputs
6602 static struct hda_verb alc861_threestack_ch2_init
[] = {
6603 /* set pin widget 1Ah (line in) for input */
6604 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6605 /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */
6606 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6608 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
6610 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
6611 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
6617 * need to set the codec line out and mic 1 pin widgets to outputs
6619 static struct hda_verb alc861_threestack_ch6_init
[] = {
6620 /* set pin widget 1Ah (line in) for output (Back Surround)*/
6621 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6622 /* set pin widget 18h (mic1) for output (CLFE)*/
6623 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6625 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6626 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6628 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
6630 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
6631 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
6636 static struct hda_channel_mode alc861_threestack_modes
[2] = {
6637 { 2, alc861_threestack_ch2_init
},
6638 { 6, alc861_threestack_ch6_init
},
6640 /* Set mic1 as input and unmute the mixer */
6641 static struct hda_verb alc861_uniwill_m31_ch2_init
[] = {
6642 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6643 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
6646 /* Set mic1 as output and mute mixer */
6647 static struct hda_verb alc861_uniwill_m31_ch4_init
[] = {
6648 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6649 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
6653 static struct hda_channel_mode alc861_uniwill_m31_modes
[2] = {
6654 { 2, alc861_uniwill_m31_ch2_init
},
6655 { 4, alc861_uniwill_m31_ch4_init
},
6658 /* Set mic1 and line-in as input and unmute the mixer */
6659 static struct hda_verb alc861_asus_ch2_init
[] = {
6660 /* set pin widget 1Ah (line in) for input */
6661 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6662 /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */
6663 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6665 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
6667 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
6668 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
6672 /* Set mic1 nad line-in as output and mute mixer */
6673 static struct hda_verb alc861_asus_ch6_init
[] = {
6674 /* set pin widget 1Ah (line in) for output (Back Surround)*/
6675 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6676 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
6677 /* set pin widget 18h (mic1) for output (CLFE)*/
6678 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6679 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
6680 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6681 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6683 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
6685 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
6686 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
6691 static struct hda_channel_mode alc861_asus_modes
[2] = {
6692 { 2, alc861_asus_ch2_init
},
6693 { 6, alc861_asus_ch6_init
},
6698 static struct snd_kcontrol_new alc861_base_mixer
[] = {
6699 /* output mixer control */
6700 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
6701 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
6702 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
6703 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
6704 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
6706 /*Input mixer control */
6707 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
6708 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
6709 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
6710 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
6711 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
6712 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
6713 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
6714 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
6715 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
6716 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
6718 /* Capture mixer control */
6719 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6720 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6722 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6723 .name
= "Capture Source",
6725 .info
= alc_mux_enum_info
,
6726 .get
= alc_mux_enum_get
,
6727 .put
= alc_mux_enum_put
,
6732 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
6733 /* output mixer control */
6734 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
6735 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
6736 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
6737 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
6738 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
6740 /* Input mixer control */
6741 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
6742 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
6743 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
6744 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
6745 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
6746 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
6747 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
6748 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
6749 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
6750 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
6752 /* Capture mixer control */
6753 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6754 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6756 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6757 .name
= "Capture Source",
6759 .info
= alc_mux_enum_info
,
6760 .get
= alc_mux_enum_get
,
6761 .put
= alc_mux_enum_put
,
6764 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6765 .name
= "Channel Mode",
6766 .info
= alc_ch_mode_info
,
6767 .get
= alc_ch_mode_get
,
6768 .put
= alc_ch_mode_put
,
6769 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
6774 static snd_kcontrol_new_t alc861_toshiba_mixer
[] = {
6775 /* output mixer control */
6776 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
6777 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
6778 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
6780 /*Capture mixer control */
6781 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6782 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6784 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6785 .name
= "Capture Source",
6787 .info
= alc_mux_enum_info
,
6788 .get
= alc_mux_enum_get
,
6789 .put
= alc_mux_enum_put
,
6795 static struct snd_kcontrol_new alc861_uniwill_m31_mixer
[] = {
6796 /* output mixer control */
6797 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
6798 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
6799 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
6800 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
6801 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
6803 /* Input mixer control */
6804 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
6805 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
6806 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
6807 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
6808 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
6809 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
6810 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
6811 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
6812 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
6813 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
6815 /* Capture mixer control */
6816 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6817 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6819 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6820 .name
= "Capture Source",
6822 .info
= alc_mux_enum_info
,
6823 .get
= alc_mux_enum_get
,
6824 .put
= alc_mux_enum_put
,
6827 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6828 .name
= "Channel Mode",
6829 .info
= alc_ch_mode_info
,
6830 .get
= alc_ch_mode_get
,
6831 .put
= alc_ch_mode_put
,
6832 .private_value
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
6837 static struct snd_kcontrol_new alc861_asus_mixer
[] = {
6838 /* output mixer control */
6839 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
6840 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
6841 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
6842 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
6843 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
6845 /* Input mixer control */
6846 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT
),
6847 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
6848 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
6849 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
6850 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
6851 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
6852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
6853 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
6854 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
6855 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT
), /* was HDA_INPUT (why?) */
6857 /* Capture mixer control */
6858 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6859 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6861 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6862 .name
= "Capture Source",
6864 .info
= alc_mux_enum_info
,
6865 .get
= alc_mux_enum_get
,
6866 .put
= alc_mux_enum_put
,
6869 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6870 .name
= "Channel Mode",
6871 .info
= alc_ch_mode_info
,
6872 .get
= alc_ch_mode_get
,
6873 .put
= alc_ch_mode_put
,
6874 .private_value
= ARRAY_SIZE(alc861_asus_modes
),
6881 * generic initialization of ADC, input mixers and output mixers
6883 static struct hda_verb alc861_base_init_verbs
[] = {
6885 * Unmute ADC0 and set the default input to mic-in
6887 /* port-A for surround (rear panel) */
6888 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6889 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6890 /* port-B for mic-in (rear panel) with vref */
6891 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6892 /* port-C for line-in (rear panel) */
6893 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6894 /* port-D for Front */
6895 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6896 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6897 /* port-E for HP out (front panel) */
6898 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
6899 /* route front PCM to HP */
6900 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6901 /* port-F for mic-in (front panel) with vref */
6902 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6903 /* port-G for CLFE (rear panel) */
6904 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6905 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6906 /* port-H for side (rear panel) */
6907 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6908 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6910 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6911 /* route front mic to ADC1*/
6912 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6913 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6915 /* Unmute DAC0~3 & spdif out*/
6916 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6917 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6918 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6919 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6922 /* Unmute Mixer 14 (mic) 1c (Line in)*/
6923 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6924 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6925 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6926 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6928 /* Unmute Stereo Mixer 15 */
6929 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6931 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6932 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c }, //Output 0~12 step
6934 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6935 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6936 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6937 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6938 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6939 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6940 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6941 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6942 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front)
6943 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6948 static struct hda_verb alc861_threestack_init_verbs
[] = {
6950 * Unmute ADC0 and set the default input to mic-in
6952 /* port-A for surround (rear panel) */
6953 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6954 /* port-B for mic-in (rear panel) with vref */
6955 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6956 /* port-C for line-in (rear panel) */
6957 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6958 /* port-D for Front */
6959 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6960 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6961 /* port-E for HP out (front panel) */
6962 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
6963 /* route front PCM to HP */
6964 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6965 /* port-F for mic-in (front panel) with vref */
6966 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6967 /* port-G for CLFE (rear panel) */
6968 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6969 /* port-H for side (rear panel) */
6970 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6972 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6973 /* route front mic to ADC1*/
6974 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6975 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6976 /* Unmute DAC0~3 & spdif out*/
6977 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6978 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6979 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6980 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6981 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6983 /* Unmute Mixer 14 (mic) 1c (Line in)*/
6984 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6985 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6986 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6987 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6989 /* Unmute Stereo Mixer 15 */
6990 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6991 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6992 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6993 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c }, //Output 0~12 step
6995 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6996 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6997 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6998 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6999 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7000 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7001 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7002 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7003 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front)
7004 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7008 static struct hda_verb alc861_uniwill_m31_init_verbs
[] = {
7010 * Unmute ADC0 and set the default input to mic-in
7012 /* port-A for surround (rear panel) */
7013 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7014 /* port-B for mic-in (rear panel) with vref */
7015 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
7016 /* port-C for line-in (rear panel) */
7017 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
7018 /* port-D for Front */
7019 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
7020 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7021 /* port-E for HP out (front panel) */
7022 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 }, // this has to be set to VREF80
7023 /* route front PCM to HP */
7024 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7025 /* port-F for mic-in (front panel) with vref */
7026 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
7027 /* port-G for CLFE (rear panel) */
7028 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7029 /* port-H for side (rear panel) */
7030 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
7032 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
7033 /* route front mic to ADC1*/
7034 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7035 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7036 /* Unmute DAC0~3 & spdif out*/
7037 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7038 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7039 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7040 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7041 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7043 /* Unmute Mixer 14 (mic) 1c (Line in)*/
7044 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7045 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7046 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7047 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7049 /* Unmute Stereo Mixer 15 */
7050 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7051 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7052 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7053 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c }, //Output 0~12 step
7055 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7056 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7057 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7058 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7059 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7060 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7061 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7062 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7063 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front)
7064 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7068 static struct hda_verb alc861_asus_init_verbs
[] = {
7070 * Unmute ADC0 and set the default input to mic-in
7072 /* port-A for surround (rear panel) | according to codec#0 this is the HP jack*/
7073 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 }, /* was 0x00 */
7074 /* route front PCM to HP */
7075 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7076 /* port-B for mic-in (rear panel) with vref */
7077 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
7078 /* port-C for line-in (rear panel) */
7079 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
7080 /* port-D for Front */
7081 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
7082 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
7083 /* port-E for HP out (front panel) */
7084 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 }, /* this has to be set to VREF80 */
7085 /* route front PCM to HP */
7086 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x01 },
7087 /* port-F for mic-in (front panel) with vref */
7088 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
7089 /* port-G for CLFE (rear panel) */
7090 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
7091 /* port-H for side (rear panel) */
7092 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
7094 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
7095 /* route front mic to ADC1*/
7096 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
7097 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7098 /* Unmute DAC0~3 & spdif out*/
7099 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7100 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7101 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7102 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7103 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7104 /* Unmute Mixer 14 (mic) 1c (Line in)*/
7105 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7106 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7107 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7108 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7110 /* Unmute Stereo Mixer 15 */
7111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7112 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7113 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7114 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c }, /* Output 0~12 step */
7116 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7117 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7118 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7119 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7120 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7121 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7122 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7123 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7124 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)}, /* hp used DAC 3 (Front) */
7125 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7131 * generic initialization of ADC, input mixers and output mixers
7133 static struct hda_verb alc861_auto_init_verbs
[] = {
7135 * Unmute ADC0 and set the default input to mic-in
7137 // {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7138 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7140 /* Unmute DAC0~3 & spdif out*/
7141 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7142 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7143 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7144 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
7145 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
7147 /* Unmute Mixer 14 (mic) 1c (Line in)*/
7148 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7149 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7150 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7151 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7153 /* Unmute Stereo Mixer 15 */
7154 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7155 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7156 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7157 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
7159 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7160 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7161 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7162 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7163 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7164 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7165 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
7166 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
7168 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7169 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7170 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7171 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
7172 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
7173 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
7174 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
7175 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
7177 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, // set Mic 1
7182 static struct hda_verb alc861_toshiba_init_verbs
[] = {
7183 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC880_HP_EVENT
},
7188 /* toggle speaker-output according to the hp-jack state */
7189 static void alc861_toshiba_automute(struct hda_codec
*codec
)
7191 unsigned int present
;
7193 present
= snd_hda_codec_read(codec
, 0x0f, 0,
7194 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
7195 snd_hda_codec_amp_update(codec
, 0x16, 0, HDA_INPUT
, 0,
7196 0x80, present
? 0x80 : 0);
7197 snd_hda_codec_amp_update(codec
, 0x16, 1, HDA_INPUT
, 0,
7198 0x80, present
? 0x80 : 0);
7199 snd_hda_codec_amp_update(codec
, 0x1a, 0, HDA_INPUT
, 3,
7200 0x80, present
? 0 : 0x80);
7201 snd_hda_codec_amp_update(codec
, 0x1a, 1, HDA_INPUT
, 3,
7202 0x80, present
? 0 : 0x80);
7205 static void alc861_toshiba_unsol_event(struct hda_codec
*codec
,
7208 /* Looks like the unsol event is incompatible with the standard
7209 * definition. 6bit tag is placed at 26 bit!
7211 if ((res
>> 26) == ALC880_HP_EVENT
)
7212 alc861_toshiba_automute(codec
);
7215 /* pcm configuration: identiacal with ALC880 */
7216 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
7217 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
7218 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
7219 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
7222 #define ALC861_DIGOUT_NID 0x07
7224 static struct hda_channel_mode alc861_8ch_modes
[1] = {
7228 static hda_nid_t alc861_dac_nids
[4] = {
7229 /* front, surround, clfe, side */
7230 0x03, 0x06, 0x05, 0x04
7233 static hda_nid_t alc660_dac_nids
[3] = {
7234 /* front, clfe, surround */
7238 static hda_nid_t alc861_adc_nids
[1] = {
7243 static struct hda_input_mux alc861_capture_source
= {
7247 { "Front Mic", 0x3 },
7254 /* fill in the dac_nids table from the parsed pin configuration */
7255 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
, const struct auto_pin_cfg
*cfg
)
7260 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
7261 for (i
= 0; i
< cfg
->line_outs
; i
++) {
7262 nid
= cfg
->line_out_pins
[i
];
7264 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
7266 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
7269 spec
->multiout
.num_dacs
= cfg
->line_outs
;
7273 /* add playback controls from the parsed DAC table */
7274 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
7275 const struct auto_pin_cfg
*cfg
)
7278 static const char *chname
[4] = { "Front", "Surround", NULL
/*CLFE*/, "Side" };
7282 for (i
= 0; i
< cfg
->line_outs
; i
++) {
7283 nid
= spec
->multiout
.dac_nids
[i
];
7288 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, "Center Playback Switch",
7289 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
))) < 0)
7291 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, "LFE Playback Switch",
7292 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
))) < 0)
7295 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1; idx
++)
7296 if (nid
== alc861_dac_nids
[idx
])
7298 sprintf(name
, "%s Playback Switch", chname
[idx
]);
7299 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
7300 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
7307 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
7315 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
7317 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Headphone Playback Switch",
7318 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
7320 spec
->multiout
.hp_nid
= nid
;
7325 /* create playback/capture controls for input pins */
7326 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
, const struct auto_pin_cfg
*cfg
)
7328 struct hda_input_mux
*imux
= &spec
->private_imux
;
7329 int i
, err
, idx
, idx1
;
7331 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
7332 switch(cfg
->input_pins
[i
]) {
7357 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
7358 auto_pin_cfg_labels
[i
], idx
, 0x15);
7362 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
7363 imux
->items
[imux
->num_items
].index
= idx1
;
7369 static struct snd_kcontrol_new alc861_capture_mixer
[] = {
7370 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
7371 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
7374 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
7375 /* The multiple "Capture Source" controls confuse alsamixer
7376 * So call somewhat different..
7377 *FIXME: the controls appear in the "playback" view!
7379 /* .name = "Capture Source", */
7380 .name
= "Input Source",
7382 .info
= alc_mux_enum_info
,
7383 .get
= alc_mux_enum_get
,
7384 .put
= alc_mux_enum_put
,
7389 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
, hda_nid_t nid
,
7390 int pin_type
, int dac_idx
)
7394 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
7395 snd_hda_codec_write(codec
, dac_idx
, 0, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
7399 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
7401 struct alc_spec
*spec
= codec
->spec
;
7404 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
7405 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
7407 alc861_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, spec
->multiout
.dac_nids
[i
]);
7411 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
7413 struct alc_spec
*spec
= codec
->spec
;
7416 pin
= spec
->autocfg
.hp_pins
[0];
7417 if (pin
) /* connect to front */
7418 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, spec
->multiout
.dac_nids
[0]);
7421 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
7423 struct alc_spec
*spec
= codec
->spec
;
7426 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
7427 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
7428 if ((nid
>=0x0c) && (nid
<=0x11)) {
7429 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
7430 i
<= AUTO_PIN_FRONT_MIC
? PIN_VREF80
: PIN_IN
);
7435 /* parse the BIOS configuration and set up the alc_spec */
7436 /* return 1 if successful, 0 if the proper config is not found, or a negative error code */
7437 static int alc861_parse_auto_config(struct hda_codec
*codec
)
7439 struct alc_spec
*spec
= codec
->spec
;
7441 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
7443 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
7444 alc861_ignore
)) < 0)
7446 if (! spec
->autocfg
.line_outs
)
7447 return 0; /* can't find valid BIOS pin config */
7449 if ((err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
)) < 0 ||
7450 (err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0 ||
7451 (err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pins
[0])) < 0 ||
7452 (err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
)) < 0)
7455 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
7457 if (spec
->autocfg
.dig_out_pin
)
7458 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
7460 if (spec
->kctl_alloc
)
7461 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
7463 spec
->init_verbs
[spec
->num_init_verbs
++] = alc861_auto_init_verbs
;
7465 spec
->num_mux_defs
= 1;
7466 spec
->input_mux
= &spec
->private_imux
;
7468 spec
->adc_nids
= alc861_adc_nids
;
7469 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
7470 spec
->mixers
[spec
->num_mixers
] = alc861_capture_mixer
;
7476 /* additional initialization for auto-configuration model */
7477 static void alc861_auto_init(struct hda_codec
*codec
)
7479 alc861_auto_init_multi_out(codec
);
7480 alc861_auto_init_hp_out(codec
);
7481 alc861_auto_init_analog_input(codec
);
7486 * configuration and preset
7488 static struct hda_board_config alc861_cfg_tbl
[] = {
7489 { .modelname
= "3stack", .config
= ALC861_3ST
},
7490 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xd600,
7491 .config
= ALC861_3ST
},
7492 { .modelname
= "3stack-660", .config
= ALC660_3ST
},
7493 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x81e7,
7494 .config
= ALC660_3ST
},
7495 { .modelname
= "3stack-dig", .config
= ALC861_3ST_DIG
},
7496 { .modelname
= "6stack-dig", .config
= ALC861_6ST_DIG
},
7497 { .modelname
= "uniwill-m31", .config
= ALC861_UNIWILL_M31
},
7498 { .pci_subvendor
= 0x1584, .pci_subdevice
= 0x9072,
7499 .config
= ALC861_UNIWILL_M31
},
7500 { .modelname
= "toshiba", .config
= ALC861_TOSHIBA
},
7501 { .pci_subvendor
= 0x1179, .pci_subdevice
= 0xff10,
7502 .config
= ALC861_TOSHIBA
},
7503 { .modelname
= "asus", .config
= ALC861_ASUS
},
7504 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1393,
7505 .config
= ALC861_ASUS
},
7506 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1338,
7507 .config
= ALC861_ASUS
},
7508 { .modelname
= "auto", .config
= ALC861_AUTO
},
7512 static struct alc_config_preset alc861_presets
[] = {
7514 .mixers
= { alc861_3ST_mixer
},
7515 .init_verbs
= { alc861_threestack_init_verbs
},
7516 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7517 .dac_nids
= alc861_dac_nids
,
7518 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
7519 .channel_mode
= alc861_threestack_modes
,
7521 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7522 .adc_nids
= alc861_adc_nids
,
7523 .input_mux
= &alc861_capture_source
,
7525 [ALC861_3ST_DIG
] = {
7526 .mixers
= { alc861_base_mixer
},
7527 .init_verbs
= { alc861_threestack_init_verbs
},
7528 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7529 .dac_nids
= alc861_dac_nids
,
7530 .dig_out_nid
= ALC861_DIGOUT_NID
,
7531 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
7532 .channel_mode
= alc861_threestack_modes
,
7534 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7535 .adc_nids
= alc861_adc_nids
,
7536 .input_mux
= &alc861_capture_source
,
7538 [ALC861_6ST_DIG
] = {
7539 .mixers
= { alc861_base_mixer
},
7540 .init_verbs
= { alc861_base_init_verbs
},
7541 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7542 .dac_nids
= alc861_dac_nids
,
7543 .dig_out_nid
= ALC861_DIGOUT_NID
,
7544 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
7545 .channel_mode
= alc861_8ch_modes
,
7546 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7547 .adc_nids
= alc861_adc_nids
,
7548 .input_mux
= &alc861_capture_source
,
7551 .mixers
= { alc861_3ST_mixer
},
7552 .init_verbs
= { alc861_threestack_init_verbs
},
7553 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
7554 .dac_nids
= alc660_dac_nids
,
7555 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
7556 .channel_mode
= alc861_threestack_modes
,
7558 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7559 .adc_nids
= alc861_adc_nids
,
7560 .input_mux
= &alc861_capture_source
,
7562 [ALC861_UNIWILL_M31
] = {
7563 .mixers
= { alc861_uniwill_m31_mixer
},
7564 .init_verbs
= { alc861_uniwill_m31_init_verbs
},
7565 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7566 .dac_nids
= alc861_dac_nids
,
7567 .dig_out_nid
= ALC861_DIGOUT_NID
,
7568 .num_channel_mode
= ARRAY_SIZE(alc861_uniwill_m31_modes
),
7569 .channel_mode
= alc861_uniwill_m31_modes
,
7571 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7572 .adc_nids
= alc861_adc_nids
,
7573 .input_mux
= &alc861_capture_source
,
7575 [ALC861_TOSHIBA
] = {
7576 .mixers
= { alc861_toshiba_mixer
},
7577 .init_verbs
= { alc861_base_init_verbs
, alc861_toshiba_init_verbs
},
7578 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7579 .dac_nids
= alc861_dac_nids
,
7580 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
7581 .channel_mode
= alc883_3ST_2ch_modes
,
7582 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7583 .adc_nids
= alc861_adc_nids
,
7584 .input_mux
= &alc861_capture_source
,
7585 .unsol_event
= alc861_toshiba_unsol_event
,
7586 .init_hook
= alc861_toshiba_automute
,
7589 .mixers
= { alc861_asus_mixer
},
7590 .init_verbs
= { alc861_asus_init_verbs
},
7591 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
7592 .dac_nids
= alc861_dac_nids
,
7593 .dig_out_nid
= ALC861_DIGOUT_NID
,
7594 .num_channel_mode
= ARRAY_SIZE(alc861_asus_modes
),
7595 .channel_mode
= alc861_asus_modes
,
7598 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
7599 .adc_nids
= alc861_adc_nids
,
7600 .input_mux
= &alc861_capture_source
,
7605 static int patch_alc861(struct hda_codec
*codec
)
7607 struct alc_spec
*spec
;
7611 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
7617 board_config
= snd_hda_check_board_config(codec
, alc861_cfg_tbl
);
7619 if (board_config
< 0 || board_config
>= ALC861_MODEL_LAST
) {
7620 printk(KERN_INFO
"hda_codec: Unknown model for ALC861, "
7621 "trying auto-probe from BIOS...\n");
7622 board_config
= ALC861_AUTO
;
7625 if (board_config
== ALC861_AUTO
) {
7626 /* automatic parse from the BIOS config */
7627 err
= alc861_parse_auto_config(codec
);
7633 "hda_codec: Cannot set up configuration "
7634 "from BIOS. Using base mode...\n");
7635 board_config
= ALC861_3ST_DIG
;
7639 if (board_config
!= ALC861_AUTO
)
7640 setup_preset(spec
, &alc861_presets
[board_config
]);
7642 spec
->stream_name_analog
= "ALC861 Analog";
7643 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
7644 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
7646 spec
->stream_name_digital
= "ALC861 Digital";
7647 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
7648 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
7650 codec
->patch_ops
= alc_patch_ops
;
7651 if (board_config
== ALC861_AUTO
)
7652 spec
->init_hook
= alc861_auto_init
;
7660 struct hda_codec_preset snd_hda_preset_realtek
[] = {
7661 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
7662 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
7663 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
7664 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
7665 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
7666 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
7667 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
7668 { .id
= 0x10ec0861, .rev
= 0x100300, .name
= "ALC861",
7669 .patch
= patch_alc861
},
7670 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
7671 .patch
= patch_alc861
},
7672 { .id
= 0x10ec0660, .name
= "ALC660", .patch
= patch_alc861
},