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"
36 /* ALC880 board config type */
56 #ifdef CONFIG_SND_DEBUG
60 ALC880_MODEL_LAST
/* last tag */
70 #ifdef CONFIG_SND_DEBUG
74 ALC260_MODEL_LAST
/* last tag */
83 ALC262_MODEL_LAST
/* last tag */
116 #define GPIO_MASK 0x03
119 /* codec parameterization */
120 struct snd_kcontrol_new
*mixers
[5]; /* mixer arrays */
121 unsigned int num_mixers
;
123 const struct hda_verb
*init_verbs
[5]; /* initialization verbs
127 unsigned int num_init_verbs
;
129 char *stream_name_analog
; /* analog PCM stream */
130 struct hda_pcm_stream
*stream_analog_playback
;
131 struct hda_pcm_stream
*stream_analog_capture
;
133 char *stream_name_digital
; /* digital PCM stream */
134 struct hda_pcm_stream
*stream_digital_playback
;
135 struct hda_pcm_stream
*stream_digital_capture
;
138 struct hda_multi_out multiout
; /* playback set-up
139 * max_channels, dacs must be set
140 * dig_out_nid and hp_nid are optional
144 unsigned int num_adc_nids
;
146 hda_nid_t dig_in_nid
; /* digital-in NID; optional */
149 unsigned int num_mux_defs
;
150 const struct hda_input_mux
*input_mux
;
151 unsigned int cur_mux
[3];
154 const struct hda_channel_mode
*channel_mode
;
155 int num_channel_mode
;
157 /* PCM information */
158 struct hda_pcm pcm_rec
[3]; /* used in alc_build_pcms() */
160 /* dynamic controls, init_verbs and input_mux */
161 struct auto_pin_cfg autocfg
;
162 unsigned int num_kctl_alloc
, num_kctl_used
;
163 struct snd_kcontrol_new
*kctl_alloc
;
164 struct hda_input_mux private_imux
;
165 hda_nid_t private_dac_nids
[5];
168 void (*init_hook
)(struct hda_codec
*codec
);
169 void (*unsol_event
)(struct hda_codec
*codec
, unsigned int res
);
171 /* for pin sensing */
172 unsigned int sense_updated
: 1;
173 unsigned int jack_present
: 1;
177 * configuration template - to be copied to the spec instance
179 struct alc_config_preset
{
180 struct snd_kcontrol_new
*mixers
[5]; /* should be identical size
183 const struct hda_verb
*init_verbs
[5];
184 unsigned int num_dacs
;
186 hda_nid_t dig_out_nid
; /* optional */
187 hda_nid_t hp_nid
; /* optional */
188 unsigned int num_adc_nids
;
190 hda_nid_t dig_in_nid
;
191 unsigned int num_channel_mode
;
192 const struct hda_channel_mode
*channel_mode
;
193 unsigned int num_mux_defs
;
194 const struct hda_input_mux
*input_mux
;
195 void (*unsol_event
)(struct hda_codec
*, unsigned int);
196 void (*init_hook
)(struct hda_codec
*);
203 static int alc_mux_enum_info(struct snd_kcontrol
*kcontrol
,
204 struct snd_ctl_elem_info
*uinfo
)
206 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
207 struct alc_spec
*spec
= codec
->spec
;
208 unsigned int mux_idx
= snd_ctl_get_ioffidx(kcontrol
, &uinfo
->id
);
209 if (mux_idx
>= spec
->num_mux_defs
)
211 return snd_hda_input_mux_info(&spec
->input_mux
[mux_idx
], uinfo
);
214 static int alc_mux_enum_get(struct snd_kcontrol
*kcontrol
,
215 struct snd_ctl_elem_value
*ucontrol
)
217 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
218 struct alc_spec
*spec
= codec
->spec
;
219 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
221 ucontrol
->value
.enumerated
.item
[0] = spec
->cur_mux
[adc_idx
];
225 static int alc_mux_enum_put(struct snd_kcontrol
*kcontrol
,
226 struct snd_ctl_elem_value
*ucontrol
)
228 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
229 struct alc_spec
*spec
= codec
->spec
;
230 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
231 unsigned int mux_idx
= adc_idx
>= spec
->num_mux_defs
? 0 : adc_idx
;
232 return snd_hda_input_mux_put(codec
, &spec
->input_mux
[mux_idx
], ucontrol
,
233 spec
->adc_nids
[adc_idx
],
234 &spec
->cur_mux
[adc_idx
]);
239 * channel mode setting
241 static int alc_ch_mode_info(struct snd_kcontrol
*kcontrol
,
242 struct snd_ctl_elem_info
*uinfo
)
244 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
245 struct alc_spec
*spec
= codec
->spec
;
246 return snd_hda_ch_mode_info(codec
, uinfo
, spec
->channel_mode
,
247 spec
->num_channel_mode
);
250 static int alc_ch_mode_get(struct snd_kcontrol
*kcontrol
,
251 struct snd_ctl_elem_value
*ucontrol
)
253 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
254 struct alc_spec
*spec
= codec
->spec
;
255 return snd_hda_ch_mode_get(codec
, ucontrol
, spec
->channel_mode
,
256 spec
->num_channel_mode
,
257 spec
->multiout
.max_channels
);
260 static int alc_ch_mode_put(struct snd_kcontrol
*kcontrol
,
261 struct snd_ctl_elem_value
*ucontrol
)
263 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
264 struct alc_spec
*spec
= codec
->spec
;
265 return snd_hda_ch_mode_put(codec
, ucontrol
, spec
->channel_mode
,
266 spec
->num_channel_mode
,
267 &spec
->multiout
.max_channels
);
271 * Control the mode of pin widget settings via the mixer. "pc" is used
272 * instead of "%" to avoid consequences of accidently treating the % as
273 * being part of a format specifier. Maximum allowed length of a value is
274 * 63 characters plus NULL terminator.
276 * Note: some retasking pin complexes seem to ignore requests for input
277 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
278 * are requested. Therefore order this list so that this behaviour will not
279 * cause problems when mixer clients move through the enum sequentially.
280 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
283 static char *alc_pin_mode_names
[] = {
284 "Mic 50pc bias", "Mic 80pc bias",
285 "Line in", "Line out", "Headphone out",
287 static unsigned char alc_pin_mode_values
[] = {
288 PIN_VREF50
, PIN_VREF80
, PIN_IN
, PIN_OUT
, PIN_HP
,
290 /* The control can present all 5 options, or it can limit the options based
291 * in the pin being assumed to be exclusively an input or an output pin. In
292 * addition, "input" pins may or may not process the mic bias option
293 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
294 * accept requests for bias as of chip versions up to March 2006) and/or
295 * wiring in the computer.
297 #define ALC_PIN_DIR_IN 0x00
298 #define ALC_PIN_DIR_OUT 0x01
299 #define ALC_PIN_DIR_INOUT 0x02
300 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
301 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
303 /* Info about the pin modes supported by the different pin direction modes.
304 * For each direction the minimum and maximum values are given.
306 static signed char alc_pin_mode_dir_info
[5][2] = {
307 { 0, 2 }, /* ALC_PIN_DIR_IN */
308 { 3, 4 }, /* ALC_PIN_DIR_OUT */
309 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
310 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
311 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
313 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
314 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
315 #define alc_pin_mode_n_items(_dir) \
316 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
318 static int alc_pin_mode_info(struct snd_kcontrol
*kcontrol
,
319 struct snd_ctl_elem_info
*uinfo
)
321 unsigned int item_num
= uinfo
->value
.enumerated
.item
;
322 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
324 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
326 uinfo
->value
.enumerated
.items
= alc_pin_mode_n_items(dir
);
328 if (item_num
<alc_pin_mode_min(dir
) || item_num
>alc_pin_mode_max(dir
))
329 item_num
= alc_pin_mode_min(dir
);
330 strcpy(uinfo
->value
.enumerated
.name
, alc_pin_mode_names
[item_num
]);
334 static int alc_pin_mode_get(struct snd_kcontrol
*kcontrol
,
335 struct snd_ctl_elem_value
*ucontrol
)
338 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
339 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
340 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
341 long *valp
= ucontrol
->value
.integer
.value
;
342 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
343 AC_VERB_GET_PIN_WIDGET_CONTROL
,
346 /* Find enumerated value for current pinctl setting */
347 i
= alc_pin_mode_min(dir
);
348 while (alc_pin_mode_values
[i
] != pinctl
&& i
<= alc_pin_mode_max(dir
))
350 *valp
= i
<= alc_pin_mode_max(dir
) ? i
: alc_pin_mode_min(dir
);
354 static int alc_pin_mode_put(struct snd_kcontrol
*kcontrol
,
355 struct snd_ctl_elem_value
*ucontrol
)
358 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
359 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
360 unsigned char dir
= (kcontrol
->private_value
>> 16) & 0xff;
361 long val
= *ucontrol
->value
.integer
.value
;
362 unsigned int pinctl
= snd_hda_codec_read(codec
, nid
, 0,
363 AC_VERB_GET_PIN_WIDGET_CONTROL
,
366 if (val
< alc_pin_mode_min(dir
) || val
> alc_pin_mode_max(dir
))
367 val
= alc_pin_mode_min(dir
);
369 change
= pinctl
!= alc_pin_mode_values
[val
];
371 /* Set pin mode to that requested */
372 snd_hda_codec_write(codec
,nid
,0,AC_VERB_SET_PIN_WIDGET_CONTROL
,
373 alc_pin_mode_values
[val
]);
375 /* Also enable the retasking pin's input/output as required
376 * for the requested pin mode. Enum values of 2 or less are
379 * Dynamically switching the input/output buffers probably
380 * reduces noise slightly (particularly on input) so we'll
381 * do it. However, having both input and output buffers
382 * enabled simultaneously doesn't seem to be problematic if
383 * this turns out to be necessary in the future.
386 snd_hda_codec_write(codec
, nid
, 0,
387 AC_VERB_SET_AMP_GAIN_MUTE
,
389 snd_hda_codec_write(codec
, nid
, 0,
390 AC_VERB_SET_AMP_GAIN_MUTE
,
393 snd_hda_codec_write(codec
, nid
, 0,
394 AC_VERB_SET_AMP_GAIN_MUTE
,
396 snd_hda_codec_write(codec
, nid
, 0,
397 AC_VERB_SET_AMP_GAIN_MUTE
,
404 #define ALC_PIN_MODE(xname, nid, dir) \
405 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
406 .info = alc_pin_mode_info, \
407 .get = alc_pin_mode_get, \
408 .put = alc_pin_mode_put, \
409 .private_value = nid | (dir<<16) }
411 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
412 * together using a mask with more than one bit set. This control is
413 * currently used only by the ALC260 test model. At this stage they are not
414 * needed for any "production" models.
416 #ifdef CONFIG_SND_DEBUG
417 static int alc_gpio_data_info(struct snd_kcontrol
*kcontrol
,
418 struct snd_ctl_elem_info
*uinfo
)
420 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_BOOLEAN
;
422 uinfo
->value
.integer
.min
= 0;
423 uinfo
->value
.integer
.max
= 1;
426 static int alc_gpio_data_get(struct snd_kcontrol
*kcontrol
,
427 struct snd_ctl_elem_value
*ucontrol
)
429 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
430 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
431 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
432 long *valp
= ucontrol
->value
.integer
.value
;
433 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
434 AC_VERB_GET_GPIO_DATA
, 0x00);
436 *valp
= (val
& mask
) != 0;
439 static int alc_gpio_data_put(struct snd_kcontrol
*kcontrol
,
440 struct snd_ctl_elem_value
*ucontrol
)
443 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
444 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
445 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
446 long val
= *ucontrol
->value
.integer
.value
;
447 unsigned int gpio_data
= snd_hda_codec_read(codec
, nid
, 0,
448 AC_VERB_GET_GPIO_DATA
,
451 /* Set/unset the masked GPIO bit(s) as needed */
452 change
= (val
== 0 ? 0 : mask
) != (gpio_data
& mask
);
457 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_GPIO_DATA
, gpio_data
);
461 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
462 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
463 .info = alc_gpio_data_info, \
464 .get = alc_gpio_data_get, \
465 .put = alc_gpio_data_put, \
466 .private_value = nid | (mask<<16) }
467 #endif /* CONFIG_SND_DEBUG */
469 /* A switch control to allow the enabling of the digital IO pins on the
470 * ALC260. This is incredibly simplistic; the intention of this control is
471 * to provide something in the test model allowing digital outputs to be
472 * identified if present. If models are found which can utilise these
473 * outputs a more complete mixer control can be devised for those models if
476 #ifdef CONFIG_SND_DEBUG
477 static int alc_spdif_ctrl_info(struct snd_kcontrol
*kcontrol
,
478 struct snd_ctl_elem_info
*uinfo
)
480 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_BOOLEAN
;
482 uinfo
->value
.integer
.min
= 0;
483 uinfo
->value
.integer
.max
= 1;
486 static int alc_spdif_ctrl_get(struct snd_kcontrol
*kcontrol
,
487 struct snd_ctl_elem_value
*ucontrol
)
489 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
490 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
491 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
492 long *valp
= ucontrol
->value
.integer
.value
;
493 unsigned int val
= snd_hda_codec_read(codec
, nid
, 0,
494 AC_VERB_GET_DIGI_CONVERT
, 0x00);
496 *valp
= (val
& mask
) != 0;
499 static int alc_spdif_ctrl_put(struct snd_kcontrol
*kcontrol
,
500 struct snd_ctl_elem_value
*ucontrol
)
503 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
504 hda_nid_t nid
= kcontrol
->private_value
& 0xffff;
505 unsigned char mask
= (kcontrol
->private_value
>> 16) & 0xff;
506 long val
= *ucontrol
->value
.integer
.value
;
507 unsigned int ctrl_data
= snd_hda_codec_read(codec
, nid
, 0,
508 AC_VERB_GET_DIGI_CONVERT
,
511 /* Set/unset the masked control bit(s) as needed */
512 change
= (val
== 0 ? 0 : mask
) != (ctrl_data
& mask
);
517 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_DIGI_CONVERT_1
,
522 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
523 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
524 .info = alc_spdif_ctrl_info, \
525 .get = alc_spdif_ctrl_get, \
526 .put = alc_spdif_ctrl_put, \
527 .private_value = nid | (mask<<16) }
528 #endif /* CONFIG_SND_DEBUG */
531 * set up from the preset table
533 static void setup_preset(struct alc_spec
*spec
,
534 const struct alc_config_preset
*preset
)
538 for (i
= 0; i
< ARRAY_SIZE(preset
->mixers
) && preset
->mixers
[i
]; i
++)
539 spec
->mixers
[spec
->num_mixers
++] = preset
->mixers
[i
];
540 for (i
= 0; i
< ARRAY_SIZE(preset
->init_verbs
) && preset
->init_verbs
[i
];
542 spec
->init_verbs
[spec
->num_init_verbs
++] =
543 preset
->init_verbs
[i
];
545 spec
->channel_mode
= preset
->channel_mode
;
546 spec
->num_channel_mode
= preset
->num_channel_mode
;
548 spec
->multiout
.max_channels
= spec
->channel_mode
[0].channels
;
550 spec
->multiout
.num_dacs
= preset
->num_dacs
;
551 spec
->multiout
.dac_nids
= preset
->dac_nids
;
552 spec
->multiout
.dig_out_nid
= preset
->dig_out_nid
;
553 spec
->multiout
.hp_nid
= preset
->hp_nid
;
555 spec
->num_mux_defs
= preset
->num_mux_defs
;
556 if (! spec
->num_mux_defs
)
557 spec
->num_mux_defs
= 1;
558 spec
->input_mux
= preset
->input_mux
;
560 spec
->num_adc_nids
= preset
->num_adc_nids
;
561 spec
->adc_nids
= preset
->adc_nids
;
562 spec
->dig_in_nid
= preset
->dig_in_nid
;
564 spec
->unsol_event
= preset
->unsol_event
;
565 spec
->init_hook
= preset
->init_hook
;
569 * ALC880 3-stack model
571 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
572 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
573 * F-Mic = 0x1b, HP = 0x19
576 static hda_nid_t alc880_dac_nids
[4] = {
577 /* front, rear, clfe, rear_surr */
578 0x02, 0x05, 0x04, 0x03
581 static hda_nid_t alc880_adc_nids
[3] = {
586 /* The datasheet says the node 0x07 is connected from inputs,
587 * but it shows zero connection in the real implementation on some devices.
588 * Note: this is a 915GAV bug, fixed on 915GLV
590 static hda_nid_t alc880_adc_nids_alt
[2] = {
595 #define ALC880_DIGOUT_NID 0x06
596 #define ALC880_DIGIN_NID 0x0a
598 static struct hda_input_mux alc880_capture_source
= {
602 { "Front Mic", 0x3 },
608 /* channel source setting (2/6 channel selection for 3-stack) */
610 static struct hda_verb alc880_threestack_ch2_init
[] = {
611 /* set line-in to input, mute it */
612 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
613 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
614 /* set mic-in to input vref 80%, mute it */
615 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
616 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
621 static struct hda_verb alc880_threestack_ch6_init
[] = {
622 /* set line-in to output, unmute it */
623 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
624 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
625 /* set mic-in to output, unmute it */
626 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
627 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
631 static struct hda_channel_mode alc880_threestack_modes
[2] = {
632 { 2, alc880_threestack_ch2_init
},
633 { 6, alc880_threestack_ch6_init
},
636 static struct snd_kcontrol_new alc880_three_stack_mixer
[] = {
637 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
638 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
639 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
640 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT
),
641 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
642 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
643 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
644 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
645 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
646 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
647 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
648 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
649 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
650 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
651 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT
),
652 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT
),
653 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
654 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
655 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT
),
657 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
658 .name
= "Channel Mode",
659 .info
= alc_ch_mode_info
,
660 .get
= alc_ch_mode_get
,
661 .put
= alc_ch_mode_put
,
666 /* capture mixer elements */
667 static struct snd_kcontrol_new alc880_capture_mixer
[] = {
668 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
669 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
670 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
671 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
672 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
673 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
675 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
676 /* The multiple "Capture Source" controls confuse alsamixer
677 * So call somewhat different..
678 * FIXME: the controls appear in the "playback" view!
680 /* .name = "Capture Source", */
681 .name
= "Input Source",
683 .info
= alc_mux_enum_info
,
684 .get
= alc_mux_enum_get
,
685 .put
= alc_mux_enum_put
,
690 /* capture mixer elements (in case NID 0x07 not available) */
691 static struct snd_kcontrol_new alc880_capture_alt_mixer
[] = {
692 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
693 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
694 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
695 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
697 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
698 /* The multiple "Capture Source" controls confuse alsamixer
699 * So call somewhat different..
700 * FIXME: the controls appear in the "playback" view!
702 /* .name = "Capture Source", */
703 .name
= "Input Source",
705 .info
= alc_mux_enum_info
,
706 .get
= alc_mux_enum_get
,
707 .put
= alc_mux_enum_put
,
715 * ALC880 5-stack model
717 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
719 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
720 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
723 /* additional mixers to alc880_three_stack_mixer */
724 static struct snd_kcontrol_new alc880_five_stack_mixer
[] = {
725 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
726 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT
),
730 /* channel source setting (6/8 channel selection for 5-stack) */
732 static struct hda_verb alc880_fivestack_ch6_init
[] = {
733 /* set line-in to input, mute it */
734 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
735 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
740 static struct hda_verb alc880_fivestack_ch8_init
[] = {
741 /* set line-in to output, unmute it */
742 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
743 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
747 static struct hda_channel_mode alc880_fivestack_modes
[2] = {
748 { 6, alc880_fivestack_ch6_init
},
749 { 8, alc880_fivestack_ch8_init
},
754 * ALC880 6-stack model
756 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
758 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
759 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
762 static hda_nid_t alc880_6st_dac_nids
[4] = {
763 /* front, rear, clfe, rear_surr */
764 0x02, 0x03, 0x04, 0x05
767 static struct hda_input_mux alc880_6stack_capture_source
= {
771 { "Front Mic", 0x1 },
777 /* fixed 8-channels */
778 static struct hda_channel_mode alc880_sixstack_modes
[1] = {
782 static struct snd_kcontrol_new alc880_six_stack_mixer
[] = {
783 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
784 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
785 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
786 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
787 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
788 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
789 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
790 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
791 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
792 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
793 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
794 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
795 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
796 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
798 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
799 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
800 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
801 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
802 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
804 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
805 .name
= "Channel Mode",
806 .info
= alc_ch_mode_info
,
807 .get
= alc_ch_mode_get
,
808 .put
= alc_ch_mode_put
,
817 * W810 has rear IO for:
820 * Center/LFE (DAC 04)
823 * The system also has a pair of internal speakers, and a headphone jack.
824 * These are both connected to Line2 on the codec, hence to DAC 02.
826 * There is a variable resistor to control the speaker or headphone
827 * volume. This is a hardware-only device without a software API.
829 * Plugging headphones in will disable the internal speakers. This is
830 * implemented in hardware, not via the driver using jack sense. In
831 * a similar fashion, plugging into the rear socket marked "front" will
832 * disable both the speakers and headphones.
834 * For input, there's a microphone jack, and an "audio in" jack.
835 * These may not do anything useful with this driver yet, because I
836 * haven't setup any initialization verbs for these yet...
839 static hda_nid_t alc880_w810_dac_nids
[3] = {
840 /* front, rear/surround, clfe */
844 /* fixed 6 channels */
845 static struct hda_channel_mode alc880_w810_modes
[1] = {
849 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
850 static struct snd_kcontrol_new alc880_w810_base_mixer
[] = {
851 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
852 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
853 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
854 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
855 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
856 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
857 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
858 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
859 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
867 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
868 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
872 static hda_nid_t alc880_z71v_dac_nids
[1] = {
875 #define ALC880_Z71V_HP_DAC 0x03
877 /* fixed 2 channels */
878 static struct hda_channel_mode alc880_2_jack_modes
[1] = {
882 static struct snd_kcontrol_new alc880_z71v_mixer
[] = {
883 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
884 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
885 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
886 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT
),
887 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
888 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
889 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
890 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
899 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
900 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
903 static hda_nid_t alc880_f1734_dac_nids
[1] = {
906 #define ALC880_F1734_HP_DAC 0x02
908 static struct snd_kcontrol_new alc880_f1734_mixer
[] = {
909 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
910 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT
),
911 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
912 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT
),
913 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
914 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
915 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
916 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
925 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
926 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
927 * Mic = 0x18, Line = 0x1a
930 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
931 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
933 static struct snd_kcontrol_new alc880_asus_mixer
[] = {
934 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
935 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
936 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
937 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
938 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
939 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
940 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
941 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
942 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
943 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
944 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
945 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
946 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
947 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
949 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
950 .name
= "Channel Mode",
951 .info
= alc_ch_mode_info
,
952 .get
= alc_ch_mode_get
,
953 .put
= alc_ch_mode_put
,
960 * ALC880 ASUS W1V model
962 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
963 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
964 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
967 /* additional mixers to alc880_asus_mixer */
968 static struct snd_kcontrol_new alc880_asus_w1v_mixer
[] = {
969 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT
),
970 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT
),
974 /* additional mixers to alc880_asus_mixer */
975 static struct snd_kcontrol_new alc880_pcbeep_mixer
[] = {
976 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
977 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
982 static struct snd_kcontrol_new alc880_tcl_s700_mixer
[] = {
983 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
984 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
985 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
986 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT
),
987 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT
),
988 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT
),
989 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT
),
990 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
991 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
993 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
994 /* The multiple "Capture Source" controls confuse alsamixer
995 * So call somewhat different..
996 * FIXME: the controls appear in the "playback" view!
998 /* .name = "Capture Source", */
999 .name
= "Input Source",
1001 .info
= alc_mux_enum_info
,
1002 .get
= alc_mux_enum_get
,
1003 .put
= alc_mux_enum_put
,
1009 * build control elements
1011 static int alc_build_controls(struct hda_codec
*codec
)
1013 struct alc_spec
*spec
= codec
->spec
;
1017 for (i
= 0; i
< spec
->num_mixers
; i
++) {
1018 err
= snd_hda_add_new_ctls(codec
, spec
->mixers
[i
]);
1023 if (spec
->multiout
.dig_out_nid
) {
1024 err
= snd_hda_create_spdif_out_ctls(codec
,
1025 spec
->multiout
.dig_out_nid
);
1029 if (spec
->dig_in_nid
) {
1030 err
= snd_hda_create_spdif_in_ctls(codec
, spec
->dig_in_nid
);
1039 * initialize the codec volumes, etc
1043 * generic initialization of ADC, input mixers and output mixers
1045 static struct hda_verb alc880_volume_init_verbs
[] = {
1047 * Unmute ADC0-2 and set the default input to mic-in
1049 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
1050 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1051 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
1052 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1053 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
1054 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1056 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
1058 * Note: PASD motherboards uses the Line In 2 as the input for front
1061 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
1062 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
1065 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
1066 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
1069 * Set up output mixers (0x0c - 0x0f)
1071 /* set vol=0 to output mixers */
1072 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1073 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1074 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1075 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
1076 /* set up input amps for analog loopback */
1077 /* Amp Indices: DAC = 0, mixer = 1 */
1078 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1079 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1080 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1081 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1082 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1083 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1084 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
1085 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
1091 * 3-stack pin configuration:
1092 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
1094 static struct hda_verb alc880_pin_3stack_init_verbs
[] = {
1096 * preset connection lists of input pins
1097 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1099 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02}, /* mic/clfe */
1100 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1101 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x03}, /* line/surround */
1104 * Set pin mode and muting
1106 /* set front pin widgets 0x14 for output */
1107 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1108 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1109 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1110 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1111 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1112 /* Mic2 (as headphone out) for HP output */
1113 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1114 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1115 /* Line In pin widget for input */
1116 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1117 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1118 /* Line2 (as front mic) pin widget for input and vref at 80% */
1119 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1120 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1121 /* CD pin widget for input */
1122 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1128 * 5-stack pin configuration:
1129 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
1130 * line-in/side = 0x1a, f-mic = 0x1b
1132 static struct hda_verb alc880_pin_5stack_init_verbs
[] = {
1134 * preset connection lists of input pins
1135 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
1137 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1138 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01}, /* line/side */
1141 * Set pin mode and muting
1143 /* set pin widgets 0x14-0x17 for output */
1144 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1145 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1146 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1147 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1148 /* unmute pins for output (no gain on this amp) */
1149 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1150 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1151 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1152 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1154 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1155 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1156 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1157 /* Mic2 (as headphone out) for HP output */
1158 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1159 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1160 /* Line In pin widget for input */
1161 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1162 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1163 /* Line2 (as front mic) pin widget for input and vref at 80% */
1164 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1165 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1166 /* CD pin widget for input */
1167 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1173 * W810 pin configuration:
1174 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
1176 static struct hda_verb alc880_pin_w810_init_verbs
[] = {
1177 /* hphone/speaker input selector: front DAC */
1178 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x0},
1180 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1181 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1183 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1184 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1185 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1187 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1188 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1194 * Z71V pin configuration:
1195 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
1197 static struct hda_verb alc880_pin_z71v_init_verbs
[] = {
1198 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1199 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1203 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1204 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1205 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1206 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1212 * 6-stack pin configuration:
1213 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
1214 * f-mic = 0x19, line = 0x1a, HP = 0x1b
1216 static struct hda_verb alc880_pin_6stack_init_verbs
[] = {
1217 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00}, /* HP */
1219 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1220 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1221 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1222 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1223 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1224 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1225 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1226 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1228 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1229 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1230 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1231 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1232 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1233 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1234 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1235 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1236 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1243 * F1734 pin configuration:
1244 * HP = 0x14, speaker-out = 0x15, mic = 0x18
1246 static struct hda_verb alc880_pin_f1734_init_verbs
[] = {
1247 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1248 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1249 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
1250 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1252 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1253 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1254 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1255 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1257 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1258 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1259 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1260 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1261 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1262 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1263 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1264 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1265 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1272 * ASUS pin configuration:
1273 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
1275 static struct hda_verb alc880_pin_asus_init_verbs
[] = {
1276 {0x10, AC_VERB_SET_CONNECT_SEL
, 0x02},
1277 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x00},
1278 {0x12, AC_VERB_SET_CONNECT_SEL
, 0x01},
1279 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1281 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1282 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1283 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1284 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1285 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1286 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1287 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1288 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1290 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1291 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1292 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1293 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1294 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1295 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
1296 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1297 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1298 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1303 /* Enable GPIO mask and set output */
1304 static struct hda_verb alc880_gpio1_init_verbs
[] = {
1305 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
1306 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
1307 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
1312 /* Enable GPIO mask and set output */
1313 static struct hda_verb alc880_gpio2_init_verbs
[] = {
1314 {0x01, AC_VERB_SET_GPIO_MASK
, 0x02},
1315 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x02},
1316 {0x01, AC_VERB_SET_GPIO_DATA
, 0x02},
1321 /* Clevo m520g init */
1322 static struct hda_verb alc880_pin_clevo_init_verbs
[] = {
1323 /* headphone output */
1324 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
1326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1327 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1329 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1330 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1332 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1333 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1334 /* Mic1 (rear panel) */
1335 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1336 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1337 /* Mic2 (front panel) */
1338 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1339 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1341 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1342 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1343 /* change to EAPD mode */
1344 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1345 {0x20, AC_VERB_SET_PROC_COEF
, 0x3060},
1350 static struct hda_verb alc880_pin_tcl_S700_init_verbs
[] = {
1351 /* Headphone output */
1352 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1354 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
1355 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
1357 /* Line In pin widget for input */
1358 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1359 /* CD pin widget for input */
1360 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1361 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1362 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1364 /* change to EAPD mode */
1365 {0x20, AC_VERB_SET_COEF_INDEX
, 0x07},
1366 {0x20, AC_VERB_SET_PROC_COEF
, 0x3070},
1372 * LG m1 express dual
1375 * Rear Line-In/Out (blue): 0x14
1376 * Build-in Mic-In: 0x15
1378 * HP-Out (green): 0x1b
1379 * Mic-In/Out (red): 0x19
1383 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
1384 static hda_nid_t alc880_lg_dac_nids
[3] = {
1388 /* seems analog CD is not working */
1389 static struct hda_input_mux alc880_lg_capture_source
= {
1394 { "Internal Mic", 0x6 },
1398 /* 2,4,6 channel modes */
1399 static struct hda_verb alc880_lg_ch2_init
[] = {
1400 /* set line-in and mic-in to input */
1401 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1402 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1406 static struct hda_verb alc880_lg_ch4_init
[] = {
1407 /* set line-in to out and mic-in to input */
1408 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1409 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1413 static struct hda_verb alc880_lg_ch6_init
[] = {
1414 /* set line-in and mic-in to output */
1415 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1416 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1420 static struct hda_channel_mode alc880_lg_ch_modes
[3] = {
1421 { 2, alc880_lg_ch2_init
},
1422 { 4, alc880_lg_ch4_init
},
1423 { 6, alc880_lg_ch6_init
},
1426 static struct snd_kcontrol_new alc880_lg_mixer
[] = {
1427 /* FIXME: it's not really "master" but front channels */
1428 HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
1429 HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT
),
1430 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1431 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT
),
1432 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT
),
1433 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT
),
1434 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT
),
1435 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT
),
1436 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
1437 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
1438 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT
),
1439 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT
),
1440 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT
),
1441 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT
),
1443 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1444 .name
= "Channel Mode",
1445 .info
= alc_ch_mode_info
,
1446 .get
= alc_ch_mode_get
,
1447 .put
= alc_ch_mode_put
,
1452 static struct hda_verb alc880_lg_init_verbs
[] = {
1453 /* set capture source to mic-in */
1454 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1455 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1456 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
1457 /* mute all amp mixer inputs */
1458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
1459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(6)},
1460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(7)},
1461 /* line-in to input */
1462 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
1463 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1466 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1468 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1469 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1470 /* mic-in to input */
1471 {0x11, AC_VERB_SET_CONNECT_SEL
, 0x01},
1472 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1473 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1475 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x03},
1476 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1477 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1479 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
1483 /* toggle speaker-output according to the hp-jack state */
1484 static void alc880_lg_automute(struct hda_codec
*codec
)
1486 unsigned int present
;
1488 present
= snd_hda_codec_read(codec
, 0x1b, 0,
1489 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1490 snd_hda_codec_amp_update(codec
, 0x17, 0, HDA_OUTPUT
, 0,
1491 0x80, present
? 0x80 : 0);
1492 snd_hda_codec_amp_update(codec
, 0x17, 1, HDA_OUTPUT
, 0,
1493 0x80, present
? 0x80 : 0);
1496 static void alc880_lg_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1498 /* Looks like the unsol event is incompatible with the standard
1499 * definition. 4bit tag is placed at 28 bit!
1501 if ((res
>> 28) == 0x01)
1502 alc880_lg_automute(codec
);
1511 * Built-in Mic-In: 0x19 (?)
1516 /* seems analog CD is not working */
1517 static struct hda_input_mux alc880_lg_lw_capture_source
= {
1521 { "Internal Mic", 0x1 },
1525 static struct snd_kcontrol_new alc880_lg_lw_mixer
[] = {
1526 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
1527 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT
),
1528 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
1529 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
1530 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
1531 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
1535 static struct hda_verb alc880_lg_lw_init_verbs
[] = {
1536 /* set capture source to mic-in */
1537 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1538 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1539 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
1540 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(7)},
1542 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1543 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1545 {0x13, AC_VERB_SET_CONNECT_SEL
, 0x00},
1546 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
1547 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1548 /* mic-in to input */
1549 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1550 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1552 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
1553 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
1555 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| 0x1},
1559 /* toggle speaker-output according to the hp-jack state */
1560 static void alc880_lg_lw_automute(struct hda_codec
*codec
)
1562 unsigned int present
;
1564 present
= snd_hda_codec_read(codec
, 0x1b, 0,
1565 AC_VERB_GET_PIN_SENSE
, 0) & 0x80000000;
1566 snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
1567 0x80, present
? 0x80 : 0);
1568 snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
1569 0x80, present
? 0x80 : 0);
1572 static void alc880_lg_lw_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1574 /* Looks like the unsol event is incompatible with the standard
1575 * definition. 4bit tag is placed at 28 bit!
1577 if ((res
>> 28) == 0x01)
1578 alc880_lg_lw_automute(codec
);
1585 static int alc_init(struct hda_codec
*codec
)
1587 struct alc_spec
*spec
= codec
->spec
;
1590 for (i
= 0; i
< spec
->num_init_verbs
; i
++)
1591 snd_hda_sequence_write(codec
, spec
->init_verbs
[i
]);
1593 if (spec
->init_hook
)
1594 spec
->init_hook(codec
);
1599 static void alc_unsol_event(struct hda_codec
*codec
, unsigned int res
)
1601 struct alc_spec
*spec
= codec
->spec
;
1603 if (spec
->unsol_event
)
1604 spec
->unsol_event(codec
, res
);
1611 static int alc_resume(struct hda_codec
*codec
)
1613 struct alc_spec
*spec
= codec
->spec
;
1617 for (i
= 0; i
< spec
->num_mixers
; i
++)
1618 snd_hda_resume_ctls(codec
, spec
->mixers
[i
]);
1619 if (spec
->multiout
.dig_out_nid
)
1620 snd_hda_resume_spdif_out(codec
);
1621 if (spec
->dig_in_nid
)
1622 snd_hda_resume_spdif_in(codec
);
1629 * Analog playback callbacks
1631 static int alc880_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
1632 struct hda_codec
*codec
,
1633 struct snd_pcm_substream
*substream
)
1635 struct alc_spec
*spec
= codec
->spec
;
1636 return snd_hda_multi_out_analog_open(codec
, &spec
->multiout
, substream
);
1639 static int alc880_playback_pcm_prepare(struct hda_pcm_stream
*hinfo
,
1640 struct hda_codec
*codec
,
1641 unsigned int stream_tag
,
1642 unsigned int format
,
1643 struct snd_pcm_substream
*substream
)
1645 struct alc_spec
*spec
= codec
->spec
;
1646 return snd_hda_multi_out_analog_prepare(codec
, &spec
->multiout
,
1647 stream_tag
, format
, substream
);
1650 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
1651 struct hda_codec
*codec
,
1652 struct snd_pcm_substream
*substream
)
1654 struct alc_spec
*spec
= codec
->spec
;
1655 return snd_hda_multi_out_analog_cleanup(codec
, &spec
->multiout
);
1661 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream
*hinfo
,
1662 struct hda_codec
*codec
,
1663 struct snd_pcm_substream
*substream
)
1665 struct alc_spec
*spec
= codec
->spec
;
1666 return snd_hda_multi_out_dig_open(codec
, &spec
->multiout
);
1669 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream
*hinfo
,
1670 struct hda_codec
*codec
,
1671 struct snd_pcm_substream
*substream
)
1673 struct alc_spec
*spec
= codec
->spec
;
1674 return snd_hda_multi_out_dig_close(codec
, &spec
->multiout
);
1680 static int alc880_capture_pcm_prepare(struct hda_pcm_stream
*hinfo
,
1681 struct hda_codec
*codec
,
1682 unsigned int stream_tag
,
1683 unsigned int format
,
1684 struct snd_pcm_substream
*substream
)
1686 struct alc_spec
*spec
= codec
->spec
;
1688 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
1689 stream_tag
, 0, format
);
1693 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream
*hinfo
,
1694 struct hda_codec
*codec
,
1695 struct snd_pcm_substream
*substream
)
1697 struct alc_spec
*spec
= codec
->spec
;
1699 snd_hda_codec_setup_stream(codec
, spec
->adc_nids
[substream
->number
],
1707 static struct hda_pcm_stream alc880_pcm_analog_playback
= {
1711 /* NID is set in alc_build_pcms */
1713 .open
= alc880_playback_pcm_open
,
1714 .prepare
= alc880_playback_pcm_prepare
,
1715 .cleanup
= alc880_playback_pcm_cleanup
1719 static struct hda_pcm_stream alc880_pcm_analog_capture
= {
1723 /* NID is set in alc_build_pcms */
1725 .prepare
= alc880_capture_pcm_prepare
,
1726 .cleanup
= alc880_capture_pcm_cleanup
1730 static struct hda_pcm_stream alc880_pcm_digital_playback
= {
1734 /* NID is set in alc_build_pcms */
1736 .open
= alc880_dig_playback_pcm_open
,
1737 .close
= alc880_dig_playback_pcm_close
1741 static struct hda_pcm_stream alc880_pcm_digital_capture
= {
1745 /* NID is set in alc_build_pcms */
1748 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
1749 static struct hda_pcm_stream alc_pcm_null_playback
= {
1755 static int alc_build_pcms(struct hda_codec
*codec
)
1757 struct alc_spec
*spec
= codec
->spec
;
1758 struct hda_pcm
*info
= spec
->pcm_rec
;
1761 codec
->num_pcms
= 1;
1762 codec
->pcm_info
= info
;
1764 info
->name
= spec
->stream_name_analog
;
1765 if (spec
->stream_analog_playback
) {
1766 snd_assert(spec
->multiout
.dac_nids
, return -EINVAL
);
1767 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_analog_playback
);
1768 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dac_nids
[0];
1770 if (spec
->stream_analog_capture
) {
1771 snd_assert(spec
->adc_nids
, return -EINVAL
);
1772 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
1773 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[0];
1776 if (spec
->channel_mode
) {
1777 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= 0;
1778 for (i
= 0; i
< spec
->num_channel_mode
; i
++) {
1779 if (spec
->channel_mode
[i
].channels
> info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
) {
1780 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].channels_max
= spec
->channel_mode
[i
].channels
;
1785 /* If the use of more than one ADC is requested for the current
1786 * model, configure a second analog capture-only PCM.
1788 if (spec
->num_adc_nids
> 1) {
1791 info
->name
= spec
->stream_name_analog
;
1792 /* No playback stream for second PCM */
1793 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = alc_pcm_null_playback
;
1794 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= 0;
1795 if (spec
->stream_analog_capture
) {
1796 snd_assert(spec
->adc_nids
, return -EINVAL
);
1797 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_analog_capture
);
1798 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->adc_nids
[1];
1802 if (spec
->multiout
.dig_out_nid
|| spec
->dig_in_nid
) {
1805 info
->name
= spec
->stream_name_digital
;
1806 if (spec
->multiout
.dig_out_nid
&&
1807 spec
->stream_digital_playback
) {
1808 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
] = *(spec
->stream_digital_playback
);
1809 info
->stream
[SNDRV_PCM_STREAM_PLAYBACK
].nid
= spec
->multiout
.dig_out_nid
;
1811 if (spec
->dig_in_nid
&&
1812 spec
->stream_digital_capture
) {
1813 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
] = *(spec
->stream_digital_capture
);
1814 info
->stream
[SNDRV_PCM_STREAM_CAPTURE
].nid
= spec
->dig_in_nid
;
1821 static void alc_free(struct hda_codec
*codec
)
1823 struct alc_spec
*spec
= codec
->spec
;
1829 if (spec
->kctl_alloc
) {
1830 for (i
= 0; i
< spec
->num_kctl_used
; i
++)
1831 kfree(spec
->kctl_alloc
[i
].name
);
1832 kfree(spec
->kctl_alloc
);
1839 static struct hda_codec_ops alc_patch_ops
= {
1840 .build_controls
= alc_build_controls
,
1841 .build_pcms
= alc_build_pcms
,
1844 .unsol_event
= alc_unsol_event
,
1846 .resume
= alc_resume
,
1852 * Test configuration for debugging
1854 * Almost all inputs/outputs are enabled. I/O pins can be configured via
1857 #ifdef CONFIG_SND_DEBUG
1858 static hda_nid_t alc880_test_dac_nids
[4] = {
1859 0x02, 0x03, 0x04, 0x05
1862 static struct hda_input_mux alc880_test_capture_source
= {
1871 { "Surround", 0x6 },
1875 static struct hda_channel_mode alc880_test_modes
[4] = {
1882 static int alc_test_pin_ctl_info(struct snd_kcontrol
*kcontrol
,
1883 struct snd_ctl_elem_info
*uinfo
)
1885 static char *texts
[] = {
1886 "N/A", "Line Out", "HP Out",
1887 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
1889 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
1891 uinfo
->value
.enumerated
.items
= 8;
1892 if (uinfo
->value
.enumerated
.item
>= 8)
1893 uinfo
->value
.enumerated
.item
= 7;
1894 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
1898 static int alc_test_pin_ctl_get(struct snd_kcontrol
*kcontrol
,
1899 struct snd_ctl_elem_value
*ucontrol
)
1901 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1902 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
1903 unsigned int pin_ctl
, item
= 0;
1905 pin_ctl
= snd_hda_codec_read(codec
, nid
, 0,
1906 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
1907 if (pin_ctl
& AC_PINCTL_OUT_EN
) {
1908 if (pin_ctl
& AC_PINCTL_HP_EN
)
1912 } else if (pin_ctl
& AC_PINCTL_IN_EN
) {
1913 switch (pin_ctl
& AC_PINCTL_VREFEN
) {
1914 case AC_PINCTL_VREF_HIZ
: item
= 3; break;
1915 case AC_PINCTL_VREF_50
: item
= 4; break;
1916 case AC_PINCTL_VREF_GRD
: item
= 5; break;
1917 case AC_PINCTL_VREF_80
: item
= 6; break;
1918 case AC_PINCTL_VREF_100
: item
= 7; break;
1921 ucontrol
->value
.enumerated
.item
[0] = item
;
1925 static int alc_test_pin_ctl_put(struct snd_kcontrol
*kcontrol
,
1926 struct snd_ctl_elem_value
*ucontrol
)
1928 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1929 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
1930 static unsigned int ctls
[] = {
1931 0, AC_PINCTL_OUT_EN
, AC_PINCTL_OUT_EN
| AC_PINCTL_HP_EN
,
1932 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_HIZ
,
1933 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_50
,
1934 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_GRD
,
1935 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_80
,
1936 AC_PINCTL_IN_EN
| AC_PINCTL_VREF_100
,
1938 unsigned int old_ctl
, new_ctl
;
1940 old_ctl
= snd_hda_codec_read(codec
, nid
, 0,
1941 AC_VERB_GET_PIN_WIDGET_CONTROL
, 0);
1942 new_ctl
= ctls
[ucontrol
->value
.enumerated
.item
[0]];
1943 if (old_ctl
!= new_ctl
) {
1944 snd_hda_codec_write(codec
, nid
, 0,
1945 AC_VERB_SET_PIN_WIDGET_CONTROL
, new_ctl
);
1946 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
1947 (ucontrol
->value
.enumerated
.item
[0] >= 3 ?
1954 static int alc_test_pin_src_info(struct snd_kcontrol
*kcontrol
,
1955 struct snd_ctl_elem_info
*uinfo
)
1957 static char *texts
[] = {
1958 "Front", "Surround", "CLFE", "Side"
1960 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
1962 uinfo
->value
.enumerated
.items
= 4;
1963 if (uinfo
->value
.enumerated
.item
>= 4)
1964 uinfo
->value
.enumerated
.item
= 3;
1965 strcpy(uinfo
->value
.enumerated
.name
, texts
[uinfo
->value
.enumerated
.item
]);
1969 static int alc_test_pin_src_get(struct snd_kcontrol
*kcontrol
,
1970 struct snd_ctl_elem_value
*ucontrol
)
1972 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1973 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
1976 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0);
1977 ucontrol
->value
.enumerated
.item
[0] = sel
& 3;
1981 static int alc_test_pin_src_put(struct snd_kcontrol
*kcontrol
,
1982 struct snd_ctl_elem_value
*ucontrol
)
1984 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
1985 hda_nid_t nid
= (hda_nid_t
)kcontrol
->private_value
;
1988 sel
= snd_hda_codec_read(codec
, nid
, 0, AC_VERB_GET_CONNECT_SEL
, 0) & 3;
1989 if (ucontrol
->value
.enumerated
.item
[0] != sel
) {
1990 sel
= ucontrol
->value
.enumerated
.item
[0] & 3;
1991 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, sel
);
1997 #define PIN_CTL_TEST(xname,nid) { \
1998 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2000 .info = alc_test_pin_ctl_info, \
2001 .get = alc_test_pin_ctl_get, \
2002 .put = alc_test_pin_ctl_put, \
2003 .private_value = nid \
2006 #define PIN_SRC_TEST(xname,nid) { \
2007 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2009 .info = alc_test_pin_src_info, \
2010 .get = alc_test_pin_src_get, \
2011 .put = alc_test_pin_src_put, \
2012 .private_value = nid \
2015 static struct snd_kcontrol_new alc880_test_mixer
[] = {
2016 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
2017 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
2018 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT
),
2019 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
2020 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
2021 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
2022 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT
),
2023 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
2024 PIN_CTL_TEST("Front Pin Mode", 0x14),
2025 PIN_CTL_TEST("Surround Pin Mode", 0x15),
2026 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
2027 PIN_CTL_TEST("Side Pin Mode", 0x17),
2028 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
2029 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
2030 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
2031 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
2032 PIN_SRC_TEST("In-1 Pin Source", 0x18),
2033 PIN_SRC_TEST("In-2 Pin Source", 0x19),
2034 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
2035 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
2036 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT
),
2037 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT
),
2038 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT
),
2039 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT
),
2040 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT
),
2041 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT
),
2042 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT
),
2043 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT
),
2044 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT
),
2045 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT
),
2047 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
2048 .name
= "Channel Mode",
2049 .info
= alc_ch_mode_info
,
2050 .get
= alc_ch_mode_get
,
2051 .put
= alc_ch_mode_put
,
2056 static struct hda_verb alc880_test_init_verbs
[] = {
2057 /* Unmute inputs of 0x0c - 0x0f */
2058 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2059 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2060 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2061 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2062 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2063 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2064 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
2065 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
2066 /* Vol output for 0x0c-0x0f */
2067 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2068 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2069 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2070 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
2071 /* Set output pins 0x14-0x17 */
2072 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2073 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2074 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2075 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
2076 /* Unmute output pins 0x14-0x17 */
2077 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2078 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2079 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2080 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
2081 /* Set input pins 0x18-0x1c */
2082 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2083 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
2084 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2085 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2086 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
2087 /* Mute input pins 0x18-0x1b */
2088 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2089 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2090 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2091 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
2093 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2094 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
2095 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2096 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
2097 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2098 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
2099 /* Analog input/passthru */
2100 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
2101 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
2102 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
2103 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
2104 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
2112 static struct hda_board_config alc880_cfg_tbl
[] = {
2113 /* Back 3 jack, front 2 jack */
2114 { .modelname
= "3stack", .config
= ALC880_3ST
},
2115 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe200, .config
= ALC880_3ST
},
2116 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe201, .config
= ALC880_3ST
},
2117 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe202, .config
= ALC880_3ST
},
2118 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe203, .config
= ALC880_3ST
},
2119 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe204, .config
= ALC880_3ST
},
2120 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe205, .config
= ALC880_3ST
},
2121 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe206, .config
= ALC880_3ST
},
2122 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe207, .config
= ALC880_3ST
},
2123 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe208, .config
= ALC880_3ST
},
2124 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe209, .config
= ALC880_3ST
},
2125 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe20a, .config
= ALC880_3ST
},
2126 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe20b, .config
= ALC880_3ST
},
2127 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe20c, .config
= ALC880_3ST
},
2128 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe20d, .config
= ALC880_3ST
},
2129 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe20e, .config
= ALC880_3ST
},
2130 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe20f, .config
= ALC880_3ST
},
2131 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe210, .config
= ALC880_3ST
},
2132 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe211, .config
= ALC880_3ST
},
2133 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe214, .config
= ALC880_3ST
},
2134 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe302, .config
= ALC880_3ST
},
2135 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe303, .config
= ALC880_3ST
},
2136 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe304, .config
= ALC880_3ST
},
2137 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe306, .config
= ALC880_3ST
},
2138 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe307, .config
= ALC880_3ST
},
2139 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe404, .config
= ALC880_3ST
},
2140 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xa101, .config
= ALC880_3ST
},
2141 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x3031, .config
= ALC880_3ST
},
2142 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x4036, .config
= ALC880_3ST
},
2143 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x4037, .config
= ALC880_3ST
},
2144 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x4038, .config
= ALC880_3ST
},
2145 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x4040, .config
= ALC880_3ST
},
2146 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x4041, .config
= ALC880_3ST
},
2148 { .pci_subvendor
= 0x19db, .pci_subdevice
= 0x4188, .config
= ALC880_TCL_S700
},
2150 /* Back 3 jack, front 2 jack (Internal add Aux-In) */
2151 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0xe310, .config
= ALC880_3ST
},
2152 { .pci_subvendor
= 0x104d, .pci_subdevice
= 0x81d6, .config
= ALC880_3ST
},
2153 { .pci_subvendor
= 0x104d, .pci_subdevice
= 0x81a0, .config
= ALC880_3ST
},
2155 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */
2156 { .modelname
= "3stack-digout", .config
= ALC880_3ST_DIG
},
2157 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe308, .config
= ALC880_3ST_DIG
},
2158 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0x0070, .config
= ALC880_3ST_DIG
},
2159 /* Clevo m520G NB */
2160 { .pci_subvendor
= 0x1558, .pci_subdevice
= 0x0520, .config
= ALC880_CLEVO
},
2162 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack (Internal add Aux-In)*/
2163 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe305, .config
= ALC880_3ST_DIG
},
2164 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xd402, .config
= ALC880_3ST_DIG
},
2165 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0xe309, .config
= ALC880_3ST_DIG
},
2167 /* Back 5 jack, front 2 jack */
2168 { .modelname
= "5stack", .config
= ALC880_5ST
},
2169 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x3033, .config
= ALC880_5ST
},
2170 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x4039, .config
= ALC880_5ST
},
2171 { .pci_subvendor
= 0x107b, .pci_subdevice
= 0x3032, .config
= ALC880_5ST
},
2172 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x2a09, .config
= ALC880_5ST
},
2173 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x814e, .config
= ALC880_5ST
},
2175 /* Back 5 jack plus 1 SPDIF out jack, front 2 jack */
2176 { .modelname
= "5stack-digout", .config
= ALC880_5ST_DIG
},
2177 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe224, .config
= ALC880_5ST_DIG
},
2178 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe400, .config
= ALC880_5ST_DIG
},
2179 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe401, .config
= ALC880_5ST_DIG
},
2180 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xe402, .config
= ALC880_5ST_DIG
},
2181 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xd400, .config
= ALC880_5ST_DIG
},
2182 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xd401, .config
= ALC880_5ST_DIG
},
2183 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xa100, .config
= ALC880_5ST_DIG
},
2184 { .pci_subvendor
= 0x1565, .pci_subdevice
= 0x8202, .config
= ALC880_5ST_DIG
},
2185 { .pci_subvendor
= 0x1019, .pci_subdevice
= 0xa880, .config
= ALC880_5ST_DIG
},
2186 { .pci_subvendor
= 0xa0a0, .pci_subdevice
= 0x0560,
2187 .config
= ALC880_5ST_DIG
}, /* Aopen i915GMm-HFS */
2188 /* { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_5ST_DIG }, */ /* conflict with 6stack */
2189 { .pci_subvendor
= 0x1695, .pci_subdevice
= 0x400d, .config
= ALC880_5ST_DIG
},
2190 /* note subvendor = 0 below */
2191 /* { .pci_subvendor = 0x0000, .pci_subdevice = 0x8086, .config = ALC880_5ST_DIG }, */
2193 { .modelname
= "w810", .config
= ALC880_W810
},
2194 { .pci_subvendor
= 0x161f, .pci_subdevice
= 0x203d, .config
= ALC880_W810
},
2196 { .modelname
= "z71v", .config
= ALC880_Z71V
},
2197 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1964, .config
= ALC880_Z71V
},
2199 { .modelname
= "6stack", .config
= ALC880_6ST
},
2200 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x8196, .config
= ALC880_6ST
}, /* ASUS P5GD1-HVM */
2201 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x81b4, .config
= ALC880_6ST
},
2202 { .pci_subvendor
= 0x1019, .pci_subdevice
= 0xa884, .config
= ALC880_6ST
}, /* Acer APFV */
2203 { .pci_subvendor
= 0x1458, .pci_subdevice
= 0xa102, .config
= ALC880_6ST
}, /* Gigabyte K8N51 */
2205 { .modelname
= "6stack-digout", .config
= ALC880_6ST_DIG
},
2206 { .pci_subvendor
= 0x2668, .pci_subdevice
= 0x8086, .config
= ALC880_6ST_DIG
},
2207 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0x2668, .config
= ALC880_6ST_DIG
},
2208 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x1150, .config
= ALC880_6ST_DIG
},
2209 { .pci_subvendor
= 0xe803, .pci_subdevice
= 0x1019, .config
= ALC880_6ST_DIG
},
2210 { .pci_subvendor
= 0x1039, .pci_subdevice
= 0x1234, .config
= ALC880_6ST_DIG
},
2211 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0x0077, .config
= ALC880_6ST_DIG
},
2212 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0x0078, .config
= ALC880_6ST_DIG
},
2213 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0x0087, .config
= ALC880_6ST_DIG
},
2214 { .pci_subvendor
= 0x1297, .pci_subdevice
= 0xc790, .config
= ALC880_6ST_DIG
}, /* Shuttle ST20G5 */
2215 { .pci_subvendor
= 0x1509, .pci_subdevice
= 0x925d, .config
= ALC880_6ST_DIG
}, /* FIC P4M-915GD1 */
2216 { .pci_subvendor
= 0x1695, .pci_subdevice
= 0x4012, .config
= ALC880_5ST_DIG
}, /* Epox EP-5LDA+ GLi */
2218 { .modelname
= "asus", .config
= ALC880_ASUS
},
2219 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1964, .config
= ALC880_ASUS_DIG
},
2220 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1973, .config
= ALC880_ASUS_DIG
},
2221 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x19b3, .config
= ALC880_ASUS_DIG
},
2222 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1113, .config
= ALC880_ASUS_DIG
},
2223 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1173, .config
= ALC880_ASUS_DIG
},
2224 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1993, .config
= ALC880_ASUS
},
2225 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x10c3, .config
= ALC880_ASUS_DIG
},
2226 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1133, .config
= ALC880_ASUS
},
2227 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1123, .config
= ALC880_ASUS_DIG
},
2228 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x1143, .config
= ALC880_ASUS
},
2229 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x10b3, .config
= ALC880_ASUS_W1V
},
2230 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x8181, .config
= ALC880_ASUS_DIG
}, /* ASUS P4GPL-X */
2231 { .pci_subvendor
= 0x1558, .pci_subdevice
= 0x5401, .config
= ALC880_ASUS_DIG2
},
2233 { .modelname
= "uniwill", .config
= ALC880_UNIWILL_DIG
},
2234 { .pci_subvendor
= 0x1584, .pci_subdevice
= 0x9050, .config
= ALC880_UNIWILL_DIG
},
2236 { .modelname
= "F1734", .config
= ALC880_F1734
},
2237 { .pci_subvendor
= 0x1734, .pci_subdevice
= 0x107c, .config
= ALC880_F1734
},
2238 { .pci_subvendor
= 0x1584, .pci_subdevice
= 0x9054, .config
= ALC880_F1734
},
2240 { .modelname
= "lg", .config
= ALC880_LG
},
2241 { .pci_subvendor
= 0x1854, .pci_subdevice
= 0x003b, .config
= ALC880_LG
},
2242 { .pci_subvendor
= 0x1854, .pci_subdevice
= 0x0068, .config
= ALC880_LG
},
2244 { .modelname
= "lg-lw", .config
= ALC880_LG_LW
},
2245 { .pci_subvendor
= 0x1854, .pci_subdevice
= 0x0018, .config
= ALC880_LG_LW
},
2247 #ifdef CONFIG_SND_DEBUG
2248 { .modelname
= "test", .config
= ALC880_TEST
},
2250 { .modelname
= "auto", .config
= ALC880_AUTO
},
2256 * ALC880 codec presets
2258 static struct alc_config_preset alc880_presets
[] = {
2260 .mixers
= { alc880_three_stack_mixer
},
2261 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_3stack_init_verbs
},
2262 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2263 .dac_nids
= alc880_dac_nids
,
2264 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2265 .channel_mode
= alc880_threestack_modes
,
2266 .input_mux
= &alc880_capture_source
,
2268 [ALC880_3ST_DIG
] = {
2269 .mixers
= { alc880_three_stack_mixer
},
2270 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_3stack_init_verbs
},
2271 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2272 .dac_nids
= alc880_dac_nids
,
2273 .dig_out_nid
= ALC880_DIGOUT_NID
,
2274 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2275 .channel_mode
= alc880_threestack_modes
,
2276 .input_mux
= &alc880_capture_source
,
2278 [ALC880_TCL_S700
] = {
2279 .mixers
= { alc880_tcl_s700_mixer
},
2280 .init_verbs
= { alc880_volume_init_verbs
,
2281 alc880_pin_tcl_S700_init_verbs
,
2282 alc880_gpio2_init_verbs
},
2283 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2284 .dac_nids
= alc880_dac_nids
,
2286 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2287 .channel_mode
= alc880_2_jack_modes
,
2288 .input_mux
= &alc880_capture_source
,
2291 .mixers
= { alc880_three_stack_mixer
, alc880_five_stack_mixer
},
2292 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_5stack_init_verbs
},
2293 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2294 .dac_nids
= alc880_dac_nids
,
2295 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
2296 .channel_mode
= alc880_fivestack_modes
,
2297 .input_mux
= &alc880_capture_source
,
2299 [ALC880_5ST_DIG
] = {
2300 .mixers
= { alc880_three_stack_mixer
, alc880_five_stack_mixer
},
2301 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_5stack_init_verbs
},
2302 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2303 .dac_nids
= alc880_dac_nids
,
2304 .dig_out_nid
= ALC880_DIGOUT_NID
,
2305 .num_channel_mode
= ARRAY_SIZE(alc880_fivestack_modes
),
2306 .channel_mode
= alc880_fivestack_modes
,
2307 .input_mux
= &alc880_capture_source
,
2310 .mixers
= { alc880_six_stack_mixer
},
2311 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_6stack_init_verbs
},
2312 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
2313 .dac_nids
= alc880_6st_dac_nids
,
2314 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
2315 .channel_mode
= alc880_sixstack_modes
,
2316 .input_mux
= &alc880_6stack_capture_source
,
2318 [ALC880_6ST_DIG
] = {
2319 .mixers
= { alc880_six_stack_mixer
},
2320 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_6stack_init_verbs
},
2321 .num_dacs
= ARRAY_SIZE(alc880_6st_dac_nids
),
2322 .dac_nids
= alc880_6st_dac_nids
,
2323 .dig_out_nid
= ALC880_DIGOUT_NID
,
2324 .num_channel_mode
= ARRAY_SIZE(alc880_sixstack_modes
),
2325 .channel_mode
= alc880_sixstack_modes
,
2326 .input_mux
= &alc880_6stack_capture_source
,
2329 .mixers
= { alc880_w810_base_mixer
},
2330 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_w810_init_verbs
,
2331 alc880_gpio2_init_verbs
},
2332 .num_dacs
= ARRAY_SIZE(alc880_w810_dac_nids
),
2333 .dac_nids
= alc880_w810_dac_nids
,
2334 .dig_out_nid
= ALC880_DIGOUT_NID
,
2335 .num_channel_mode
= ARRAY_SIZE(alc880_w810_modes
),
2336 .channel_mode
= alc880_w810_modes
,
2337 .input_mux
= &alc880_capture_source
,
2340 .mixers
= { alc880_z71v_mixer
},
2341 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_z71v_init_verbs
},
2342 .num_dacs
= ARRAY_SIZE(alc880_z71v_dac_nids
),
2343 .dac_nids
= alc880_z71v_dac_nids
,
2344 .dig_out_nid
= ALC880_DIGOUT_NID
,
2346 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2347 .channel_mode
= alc880_2_jack_modes
,
2348 .input_mux
= &alc880_capture_source
,
2351 .mixers
= { alc880_f1734_mixer
},
2352 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_f1734_init_verbs
},
2353 .num_dacs
= ARRAY_SIZE(alc880_f1734_dac_nids
),
2354 .dac_nids
= alc880_f1734_dac_nids
,
2356 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2357 .channel_mode
= alc880_2_jack_modes
,
2358 .input_mux
= &alc880_capture_source
,
2361 .mixers
= { alc880_asus_mixer
},
2362 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
,
2363 alc880_gpio1_init_verbs
},
2364 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2365 .dac_nids
= alc880_asus_dac_nids
,
2366 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2367 .channel_mode
= alc880_asus_modes
,
2368 .input_mux
= &alc880_capture_source
,
2370 [ALC880_ASUS_DIG
] = {
2371 .mixers
= { alc880_asus_mixer
},
2372 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
,
2373 alc880_gpio1_init_verbs
},
2374 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2375 .dac_nids
= alc880_asus_dac_nids
,
2376 .dig_out_nid
= ALC880_DIGOUT_NID
,
2377 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2378 .channel_mode
= alc880_asus_modes
,
2379 .input_mux
= &alc880_capture_source
,
2381 [ALC880_ASUS_DIG2
] = {
2382 .mixers
= { alc880_asus_mixer
},
2383 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
,
2384 alc880_gpio2_init_verbs
}, /* use GPIO2 */
2385 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2386 .dac_nids
= alc880_asus_dac_nids
,
2387 .dig_out_nid
= ALC880_DIGOUT_NID
,
2388 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2389 .channel_mode
= alc880_asus_modes
,
2390 .input_mux
= &alc880_capture_source
,
2392 [ALC880_ASUS_W1V
] = {
2393 .mixers
= { alc880_asus_mixer
, alc880_asus_w1v_mixer
},
2394 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
,
2395 alc880_gpio1_init_verbs
},
2396 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2397 .dac_nids
= alc880_asus_dac_nids
,
2398 .dig_out_nid
= ALC880_DIGOUT_NID
,
2399 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2400 .channel_mode
= alc880_asus_modes
,
2401 .input_mux
= &alc880_capture_source
,
2403 [ALC880_UNIWILL_DIG
] = {
2404 .mixers
= { alc880_asus_mixer
, alc880_pcbeep_mixer
},
2405 .init_verbs
= { alc880_volume_init_verbs
, alc880_pin_asus_init_verbs
},
2406 .num_dacs
= ARRAY_SIZE(alc880_asus_dac_nids
),
2407 .dac_nids
= alc880_asus_dac_nids
,
2408 .dig_out_nid
= ALC880_DIGOUT_NID
,
2409 .num_channel_mode
= ARRAY_SIZE(alc880_asus_modes
),
2410 .channel_mode
= alc880_asus_modes
,
2411 .input_mux
= &alc880_capture_source
,
2414 .mixers
= { alc880_three_stack_mixer
},
2415 .init_verbs
= { alc880_volume_init_verbs
,
2416 alc880_pin_clevo_init_verbs
},
2417 .num_dacs
= ARRAY_SIZE(alc880_dac_nids
),
2418 .dac_nids
= alc880_dac_nids
,
2420 .num_channel_mode
= ARRAY_SIZE(alc880_threestack_modes
),
2421 .channel_mode
= alc880_threestack_modes
,
2422 .input_mux
= &alc880_capture_source
,
2425 .mixers
= { alc880_lg_mixer
},
2426 .init_verbs
= { alc880_volume_init_verbs
,
2427 alc880_lg_init_verbs
},
2428 .num_dacs
= ARRAY_SIZE(alc880_lg_dac_nids
),
2429 .dac_nids
= alc880_lg_dac_nids
,
2430 .dig_out_nid
= ALC880_DIGOUT_NID
,
2431 .num_channel_mode
= ARRAY_SIZE(alc880_lg_ch_modes
),
2432 .channel_mode
= alc880_lg_ch_modes
,
2433 .input_mux
= &alc880_lg_capture_source
,
2434 .unsol_event
= alc880_lg_unsol_event
,
2435 .init_hook
= alc880_lg_automute
,
2438 .mixers
= { alc880_lg_lw_mixer
},
2439 .init_verbs
= { alc880_volume_init_verbs
,
2440 alc880_lg_lw_init_verbs
},
2442 .dac_nids
= alc880_dac_nids
,
2443 .dig_out_nid
= ALC880_DIGOUT_NID
,
2444 .num_channel_mode
= ARRAY_SIZE(alc880_2_jack_modes
),
2445 .channel_mode
= alc880_2_jack_modes
,
2446 .input_mux
= &alc880_lg_lw_capture_source
,
2447 .unsol_event
= alc880_lg_lw_unsol_event
,
2448 .init_hook
= alc880_lg_lw_automute
,
2450 #ifdef CONFIG_SND_DEBUG
2452 .mixers
= { alc880_test_mixer
},
2453 .init_verbs
= { alc880_test_init_verbs
},
2454 .num_dacs
= ARRAY_SIZE(alc880_test_dac_nids
),
2455 .dac_nids
= alc880_test_dac_nids
,
2456 .dig_out_nid
= ALC880_DIGOUT_NID
,
2457 .num_channel_mode
= ARRAY_SIZE(alc880_test_modes
),
2458 .channel_mode
= alc880_test_modes
,
2459 .input_mux
= &alc880_test_capture_source
,
2465 * Automatic parse of I/O pins from the BIOS configuration
2468 #define NUM_CONTROL_ALLOC 32
2469 #define NUM_VERB_ALLOC 32
2473 ALC_CTL_WIDGET_MUTE
,
2476 static struct snd_kcontrol_new alc880_control_templates
[] = {
2477 HDA_CODEC_VOLUME(NULL
, 0, 0, 0),
2478 HDA_CODEC_MUTE(NULL
, 0, 0, 0),
2479 HDA_BIND_MUTE(NULL
, 0, 0, 0),
2482 /* add dynamic controls */
2483 static int add_control(struct alc_spec
*spec
, int type
, const char *name
, unsigned long val
)
2485 struct snd_kcontrol_new
*knew
;
2487 if (spec
->num_kctl_used
>= spec
->num_kctl_alloc
) {
2488 int num
= spec
->num_kctl_alloc
+ NUM_CONTROL_ALLOC
;
2490 knew
= kcalloc(num
+ 1, sizeof(*knew
), GFP_KERNEL
); /* array + terminator */
2493 if (spec
->kctl_alloc
) {
2494 memcpy(knew
, spec
->kctl_alloc
, sizeof(*knew
) * spec
->num_kctl_alloc
);
2495 kfree(spec
->kctl_alloc
);
2497 spec
->kctl_alloc
= knew
;
2498 spec
->num_kctl_alloc
= num
;
2501 knew
= &spec
->kctl_alloc
[spec
->num_kctl_used
];
2502 *knew
= alc880_control_templates
[type
];
2503 knew
->name
= kstrdup(name
, GFP_KERNEL
);
2506 knew
->private_value
= val
;
2507 spec
->num_kctl_used
++;
2511 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
2512 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
2513 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
2514 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
2515 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
2516 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
2517 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
2518 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
2519 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
2520 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
2521 #define ALC880_PIN_CD_NID 0x1c
2523 /* fill in the dac_nids table from the parsed pin configuration */
2524 static int alc880_auto_fill_dac_nids(struct alc_spec
*spec
, const struct auto_pin_cfg
*cfg
)
2530 memset(assigned
, 0, sizeof(assigned
));
2531 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
2533 /* check the pins hardwired to audio widget */
2534 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2535 nid
= cfg
->line_out_pins
[i
];
2536 if (alc880_is_fixed_pin(nid
)) {
2537 int idx
= alc880_fixed_pin_idx(nid
);
2538 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(idx
);
2542 /* left pins can be connect to any audio widget */
2543 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2544 nid
= cfg
->line_out_pins
[i
];
2545 if (alc880_is_fixed_pin(nid
))
2547 /* search for an empty channel */
2548 for (j
= 0; j
< cfg
->line_outs
; j
++) {
2549 if (! assigned
[j
]) {
2550 spec
->multiout
.dac_nids
[i
] = alc880_idx_to_dac(j
);
2556 spec
->multiout
.num_dacs
= cfg
->line_outs
;
2560 /* add playback controls from the parsed DAC table */
2561 static int alc880_auto_create_multi_out_ctls(struct alc_spec
*spec
,
2562 const struct auto_pin_cfg
*cfg
)
2565 static const char *chname
[4] = { "Front", "Surround", NULL
/*CLFE*/, "Side" };
2569 for (i
= 0; i
< cfg
->line_outs
; i
++) {
2570 if (! spec
->multiout
.dac_nids
[i
])
2572 nid
= alc880_idx_to_mixer(alc880_dac_to_idx(spec
->multiout
.dac_nids
[i
]));
2575 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "Center Playback Volume",
2576 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
))) < 0)
2578 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "LFE Playback Volume",
2579 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
))) < 0)
2581 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, "Center Playback Switch",
2582 HDA_COMPOSE_AMP_VAL(nid
, 1, 2, HDA_INPUT
))) < 0)
2584 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, "LFE Playback Switch",
2585 HDA_COMPOSE_AMP_VAL(nid
, 2, 2, HDA_INPUT
))) < 0)
2588 sprintf(name
, "%s Playback Volume", chname
[i
]);
2589 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
2590 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
2592 sprintf(name
, "%s Playback Switch", chname
[i
]);
2593 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
2594 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
))) < 0)
2601 /* add playback controls for speaker and HP outputs */
2602 static int alc880_auto_create_extra_out(struct alc_spec
*spec
, hda_nid_t pin
,
2612 if (alc880_is_fixed_pin(pin
)) {
2613 nid
= alc880_idx_to_dac(alc880_fixed_pin_idx(pin
));
2614 /* specify the DAC as the extra output */
2615 if (! spec
->multiout
.hp_nid
)
2616 spec
->multiout
.hp_nid
= nid
;
2618 spec
->multiout
.extra_out_nid
[0] = nid
;
2619 /* control HP volume/switch on the output mixer amp */
2620 nid
= alc880_idx_to_mixer(alc880_fixed_pin_idx(pin
));
2621 sprintf(name
, "%s Playback Volume", pfx
);
2622 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
2623 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
2625 sprintf(name
, "%s Playback Switch", pfx
);
2626 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
2627 HDA_COMPOSE_AMP_VAL(nid
, 3, 2, HDA_INPUT
))) < 0)
2629 } else if (alc880_is_multi_pin(pin
)) {
2630 /* set manual connection */
2631 /* we have only a switch on HP-out PIN */
2632 sprintf(name
, "%s Playback Switch", pfx
);
2633 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
2634 HDA_COMPOSE_AMP_VAL(pin
, 3, 0, HDA_OUTPUT
))) < 0)
2640 /* create input playback/capture controls for the given pin */
2641 static int new_analog_input(struct alc_spec
*spec
, hda_nid_t pin
, const char *ctlname
,
2642 int idx
, hda_nid_t mix_nid
)
2647 sprintf(name
, "%s Playback Volume", ctlname
);
2648 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
,
2649 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
))) < 0)
2651 sprintf(name
, "%s Playback Switch", ctlname
);
2652 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
,
2653 HDA_COMPOSE_AMP_VAL(mix_nid
, 3, idx
, HDA_INPUT
))) < 0)
2658 /* create playback/capture controls for input pins */
2659 static int alc880_auto_create_analog_input_ctls(struct alc_spec
*spec
,
2660 const struct auto_pin_cfg
*cfg
)
2662 struct hda_input_mux
*imux
= &spec
->private_imux
;
2665 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
2666 if (alc880_is_input_pin(cfg
->input_pins
[i
])) {
2667 idx
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
2668 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
2669 auto_pin_cfg_labels
[i
],
2673 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
2674 imux
->items
[imux
->num_items
].index
= alc880_input_pin_idx(cfg
->input_pins
[i
]);
2681 static void alc880_auto_set_output_and_unmute(struct hda_codec
*codec
,
2682 hda_nid_t nid
, int pin_type
,
2686 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
2687 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
2688 /* need the manual connection? */
2689 if (alc880_is_multi_pin(nid
)) {
2690 struct alc_spec
*spec
= codec
->spec
;
2691 int idx
= alc880_multi_pin_idx(nid
);
2692 snd_hda_codec_write(codec
, alc880_idx_to_selector(idx
), 0,
2693 AC_VERB_SET_CONNECT_SEL
,
2694 alc880_dac_to_idx(spec
->multiout
.dac_nids
[dac_idx
]));
2698 static void alc880_auto_init_multi_out(struct hda_codec
*codec
)
2700 struct alc_spec
*spec
= codec
->spec
;
2703 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
2704 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
2705 alc880_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, i
);
2709 static void alc880_auto_init_extra_out(struct hda_codec
*codec
)
2711 struct alc_spec
*spec
= codec
->spec
;
2714 pin
= spec
->autocfg
.speaker_pins
[0];
2715 if (pin
) /* connect to front */
2716 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_OUT
, 0);
2717 pin
= spec
->autocfg
.hp_pin
;
2718 if (pin
) /* connect to front */
2719 alc880_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
2722 static void alc880_auto_init_analog_input(struct hda_codec
*codec
)
2724 struct alc_spec
*spec
= codec
->spec
;
2727 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
2728 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
2729 if (alc880_is_input_pin(nid
)) {
2730 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
2731 i
<= AUTO_PIN_FRONT_MIC
? PIN_VREF80
: PIN_IN
);
2732 if (nid
!= ALC880_PIN_CD_NID
)
2733 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
2739 /* parse the BIOS configuration and set up the alc_spec */
2740 /* return 1 if successful, 0 if the proper config is not found, or a negative error code */
2741 static int alc880_parse_auto_config(struct hda_codec
*codec
)
2743 struct alc_spec
*spec
= codec
->spec
;
2745 static hda_nid_t alc880_ignore
[] = { 0x1d, 0 };
2747 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
2748 alc880_ignore
)) < 0)
2750 if (! spec
->autocfg
.line_outs
)
2751 return 0; /* can't find valid BIOS pin config */
2753 if ((err
= alc880_auto_fill_dac_nids(spec
, &spec
->autocfg
)) < 0 ||
2754 (err
= alc880_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0 ||
2755 (err
= alc880_auto_create_extra_out(spec
,
2756 spec
->autocfg
.speaker_pins
[0],
2758 (err
= alc880_auto_create_extra_out(spec
, spec
->autocfg
.hp_pin
,
2759 "Headphone")) < 0 ||
2760 (err
= alc880_auto_create_analog_input_ctls(spec
, &spec
->autocfg
)) < 0)
2763 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
2765 if (spec
->autocfg
.dig_out_pin
)
2766 spec
->multiout
.dig_out_nid
= ALC880_DIGOUT_NID
;
2767 if (spec
->autocfg
.dig_in_pin
)
2768 spec
->dig_in_nid
= ALC880_DIGIN_NID
;
2770 if (spec
->kctl_alloc
)
2771 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
2773 spec
->init_verbs
[spec
->num_init_verbs
++] = alc880_volume_init_verbs
;
2775 spec
->num_mux_defs
= 1;
2776 spec
->input_mux
= &spec
->private_imux
;
2781 /* additional initialization for auto-configuration model */
2782 static void alc880_auto_init(struct hda_codec
*codec
)
2784 alc880_auto_init_multi_out(codec
);
2785 alc880_auto_init_extra_out(codec
);
2786 alc880_auto_init_analog_input(codec
);
2790 * OK, here we have finally the patch for ALC880
2793 static int patch_alc880(struct hda_codec
*codec
)
2795 struct alc_spec
*spec
;
2799 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
2805 board_config
= snd_hda_check_board_config(codec
, alc880_cfg_tbl
);
2806 if (board_config
< 0 || board_config
>= ALC880_MODEL_LAST
) {
2807 printk(KERN_INFO
"hda_codec: Unknown model for ALC880, "
2808 "trying auto-probe from BIOS...\n");
2809 board_config
= ALC880_AUTO
;
2812 if (board_config
== ALC880_AUTO
) {
2813 /* automatic parse from the BIOS config */
2814 err
= alc880_parse_auto_config(codec
);
2820 "hda_codec: Cannot set up configuration "
2821 "from BIOS. Using 3-stack mode...\n");
2822 board_config
= ALC880_3ST
;
2826 if (board_config
!= ALC880_AUTO
)
2827 setup_preset(spec
, &alc880_presets
[board_config
]);
2829 spec
->stream_name_analog
= "ALC880 Analog";
2830 spec
->stream_analog_playback
= &alc880_pcm_analog_playback
;
2831 spec
->stream_analog_capture
= &alc880_pcm_analog_capture
;
2833 spec
->stream_name_digital
= "ALC880 Digital";
2834 spec
->stream_digital_playback
= &alc880_pcm_digital_playback
;
2835 spec
->stream_digital_capture
= &alc880_pcm_digital_capture
;
2837 if (! spec
->adc_nids
&& spec
->input_mux
) {
2838 /* check whether NID 0x07 is valid */
2839 unsigned int wcap
= get_wcaps(codec
, alc880_adc_nids
[0]);
2840 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
2841 if (wcap
!= AC_WID_AUD_IN
) {
2842 spec
->adc_nids
= alc880_adc_nids_alt
;
2843 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids_alt
);
2844 spec
->mixers
[spec
->num_mixers
] = alc880_capture_alt_mixer
;
2847 spec
->adc_nids
= alc880_adc_nids
;
2848 spec
->num_adc_nids
= ARRAY_SIZE(alc880_adc_nids
);
2849 spec
->mixers
[spec
->num_mixers
] = alc880_capture_mixer
;
2854 codec
->patch_ops
= alc_patch_ops
;
2855 if (board_config
== ALC880_AUTO
)
2856 spec
->init_hook
= alc880_auto_init
;
2866 static hda_nid_t alc260_dac_nids
[1] = {
2871 static hda_nid_t alc260_adc_nids
[1] = {
2876 static hda_nid_t alc260_adc_nids_alt
[1] = {
2881 static hda_nid_t alc260_hp_adc_nids
[2] = {
2886 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
2887 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
2889 static hda_nid_t alc260_dual_adc_nids
[2] = {
2894 #define ALC260_DIGOUT_NID 0x03
2895 #define ALC260_DIGIN_NID 0x06
2897 static struct hda_input_mux alc260_capture_source
= {
2901 { "Front Mic", 0x1 },
2907 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
2908 * headphone jack and the internal CD lines since these are the only pins at
2909 * which audio can appear. For flexibility, also allow the option of
2910 * recording the mixer output on the second ADC (ADC0 doesn't have a
2911 * connection to the mixer output).
2913 static struct hda_input_mux alc260_fujitsu_capture_sources
[2] = {
2917 { "Mic/Line", 0x0 },
2919 { "Headphone", 0x2 },
2925 { "Mic/Line", 0x0 },
2927 { "Headphone", 0x2 },
2934 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
2935 * the Fujitsu S702x, but jacks are marked differently.
2937 static struct hda_input_mux alc260_acer_capture_sources
[2] = {
2944 { "Headphone", 0x5 },
2953 { "Headphone", 0x6 },
2959 * This is just place-holder, so there's something for alc_build_pcms to look
2960 * at when it calculates the maximum number of channels. ALC260 has no mixer
2961 * element which allows changing the channel mode, so the verb list is
2964 static struct hda_channel_mode alc260_modes
[1] = {
2969 /* Mixer combinations
2971 * basic: base_output + input + pc_beep + capture
2972 * HP: base_output + input + capture_alt
2973 * HP_3013: hp_3013 + input + capture
2974 * fujitsu: fujitsu + capture
2975 * acer: acer + capture
2978 static struct snd_kcontrol_new alc260_base_output_mixer
[] = {
2979 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
2980 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT
),
2981 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
2982 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT
),
2983 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
2984 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
2988 static struct snd_kcontrol_new alc260_input_mixer
[] = {
2989 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
2990 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
2991 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
2992 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
2993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
2994 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
2995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT
),
2996 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT
),
3000 static struct snd_kcontrol_new alc260_pc_beep_mixer
[] = {
3001 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT
),
3002 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT
),
3006 static struct snd_kcontrol_new alc260_hp_3013_mixer
[] = {
3007 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3008 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT
),
3009 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT
),
3010 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT
),
3011 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3012 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
3013 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3014 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT
),
3018 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
3019 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
3021 static struct snd_kcontrol_new alc260_fujitsu_mixer
[] = {
3022 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3023 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT
),
3024 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3025 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3026 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3027 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT
),
3028 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT
),
3029 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3030 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3031 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3032 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3033 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT
),
3037 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
3038 * versions of the ALC260 don't act on requests to enable mic bias from NID
3039 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
3040 * datasheet doesn't mention this restriction. At this stage it's not clear
3041 * whether this behaviour is intentional or is a hardware bug in chip
3042 * revisions available in early 2006. Therefore for now allow the
3043 * "Headphone Jack Mode" control to span all choices, but if it turns out
3044 * that the lack of mic bias for this NID is intentional we could change the
3045 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3047 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
3048 * don't appear to make the mic bias available from the "line" jack, even
3049 * though the NID used for this jack (0x14) can supply it. The theory is
3050 * that perhaps Acer have included blocking capacitors between the ALC260
3051 * and the output jack. If this turns out to be the case for all such
3052 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
3053 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
3055 static struct snd_kcontrol_new alc260_acer_mixer
[] = {
3056 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3057 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT
),
3058 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT
),
3059 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3060 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3061 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT
),
3062 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT
),
3063 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN
),
3064 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT
),
3065 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT
),
3066 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT
),
3067 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3068 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3072 /* capture mixer elements */
3073 static struct snd_kcontrol_new alc260_capture_mixer
[] = {
3074 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT
),
3075 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT
),
3076 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT
),
3077 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT
),
3079 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3080 /* The multiple "Capture Source" controls confuse alsamixer
3081 * So call somewhat different..
3082 * FIXME: the controls appear in the "playback" view!
3084 /* .name = "Capture Source", */
3085 .name
= "Input Source",
3087 .info
= alc_mux_enum_info
,
3088 .get
= alc_mux_enum_get
,
3089 .put
= alc_mux_enum_put
,
3094 static struct snd_kcontrol_new alc260_capture_alt_mixer
[] = {
3095 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT
),
3096 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT
),
3098 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
3099 /* The multiple "Capture Source" controls confuse alsamixer
3100 * So call somewhat different..
3101 * FIXME: the controls appear in the "playback" view!
3103 /* .name = "Capture Source", */
3104 .name
= "Input Source",
3106 .info
= alc_mux_enum_info
,
3107 .get
= alc_mux_enum_get
,
3108 .put
= alc_mux_enum_put
,
3114 * initialization verbs
3116 static struct hda_verb alc260_init_verbs
[] = {
3117 /* Line In pin widget for input */
3118 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3119 /* CD pin widget for input */
3120 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3121 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3122 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3123 /* Mic2 (front panel) pin widget for input and vref at 80% */
3124 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
3125 /* LINE-2 is used for line-out in rear */
3126 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3127 /* select line-out */
3128 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00},
3130 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3132 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3134 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3135 /* mute capture amp left and right */
3136 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3137 /* set connection select to line in (default select for this ADC) */
3138 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3139 /* mute capture amp left and right */
3140 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3141 /* set connection select to line in (default select for this ADC) */
3142 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x02},
3143 /* set vol=0 Line-Out mixer amp left and right */
3144 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3145 /* unmute pin widget amp left and right (no gain on this amp) */
3146 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3147 /* set vol=0 HP mixer amp left and right */
3148 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3149 /* unmute pin widget amp left and right (no gain on this amp) */
3150 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3151 /* set vol=0 Mono mixer amp left and right */
3152 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3153 /* unmute pin widget amp left and right (no gain on this amp) */
3154 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3155 /* unmute LINE-2 out pin */
3156 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3157 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */
3159 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
3161 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
3163 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3164 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3165 /* mute Front out path */
3166 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3167 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3168 /* mute Headphone out path */
3169 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3170 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3171 /* mute Mono out path */
3172 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3173 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3177 #if 0 /* should be identical with alc260_init_verbs? */
3178 static struct hda_verb alc260_hp_init_verbs
[] = {
3179 /* Headphone and output */
3180 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
3182 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3183 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3184 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3185 /* Mic2 (front panel) pin widget for input and vref at 80% */
3186 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3187 /* Line In pin widget for input */
3188 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3189 /* Line-2 pin widget for output */
3190 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3191 /* CD pin widget for input */
3192 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3193 /* unmute amp left and right */
3194 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
3195 /* set connection select to line in (default select for this ADC) */
3196 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3197 /* unmute Line-Out mixer amp left and right (volume = 0) */
3198 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3199 /* mute pin widget amp left and right (no gain on this amp) */
3200 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3201 /* unmute HP mixer amp left and right (volume = 0) */
3202 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3203 /* mute pin widget amp left and right (no gain on this amp) */
3204 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3205 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */
3207 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
3208 /* unmute Line In */
3209 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
3211 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3212 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3213 /* Unmute Front out path */
3214 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3215 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3216 /* Unmute Headphone out path */
3217 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3218 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3219 /* Unmute Mono out path */
3220 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3221 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3226 static struct hda_verb alc260_hp_3013_init_verbs
[] = {
3227 /* Line out and output */
3228 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3230 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
3231 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3232 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3233 /* Mic2 (front panel) pin widget for input and vref at 80% */
3234 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
3235 /* Line In pin widget for input */
3236 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3237 /* Headphone pin widget for output */
3238 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
3239 /* CD pin widget for input */
3240 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
3241 /* unmute amp left and right */
3242 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000},
3243 /* set connection select to line in (default select for this ADC) */
3244 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x02},
3245 /* unmute Line-Out mixer amp left and right (volume = 0) */
3246 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3247 /* mute pin widget amp left and right (no gain on this amp) */
3248 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3249 /* unmute HP mixer amp left and right (volume = 0) */
3250 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb000},
3251 /* mute pin widget amp left and right (no gain on this amp) */
3252 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
3253 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */
3255 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
3256 /* unmute Line In */
3257 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
3259 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3260 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
3261 /* Unmute Front out path */
3262 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3263 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3264 /* Unmute Headphone out path */
3265 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3266 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3267 /* Unmute Mono out path */
3268 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
3269 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8))},
3273 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
3274 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
3275 * audio = 0x16, internal speaker = 0x10.
3277 static struct hda_verb alc260_fujitsu_init_verbs
[] = {
3278 /* Disable all GPIOs */
3279 {0x01, AC_VERB_SET_GPIO_MASK
, 0},
3280 /* Internal speaker is connected to headphone pin */
3281 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3282 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
3283 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3284 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
3285 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3286 /* Ensure all other unused pins are disabled and muted. */
3287 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3288 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3289 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3290 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3291 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3292 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3294 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3296 /* Disable digital (SPDIF) pins */
3297 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3298 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3300 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
3301 * when acting as an output.
3303 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
3305 /* Start with output sum widgets muted and their output gains at min */
3306 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3307 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3308 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3309 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3310 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3311 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3312 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3313 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3314 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3316 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
3317 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3318 /* Unmute Line1 pin widget output buffer since it starts as an output.
3319 * If the pin mode is changed by the user the pin mode control will
3320 * take care of enabling the pin's input/output buffers as needed.
3321 * Therefore there's no need to enable the input buffer at this
3324 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3325 /* Unmute input buffer of pin widget used for Line-in (no equiv
3328 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3330 /* Mute capture amp left and right */
3331 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3332 /* Set ADC connection select to match default mixer setting - line
3335 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
3337 /* Do the same for the second ADC: mute capture input amp and
3338 * set ADC connection to line in (on mic1 pin)
3340 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3341 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
3343 /* Mute all inputs to mixer widget (even unconnected ones) */
3344 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
3345 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
3346 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
3347 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
3348 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
3349 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3350 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
3351 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
3356 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
3357 * similar laptops (adapted from Fujitsu init verbs).
3359 static struct hda_verb alc260_acer_init_verbs
[] = {
3360 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
3361 * the headphone jack. Turn this on and rely on the standard mute
3362 * methods whenever the user wants to turn these outputs off.
3364 {0x01, AC_VERB_SET_GPIO_MASK
, 0x01},
3365 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x01},
3366 {0x01, AC_VERB_SET_GPIO_DATA
, 0x01},
3367 /* Internal speaker/Headphone jack is connected to Line-out pin */
3368 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
3369 /* Internal microphone/Mic jack is connected to Mic1 pin */
3370 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF50
},
3371 /* Line In jack is connected to Line1 pin */
3372 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
3373 /* Ensure all other unused pins are disabled and muted. */
3374 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3375 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3376 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3377 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3378 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3379 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3380 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0},
3381 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3382 /* Disable digital (SPDIF) pins */
3383 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3384 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3386 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
3387 * bus when acting as outputs.
3389 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
3390 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
3392 /* Start with output sum widgets muted and their output gains at min */
3393 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3394 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3395 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3396 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3397 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3398 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3399 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3400 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3401 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3403 /* Unmute Line-out pin widget amp left and right (no equiv mixer ctrl) */
3404 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3405 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
3406 * inputs. If the pin mode is changed by the user the pin mode control
3407 * will take care of enabling the pin's input/output buffers as needed.
3408 * Therefore there's no need to enable the input buffer at this
3411 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3412 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3414 /* Mute capture amp left and right */
3415 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3416 /* Set ADC connection select to match default mixer setting - mic
3419 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
3421 /* Do similar with the second ADC: mute capture input amp and
3422 * set ADC connection to mic to match ALSA's default state.
3424 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3425 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
3427 /* Mute all inputs to mixer widget (even unconnected ones) */
3428 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
3429 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
3430 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
3431 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
3432 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
3433 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3434 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
3435 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
3440 /* Test configuration for debugging, modelled after the ALC880 test
3443 #ifdef CONFIG_SND_DEBUG
3444 static hda_nid_t alc260_test_dac_nids
[1] = {
3447 static hda_nid_t alc260_test_adc_nids
[2] = {
3450 /* For testing the ALC260, each input MUX needs its own definition since
3451 * the signal assignments are different. This assumes that the first ADC
3454 static struct hda_input_mux alc260_test_capture_sources
[2] = {
3458 { "MIC1 pin", 0x0 },
3459 { "MIC2 pin", 0x1 },
3460 { "LINE1 pin", 0x2 },
3461 { "LINE2 pin", 0x3 },
3463 { "LINE-OUT pin", 0x5 },
3464 { "HP-OUT pin", 0x6 },
3470 { "MIC1 pin", 0x0 },
3471 { "MIC2 pin", 0x1 },
3472 { "LINE1 pin", 0x2 },
3473 { "LINE2 pin", 0x3 },
3476 { "LINE-OUT pin", 0x6 },
3477 { "HP-OUT pin", 0x7 },
3481 static struct snd_kcontrol_new alc260_test_mixer
[] = {
3482 /* Output driver widgets */
3483 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT
),
3484 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT
),
3485 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT
),
3486 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT
),
3487 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT
),
3488 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT
),
3490 /* Modes for retasking pin widgets
3491 * Note: the ALC260 doesn't seem to act on requests to enable mic
3492 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
3493 * mention this restriction. At this stage it's not clear whether
3494 * this behaviour is intentional or is a hardware bug in chip
3495 * revisions available at least up until early 2006. Therefore for
3496 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
3497 * choices, but if it turns out that the lack of mic bias for these
3498 * NIDs is intentional we could change their modes from
3499 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
3501 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT
),
3502 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT
),
3503 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT
),
3504 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT
),
3505 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT
),
3506 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT
),
3508 /* Loopback mixer controls */
3509 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT
),
3510 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT
),
3511 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT
),
3512 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT
),
3513 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT
),
3514 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT
),
3515 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT
),
3516 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT
),
3517 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT
),
3518 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT
),
3519 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT
),
3520 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT
),
3521 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT
),
3522 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT
),
3523 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT
),
3524 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT
),
3526 /* Controls for GPIO pins, assuming they are configured as outputs */
3527 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
3528 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
3529 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
3530 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
3532 /* Switches to allow the digital IO pins to be enabled. The datasheet
3533 * is ambigious as to which NID is which; testing on laptops which
3534 * make this output available should provide clarification.
3536 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
3537 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
3541 static struct hda_verb alc260_test_init_verbs
[] = {
3542 /* Enable all GPIOs as outputs with an initial value of 0 */
3543 {0x01, AC_VERB_SET_GPIO_DIRECTION
, 0x0f},
3544 {0x01, AC_VERB_SET_GPIO_DATA
, 0x00},
3545 {0x01, AC_VERB_SET_GPIO_MASK
, 0x0f},
3547 /* Enable retasking pins as output, initially without power amp */
3548 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3549 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3550 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3551 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3552 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3553 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
3555 /* Disable digital (SPDIF) pins initially, but users can enable
3556 * them via a mixer switch. In the case of SPDIF-out, this initverb
3557 * payload also sets the generation to 0, output to be in "consumer"
3558 * PCM format, copyright asserted, no pre-emphasis and no validity
3561 {0x03, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3562 {0x06, AC_VERB_SET_DIGI_CONVERT_1
, 0},
3564 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
3565 * OUT1 sum bus when acting as an output.
3567 {0x0b, AC_VERB_SET_CONNECT_SEL
, 0},
3568 {0x0c, AC_VERB_SET_CONNECT_SEL
, 0},
3569 {0x0d, AC_VERB_SET_CONNECT_SEL
, 0},
3570 {0x0e, AC_VERB_SET_CONNECT_SEL
, 0},
3572 /* Start with output sum widgets muted and their output gains at min */
3573 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3574 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3575 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3576 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3577 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3578 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3579 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3580 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
3581 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3583 /* Unmute retasking pin widget output buffers since the default
3584 * state appears to be output. As the pin mode is changed by the
3585 * user the pin mode control will take care of enabling the pin's
3586 * input/output buffers as needed.
3588 {0x10, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3589 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3590 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3591 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3592 {0x13, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3593 {0x12, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3594 /* Also unmute the mono-out pin widget */
3595 {0x11, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
3597 /* Mute capture amp left and right */
3598 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3599 /* Set ADC connection select to match default mixer setting (mic1
3602 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
3604 /* Do the same for the second ADC: mute capture input amp and
3605 * set ADC connection to mic1 pin
3607 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
3608 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
3610 /* Mute all inputs to mixer widget (even unconnected ones) */
3611 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)}, /* mic1 pin */
3612 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)}, /* mic2 pin */
3613 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)}, /* line1 pin */
3614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)}, /* line2 pin */
3615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)}, /* CD pin */
3616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(5)}, /* Beep-gen pin */
3617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(6)}, /* Line-out pin */
3618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(7)}, /* HP-pin pin */
3624 static struct hda_pcm_stream alc260_pcm_analog_playback
= {
3630 static struct hda_pcm_stream alc260_pcm_analog_capture
= {
3636 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
3637 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
3640 * for BIOS auto-configuration
3643 static int alc260_add_playback_controls(struct alc_spec
*spec
, hda_nid_t nid
,
3647 unsigned long vol_val
, sw_val
;
3651 if (nid
>= 0x0f && nid
< 0x11) {
3652 nid_vol
= nid
- 0x7;
3653 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
3654 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
3655 } else if (nid
== 0x11) {
3656 nid_vol
= nid
- 0x7;
3657 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 2, 0, HDA_OUTPUT
);
3658 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
);
3659 } else if (nid
>= 0x12 && nid
<= 0x15) {
3661 vol_val
= HDA_COMPOSE_AMP_VAL(nid_vol
, 3, 0, HDA_OUTPUT
);
3662 sw_val
= HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
);
3666 snprintf(name
, sizeof(name
), "%s Playback Volume", pfx
);
3667 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, name
, vol_val
)) < 0)
3669 snprintf(name
, sizeof(name
), "%s Playback Switch", pfx
);
3670 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, name
, sw_val
)) < 0)
3675 /* add playback controls from the parsed DAC table */
3676 static int alc260_auto_create_multi_out_ctls(struct alc_spec
*spec
,
3677 const struct auto_pin_cfg
*cfg
)
3682 spec
->multiout
.num_dacs
= 1;
3683 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
3684 spec
->multiout
.dac_nids
[0] = 0x02;
3686 nid
= cfg
->line_out_pins
[0];
3688 err
= alc260_add_playback_controls(spec
, nid
, "Front");
3693 nid
= cfg
->speaker_pins
[0];
3695 err
= alc260_add_playback_controls(spec
, nid
, "Speaker");
3702 err
= alc260_add_playback_controls(spec
, nid
, "Headphone");
3709 /* create playback/capture controls for input pins */
3710 static int alc260_auto_create_analog_input_ctls(struct alc_spec
*spec
,
3711 const struct auto_pin_cfg
*cfg
)
3713 struct hda_input_mux
*imux
= &spec
->private_imux
;
3716 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3717 if (cfg
->input_pins
[i
] >= 0x12) {
3718 idx
= cfg
->input_pins
[i
] - 0x12;
3719 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
3720 auto_pin_cfg_labels
[i
], idx
, 0x07);
3723 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
3724 imux
->items
[imux
->num_items
].index
= idx
;
3727 if ((cfg
->input_pins
[i
] >= 0x0f) && (cfg
->input_pins
[i
] <= 0x10)){
3728 idx
= cfg
->input_pins
[i
] - 0x09;
3729 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
3730 auto_pin_cfg_labels
[i
], idx
, 0x07);
3733 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
3734 imux
->items
[imux
->num_items
].index
= idx
;
3741 static void alc260_auto_set_output_and_unmute(struct hda_codec
*codec
,
3742 hda_nid_t nid
, int pin_type
,
3746 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
3747 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
3748 /* need the manual connection? */
3750 int idx
= nid
- 0x12;
3751 snd_hda_codec_write(codec
, idx
+ 0x0b, 0,
3752 AC_VERB_SET_CONNECT_SEL
, sel_idx
);
3757 static void alc260_auto_init_multi_out(struct hda_codec
*codec
)
3759 struct alc_spec
*spec
= codec
->spec
;
3762 nid
= spec
->autocfg
.line_out_pins
[0];
3764 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
3766 nid
= spec
->autocfg
.speaker_pins
[0];
3768 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
3770 nid
= spec
->autocfg
.hp_pin
;
3772 alc260_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, 0);
3775 #define ALC260_PIN_CD_NID 0x16
3776 static void alc260_auto_init_analog_input(struct hda_codec
*codec
)
3778 struct alc_spec
*spec
= codec
->spec
;
3781 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
3782 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
3784 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
3785 i
<= AUTO_PIN_FRONT_MIC
? PIN_VREF80
: PIN_IN
);
3786 if (nid
!= ALC260_PIN_CD_NID
)
3787 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
3794 * generic initialization of ADC, input mixers and output mixers
3796 static struct hda_verb alc260_volume_init_verbs
[] = {
3798 * Unmute ADC0-1 and set the default input to mic-in
3800 {0x04, AC_VERB_SET_CONNECT_SEL
, 0x00},
3801 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3802 {0x05, AC_VERB_SET_CONNECT_SEL
, 0x00},
3803 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3805 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3807 * Note: PASD motherboards uses the Line In 2 as the input for front panel
3810 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3811 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3812 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3813 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
3814 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
3815 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
3818 * Set up output mixers (0x08 - 0x0a)
3820 /* set vol=0 to output mixers */
3821 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3822 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3823 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
3824 /* set up input amps for analog loopback */
3825 /* Amp Indices: DAC = 0, mixer = 1 */
3826 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3827 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3828 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3829 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3830 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
3831 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
3836 static int alc260_parse_auto_config(struct hda_codec
*codec
)
3838 struct alc_spec
*spec
= codec
->spec
;
3841 static hda_nid_t alc260_ignore
[] = { 0x17, 0 };
3843 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
3844 alc260_ignore
)) < 0)
3846 if ((err
= alc260_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0)
3848 if (! spec
->kctl_alloc
)
3849 return 0; /* can't find valid BIOS pin config */
3850 if ((err
= alc260_auto_create_analog_input_ctls(spec
, &spec
->autocfg
)) < 0)
3853 spec
->multiout
.max_channels
= 2;
3855 if (spec
->autocfg
.dig_out_pin
)
3856 spec
->multiout
.dig_out_nid
= ALC260_DIGOUT_NID
;
3857 if (spec
->kctl_alloc
)
3858 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
3860 spec
->init_verbs
[spec
->num_init_verbs
++] = alc260_volume_init_verbs
;
3862 spec
->num_mux_defs
= 1;
3863 spec
->input_mux
= &spec
->private_imux
;
3865 /* check whether NID 0x04 is valid */
3866 wcap
= get_wcaps(codec
, 0x04);
3867 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
3868 if (wcap
!= AC_WID_AUD_IN
) {
3869 spec
->adc_nids
= alc260_adc_nids_alt
;
3870 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids_alt
);
3871 spec
->mixers
[spec
->num_mixers
] = alc260_capture_alt_mixer
;
3873 spec
->adc_nids
= alc260_adc_nids
;
3874 spec
->num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
);
3875 spec
->mixers
[spec
->num_mixers
] = alc260_capture_mixer
;
3882 /* additional initialization for auto-configuration model */
3883 static void alc260_auto_init(struct hda_codec
*codec
)
3885 alc260_auto_init_multi_out(codec
);
3886 alc260_auto_init_analog_input(codec
);
3890 * ALC260 configurations
3892 static struct hda_board_config alc260_cfg_tbl
[] = {
3893 { .modelname
= "basic", .config
= ALC260_BASIC
},
3894 { .pci_subvendor
= 0x104d, .pci_subdevice
= 0x81bb,
3895 .config
= ALC260_BASIC
}, /* Sony VAIO */
3896 { .pci_subvendor
= 0x104d, .pci_subdevice
= 0x81cc,
3897 .config
= ALC260_BASIC
}, /* Sony VAIO VGN-S3HP */
3898 { .pci_subvendor
= 0x104d, .pci_subdevice
= 0x81cd,
3899 .config
= ALC260_BASIC
}, /* Sony VAIO */
3900 { .pci_subvendor
= 0x152d, .pci_subdevice
= 0x0729,
3901 .config
= ALC260_BASIC
}, /* CTL Travel Master U553W */
3902 { .modelname
= "hp", .config
= ALC260_HP
},
3903 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3010, .config
= ALC260_HP
},
3904 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3011, .config
= ALC260_HP
},
3905 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3012, .config
= ALC260_HP_3013
},
3906 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3013, .config
= ALC260_HP_3013
},
3907 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3014, .config
= ALC260_HP
},
3908 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3015, .config
= ALC260_HP
},
3909 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3016, .config
= ALC260_HP
},
3910 { .modelname
= "fujitsu", .config
= ALC260_FUJITSU_S702X
},
3911 { .pci_subvendor
= 0x10cf, .pci_subdevice
= 0x1326, .config
= ALC260_FUJITSU_S702X
},
3912 { .modelname
= "acer", .config
= ALC260_ACER
},
3913 { .pci_subvendor
= 0x1025, .pci_subdevice
= 0x008f, .config
= ALC260_ACER
},
3914 #ifdef CONFIG_SND_DEBUG
3915 { .modelname
= "test", .config
= ALC260_TEST
},
3917 { .modelname
= "auto", .config
= ALC260_AUTO
},
3921 static struct alc_config_preset alc260_presets
[] = {
3923 .mixers
= { alc260_base_output_mixer
,
3925 alc260_pc_beep_mixer
,
3926 alc260_capture_mixer
},
3927 .init_verbs
= { alc260_init_verbs
},
3928 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
3929 .dac_nids
= alc260_dac_nids
,
3930 .num_adc_nids
= ARRAY_SIZE(alc260_adc_nids
),
3931 .adc_nids
= alc260_adc_nids
,
3932 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
3933 .channel_mode
= alc260_modes
,
3934 .input_mux
= &alc260_capture_source
,
3937 .mixers
= { alc260_base_output_mixer
,
3939 alc260_capture_alt_mixer
},
3940 .init_verbs
= { alc260_init_verbs
},
3941 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
3942 .dac_nids
= alc260_dac_nids
,
3943 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
3944 .adc_nids
= alc260_hp_adc_nids
,
3945 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
3946 .channel_mode
= alc260_modes
,
3947 .input_mux
= &alc260_capture_source
,
3949 [ALC260_HP_3013
] = {
3950 .mixers
= { alc260_hp_3013_mixer
,
3952 alc260_capture_alt_mixer
},
3953 .init_verbs
= { alc260_hp_3013_init_verbs
},
3954 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
3955 .dac_nids
= alc260_dac_nids
,
3956 .num_adc_nids
= ARRAY_SIZE(alc260_hp_adc_nids
),
3957 .adc_nids
= alc260_hp_adc_nids
,
3958 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
3959 .channel_mode
= alc260_modes
,
3960 .input_mux
= &alc260_capture_source
,
3962 [ALC260_FUJITSU_S702X
] = {
3963 .mixers
= { alc260_fujitsu_mixer
,
3964 alc260_capture_mixer
},
3965 .init_verbs
= { alc260_fujitsu_init_verbs
},
3966 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
3967 .dac_nids
= alc260_dac_nids
,
3968 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
3969 .adc_nids
= alc260_dual_adc_nids
,
3970 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
3971 .channel_mode
= alc260_modes
,
3972 .num_mux_defs
= ARRAY_SIZE(alc260_fujitsu_capture_sources
),
3973 .input_mux
= alc260_fujitsu_capture_sources
,
3976 .mixers
= { alc260_acer_mixer
,
3977 alc260_capture_mixer
},
3978 .init_verbs
= { alc260_acer_init_verbs
},
3979 .num_dacs
= ARRAY_SIZE(alc260_dac_nids
),
3980 .dac_nids
= alc260_dac_nids
,
3981 .num_adc_nids
= ARRAY_SIZE(alc260_dual_adc_nids
),
3982 .adc_nids
= alc260_dual_adc_nids
,
3983 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
3984 .channel_mode
= alc260_modes
,
3985 .num_mux_defs
= ARRAY_SIZE(alc260_acer_capture_sources
),
3986 .input_mux
= alc260_acer_capture_sources
,
3988 #ifdef CONFIG_SND_DEBUG
3990 .mixers
= { alc260_test_mixer
,
3991 alc260_capture_mixer
},
3992 .init_verbs
= { alc260_test_init_verbs
},
3993 .num_dacs
= ARRAY_SIZE(alc260_test_dac_nids
),
3994 .dac_nids
= alc260_test_dac_nids
,
3995 .num_adc_nids
= ARRAY_SIZE(alc260_test_adc_nids
),
3996 .adc_nids
= alc260_test_adc_nids
,
3997 .num_channel_mode
= ARRAY_SIZE(alc260_modes
),
3998 .channel_mode
= alc260_modes
,
3999 .num_mux_defs
= ARRAY_SIZE(alc260_test_capture_sources
),
4000 .input_mux
= alc260_test_capture_sources
,
4005 static int patch_alc260(struct hda_codec
*codec
)
4007 struct alc_spec
*spec
;
4008 int err
, board_config
;
4010 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4016 board_config
= snd_hda_check_board_config(codec
, alc260_cfg_tbl
);
4017 if (board_config
< 0 || board_config
>= ALC260_MODEL_LAST
) {
4018 snd_printd(KERN_INFO
"hda_codec: Unknown model for ALC260, "
4019 "trying auto-probe from BIOS...\n");
4020 board_config
= ALC260_AUTO
;
4023 if (board_config
== ALC260_AUTO
) {
4024 /* automatic parse from the BIOS config */
4025 err
= alc260_parse_auto_config(codec
);
4031 "hda_codec: Cannot set up configuration "
4032 "from BIOS. Using base mode...\n");
4033 board_config
= ALC260_BASIC
;
4037 if (board_config
!= ALC260_AUTO
)
4038 setup_preset(spec
, &alc260_presets
[board_config
]);
4040 spec
->stream_name_analog
= "ALC260 Analog";
4041 spec
->stream_analog_playback
= &alc260_pcm_analog_playback
;
4042 spec
->stream_analog_capture
= &alc260_pcm_analog_capture
;
4044 spec
->stream_name_digital
= "ALC260 Digital";
4045 spec
->stream_digital_playback
= &alc260_pcm_digital_playback
;
4046 spec
->stream_digital_capture
= &alc260_pcm_digital_capture
;
4048 codec
->patch_ops
= alc_patch_ops
;
4049 if (board_config
== ALC260_AUTO
)
4050 spec
->init_hook
= alc260_auto_init
;
4059 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
4060 * configuration. Each pin widget can choose any input DACs and a mixer.
4061 * Each ADC is connected from a mixer of all inputs. This makes possible
4062 * 6-channel independent captures.
4064 * In addition, an independent DAC for the multi-playback (not used in this
4067 #define ALC882_DIGOUT_NID 0x06
4068 #define ALC882_DIGIN_NID 0x0a
4070 static struct hda_channel_mode alc882_ch_modes
[1] = {
4074 static hda_nid_t alc882_dac_nids
[4] = {
4075 /* front, rear, clfe, rear_surr */
4076 0x02, 0x03, 0x04, 0x05
4079 /* identical with ALC880 */
4080 #define alc882_adc_nids alc880_adc_nids
4081 #define alc882_adc_nids_alt alc880_adc_nids_alt
4084 /* FIXME: should be a matrix-type input source selection */
4086 static struct hda_input_mux alc882_capture_source
= {
4090 { "Front Mic", 0x1 },
4095 #define alc882_mux_enum_info alc_mux_enum_info
4096 #define alc882_mux_enum_get alc_mux_enum_get
4098 static int alc882_mux_enum_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
4100 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4101 struct alc_spec
*spec
= codec
->spec
;
4102 const struct hda_input_mux
*imux
= spec
->input_mux
;
4103 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
4104 static hda_nid_t capture_mixers
[3] = { 0x24, 0x23, 0x22 };
4105 hda_nid_t nid
= capture_mixers
[adc_idx
];
4106 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
4107 unsigned int i
, idx
;
4109 idx
= ucontrol
->value
.enumerated
.item
[0];
4110 if (idx
>= imux
->num_items
)
4111 idx
= imux
->num_items
- 1;
4112 if (*cur_val
== idx
&& ! codec
->in_resume
)
4114 for (i
= 0; i
< imux
->num_items
; i
++) {
4115 unsigned int v
= (i
== idx
) ? 0x7000 : 0x7080;
4116 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4117 v
| (imux
->items
[i
].index
<< 8));
4126 static struct hda_verb alc882_sixstack_ch6_init
[] = {
4127 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
4128 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4129 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4130 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4137 static struct hda_verb alc882_sixstack_ch8_init
[] = {
4138 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4139 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4140 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4141 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4145 static struct hda_channel_mode alc882_sixstack_modes
[2] = {
4146 { 6, alc882_sixstack_ch6_init
},
4147 { 8, alc882_sixstack_ch8_init
},
4150 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
4151 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
4153 static struct snd_kcontrol_new alc882_base_mixer
[] = {
4154 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4155 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4156 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
4157 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
4158 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
4159 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
4160 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
4161 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
4162 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
4163 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
4164 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
4165 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
4166 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
4167 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
4168 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
4169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4170 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4171 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4172 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4173 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
4174 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
4178 static struct snd_kcontrol_new alc882_chmode_mixer
[] = {
4180 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4181 .name
= "Channel Mode",
4182 .info
= alc_ch_mode_info
,
4183 .get
= alc_ch_mode_get
,
4184 .put
= alc_ch_mode_put
,
4189 static struct hda_verb alc882_init_verbs
[] = {
4190 /* Front mixer: unmute input/output amp left and right (volume = 0) */
4191 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4192 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4193 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4195 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4196 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4197 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4199 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4200 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4201 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4203 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4204 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4205 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4207 /* Front Pin: output 0 (0x0c) */
4208 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4209 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4210 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
4211 /* Rear Pin: output 1 (0x0d) */
4212 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4213 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4214 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
4215 /* CLFE Pin: output 2 (0x0e) */
4216 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4217 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4218 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
4219 /* Side Pin: output 3 (0x0f) */
4220 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4221 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4222 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
4223 /* Mic (rear) pin: input vref at 80% */
4224 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4225 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4226 /* Front Mic pin: input vref at 80% */
4227 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4228 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4229 /* Line In pin: input */
4230 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4231 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4232 /* Line-2 In: Headphone output (output 0 - 0x0c) */
4233 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4234 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4235 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
4236 /* CD pin widget for input */
4237 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4239 /* FIXME: use matrix-type input source selection */
4240 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
4241 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
4242 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4243 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4244 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4245 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4247 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4248 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4249 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4250 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4252 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4253 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(3)},
4254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(2)},
4255 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(4)},
4256 /* ADC1: mute amp left and right */
4257 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4258 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4259 /* ADC2: mute amp left and right */
4260 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4261 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4262 /* ADC3: mute amp left and right */
4263 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4264 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4270 * generic initialization of ADC, input mixers and output mixers
4272 static struct hda_verb alc882_auto_init_verbs
[] = {
4274 * Unmute ADC0-2 and set the default input to mic-in
4276 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
4277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4278 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4279 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4280 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4281 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4283 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4285 * Note: PASD motherboards uses the Line In 2 as the input for front panel
4288 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4291 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
4292 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
4293 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
4296 * Set up output mixers (0x0c - 0x0f)
4298 /* set vol=0 to output mixers */
4299 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4300 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4301 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4302 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4303 /* set up input amps for analog loopback */
4304 /* Amp Indices: DAC = 0, mixer = 1 */
4305 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4307 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4308 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4309 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4310 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4311 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4312 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4313 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4314 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4316 /* FIXME: use matrix-type input source selection */
4317 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
4318 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
4319 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4320 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
4321 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
4322 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
4324 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4325 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
4326 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
4327 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
4329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
4330 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
4331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
4332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
4337 /* capture mixer elements */
4338 static struct snd_kcontrol_new alc882_capture_alt_mixer
[] = {
4339 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
4340 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
4341 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
4342 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
4344 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4345 /* The multiple "Capture Source" controls confuse alsamixer
4346 * So call somewhat different..
4347 * FIXME: the controls appear in the "playback" view!
4349 /* .name = "Capture Source", */
4350 .name
= "Input Source",
4352 .info
= alc882_mux_enum_info
,
4353 .get
= alc882_mux_enum_get
,
4354 .put
= alc882_mux_enum_put
,
4359 static struct snd_kcontrol_new alc882_capture_mixer
[] = {
4360 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT
),
4361 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT
),
4362 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT
),
4363 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT
),
4364 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT
),
4365 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT
),
4367 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4368 /* The multiple "Capture Source" controls confuse alsamixer
4369 * So call somewhat different..
4370 * FIXME: the controls appear in the "playback" view!
4372 /* .name = "Capture Source", */
4373 .name
= "Input Source",
4375 .info
= alc882_mux_enum_info
,
4376 .get
= alc882_mux_enum_get
,
4377 .put
= alc882_mux_enum_put
,
4382 /* pcm configuration: identiacal with ALC880 */
4383 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
4384 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
4385 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
4386 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
4389 * configuration and preset
4391 static struct hda_board_config alc882_cfg_tbl
[] = {
4392 { .modelname
= "3stack-dig", .config
= ALC882_3ST_DIG
},
4393 { .modelname
= "6stack-dig", .config
= ALC882_6ST_DIG
},
4394 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x6668,
4395 .config
= ALC882_6ST_DIG
}, /* MSI */
4396 { .pci_subvendor
= 0x105b, .pci_subdevice
= 0x6668,
4397 .config
= ALC882_6ST_DIG
}, /* Foxconn */
4398 { .pci_subvendor
= 0x1019, .pci_subdevice
= 0x6668,
4399 .config
= ALC882_6ST_DIG
}, /* ECS to Intel*/
4400 { .modelname
= "auto", .config
= ALC882_AUTO
},
4404 static struct alc_config_preset alc882_presets
[] = {
4405 [ALC882_3ST_DIG
] = {
4406 .mixers
= { alc882_base_mixer
},
4407 .init_verbs
= { alc882_init_verbs
},
4408 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
4409 .dac_nids
= alc882_dac_nids
,
4410 .dig_out_nid
= ALC882_DIGOUT_NID
,
4411 .dig_in_nid
= ALC882_DIGIN_NID
,
4412 .num_channel_mode
= ARRAY_SIZE(alc882_ch_modes
),
4413 .channel_mode
= alc882_ch_modes
,
4414 .input_mux
= &alc882_capture_source
,
4416 [ALC882_6ST_DIG
] = {
4417 .mixers
= { alc882_base_mixer
, alc882_chmode_mixer
},
4418 .init_verbs
= { alc882_init_verbs
},
4419 .num_dacs
= ARRAY_SIZE(alc882_dac_nids
),
4420 .dac_nids
= alc882_dac_nids
,
4421 .dig_out_nid
= ALC882_DIGOUT_NID
,
4422 .dig_in_nid
= ALC882_DIGIN_NID
,
4423 .num_channel_mode
= ARRAY_SIZE(alc882_sixstack_modes
),
4424 .channel_mode
= alc882_sixstack_modes
,
4425 .input_mux
= &alc882_capture_source
,
4431 * BIOS auto configuration
4433 static void alc882_auto_set_output_and_unmute(struct hda_codec
*codec
,
4434 hda_nid_t nid
, int pin_type
,
4438 struct alc_spec
*spec
= codec
->spec
;
4441 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
4444 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
4446 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
4447 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
4448 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
4452 static void alc882_auto_init_multi_out(struct hda_codec
*codec
)
4454 struct alc_spec
*spec
= codec
->spec
;
4457 for (i
= 0; i
<= HDA_SIDE
; i
++) {
4458 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
4460 alc882_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, i
);
4464 static void alc882_auto_init_hp_out(struct hda_codec
*codec
)
4466 struct alc_spec
*spec
= codec
->spec
;
4469 pin
= spec
->autocfg
.hp_pin
;
4470 if (pin
) /* connect to front */
4471 alc882_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0); /* use dac 0 */
4474 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
4475 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
4477 static void alc882_auto_init_analog_input(struct hda_codec
*codec
)
4479 struct alc_spec
*spec
= codec
->spec
;
4482 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
4483 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
4484 if (alc882_is_input_pin(nid
)) {
4485 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
4486 i
<= AUTO_PIN_FRONT_MIC
? PIN_VREF80
: PIN_IN
);
4487 if (nid
!= ALC882_PIN_CD_NID
)
4488 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4494 /* almost identical with ALC880 parser... */
4495 static int alc882_parse_auto_config(struct hda_codec
*codec
)
4497 struct alc_spec
*spec
= codec
->spec
;
4498 int err
= alc880_parse_auto_config(codec
);
4503 /* hack - override the init verbs */
4504 spec
->init_verbs
[0] = alc882_auto_init_verbs
;
4508 /* additional initialization for auto-configuration model */
4509 static void alc882_auto_init(struct hda_codec
*codec
)
4511 alc882_auto_init_multi_out(codec
);
4512 alc882_auto_init_hp_out(codec
);
4513 alc882_auto_init_analog_input(codec
);
4516 static int patch_alc882(struct hda_codec
*codec
)
4518 struct alc_spec
*spec
;
4519 int err
, board_config
;
4521 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
4527 board_config
= snd_hda_check_board_config(codec
, alc882_cfg_tbl
);
4529 if (board_config
< 0 || board_config
>= ALC882_MODEL_LAST
) {
4530 printk(KERN_INFO
"hda_codec: Unknown model for ALC882, "
4531 "trying auto-probe from BIOS...\n");
4532 board_config
= ALC882_AUTO
;
4535 if (board_config
== ALC882_AUTO
) {
4536 /* automatic parse from the BIOS config */
4537 err
= alc882_parse_auto_config(codec
);
4543 "hda_codec: Cannot set up configuration "
4544 "from BIOS. Using base mode...\n");
4545 board_config
= ALC882_3ST_DIG
;
4549 if (board_config
!= ALC882_AUTO
)
4550 setup_preset(spec
, &alc882_presets
[board_config
]);
4552 spec
->stream_name_analog
= "ALC882 Analog";
4553 spec
->stream_analog_playback
= &alc882_pcm_analog_playback
;
4554 spec
->stream_analog_capture
= &alc882_pcm_analog_capture
;
4556 spec
->stream_name_digital
= "ALC882 Digital";
4557 spec
->stream_digital_playback
= &alc882_pcm_digital_playback
;
4558 spec
->stream_digital_capture
= &alc882_pcm_digital_capture
;
4560 if (! spec
->adc_nids
&& spec
->input_mux
) {
4561 /* check whether NID 0x07 is valid */
4562 unsigned int wcap
= get_wcaps(codec
, 0x07);
4563 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
4564 if (wcap
!= AC_WID_AUD_IN
) {
4565 spec
->adc_nids
= alc882_adc_nids_alt
;
4566 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids_alt
);
4567 spec
->mixers
[spec
->num_mixers
] = alc882_capture_alt_mixer
;
4570 spec
->adc_nids
= alc882_adc_nids
;
4571 spec
->num_adc_nids
= ARRAY_SIZE(alc882_adc_nids
);
4572 spec
->mixers
[spec
->num_mixers
] = alc882_capture_mixer
;
4577 codec
->patch_ops
= alc_patch_ops
;
4578 if (board_config
== ALC882_AUTO
)
4579 spec
->init_hook
= alc882_auto_init
;
4587 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
4588 * configuration. Each pin widget can choose any input DACs and a mixer.
4589 * Each ADC is connected from a mixer of all inputs. This makes possible
4590 * 6-channel independent captures.
4592 * In addition, an independent DAC for the multi-playback (not used in this
4595 #define ALC883_DIGOUT_NID 0x06
4596 #define ALC883_DIGIN_NID 0x0a
4598 static hda_nid_t alc883_dac_nids
[4] = {
4599 /* front, rear, clfe, rear_surr */
4600 0x02, 0x04, 0x03, 0x05
4603 static hda_nid_t alc883_adc_nids
[2] = {
4608 /* FIXME: should be a matrix-type input source selection */
4610 static struct hda_input_mux alc883_capture_source
= {
4614 { "Front Mic", 0x1 },
4619 #define alc883_mux_enum_info alc_mux_enum_info
4620 #define alc883_mux_enum_get alc_mux_enum_get
4622 static int alc883_mux_enum_put(struct snd_kcontrol
*kcontrol
,
4623 struct snd_ctl_elem_value
*ucontrol
)
4625 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
4626 struct alc_spec
*spec
= codec
->spec
;
4627 const struct hda_input_mux
*imux
= spec
->input_mux
;
4628 unsigned int adc_idx
= snd_ctl_get_ioffidx(kcontrol
, &ucontrol
->id
);
4629 static hda_nid_t capture_mixers
[3] = { 0x24, 0x23, 0x22 };
4630 hda_nid_t nid
= capture_mixers
[adc_idx
];
4631 unsigned int *cur_val
= &spec
->cur_mux
[adc_idx
];
4632 unsigned int i
, idx
;
4634 idx
= ucontrol
->value
.enumerated
.item
[0];
4635 if (idx
>= imux
->num_items
)
4636 idx
= imux
->num_items
- 1;
4637 if (*cur_val
== idx
&& ! codec
->in_resume
)
4639 for (i
= 0; i
< imux
->num_items
; i
++) {
4640 unsigned int v
= (i
== idx
) ? 0x7000 : 0x7080;
4641 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
4642 v
| (imux
->items
[i
].index
<< 8));
4650 static struct hda_channel_mode alc883_3ST_2ch_modes
[1] = {
4657 static struct hda_verb alc883_3ST_ch2_init
[] = {
4658 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4659 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4660 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4661 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4668 static struct hda_verb alc883_3ST_ch6_init
[] = {
4669 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4670 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4671 { 0x18, AC_VERB_SET_CONNECT_SEL
, 0x02 },
4672 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4673 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4674 { 0x1a, AC_VERB_SET_CONNECT_SEL
, 0x01 },
4678 static struct hda_channel_mode alc883_3ST_6ch_modes
[2] = {
4679 { 2, alc883_3ST_ch2_init
},
4680 { 6, alc883_3ST_ch6_init
},
4686 static struct hda_verb alc883_sixstack_ch6_init
[] = {
4687 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
4688 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4689 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4690 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4697 static struct hda_verb alc883_sixstack_ch8_init
[] = {
4698 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4699 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4700 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4701 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4705 static struct hda_channel_mode alc883_sixstack_modes
[2] = {
4706 { 6, alc883_sixstack_ch6_init
},
4707 { 8, alc883_sixstack_ch8_init
},
4710 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
4711 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
4714 static struct snd_kcontrol_new alc883_base_mixer
[] = {
4715 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4716 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4717 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
4718 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
4719 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
4720 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
4721 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
4722 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
4723 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT
),
4724 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT
),
4725 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
4726 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
4727 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
4728 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
4729 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
4730 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4731 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4732 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4733 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4734 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
4735 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
4736 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
4737 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
4738 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
4739 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
4741 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4742 /* .name = "Capture Source", */
4743 .name
= "Input Source",
4745 .info
= alc883_mux_enum_info
,
4746 .get
= alc883_mux_enum_get
,
4747 .put
= alc883_mux_enum_put
,
4752 static struct snd_kcontrol_new alc883_3ST_2ch_mixer
[] = {
4753 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4754 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4755 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
4756 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
4757 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
4758 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
4759 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
4760 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4761 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4762 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4763 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4764 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
4765 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
4766 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
4767 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
4768 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
4769 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
4771 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4772 /* .name = "Capture Source", */
4773 .name
= "Input Source",
4775 .info
= alc883_mux_enum_info
,
4776 .get
= alc883_mux_enum_get
,
4777 .put
= alc883_mux_enum_put
,
4782 static struct snd_kcontrol_new alc883_3ST_6ch_mixer
[] = {
4783 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
4784 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT
),
4785 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT
),
4786 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT
),
4787 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT
),
4788 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
4789 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT
),
4790 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT
),
4791 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
4792 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
4793 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
4794 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
4795 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
4796 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
4797 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
4798 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT
),
4799 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT
),
4800 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT
),
4801 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT
),
4802 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
4803 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
4804 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
4805 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
4807 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4808 /* .name = "Capture Source", */
4809 .name
= "Input Source",
4811 .info
= alc883_mux_enum_info
,
4812 .get
= alc883_mux_enum_get
,
4813 .put
= alc883_mux_enum_put
,
4818 static struct snd_kcontrol_new alc883_chmode_mixer
[] = {
4820 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4821 .name
= "Channel Mode",
4822 .info
= alc_ch_mode_info
,
4823 .get
= alc_ch_mode_get
,
4824 .put
= alc_ch_mode_put
,
4829 static struct hda_verb alc883_init_verbs
[] = {
4830 /* ADC1: mute amp left and right */
4831 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4832 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4833 /* ADC2: mute amp left and right */
4834 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4835 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4836 /* Front mixer: unmute input/output amp left and right (volume = 0) */
4837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4843 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4847 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4849 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4850 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
4851 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
4853 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4855 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
4856 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
4857 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
4859 /* Front Pin: output 0 (0x0c) */
4860 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4861 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4862 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
4863 /* Rear Pin: output 1 (0x0d) */
4864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4865 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4866 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
4867 /* CLFE Pin: output 2 (0x0e) */
4868 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4869 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4870 {0x16, AC_VERB_SET_CONNECT_SEL
, 0x02},
4871 /* Side Pin: output 3 (0x0f) */
4872 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
4873 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4874 {0x17, AC_VERB_SET_CONNECT_SEL
, 0x03},
4875 /* Mic (rear) pin: input vref at 80% */
4876 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4877 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4878 /* Front Mic pin: input vref at 80% */
4879 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_VREF80
},
4880 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4881 /* Line In pin: input */
4882 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4883 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
4884 /* Line-2 In: Headphone output (output 0 - 0x0c) */
4885 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
4886 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
4887 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
4888 /* CD pin widget for input */
4889 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_IN
},
4891 /* FIXME: use matrix-type input source selection */
4892 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
4894 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4895 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4896 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
4897 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
4899 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4900 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4901 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
4902 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
4907 * generic initialization of ADC, input mixers and output mixers
4909 static struct hda_verb alc883_auto_init_verbs
[] = {
4911 * Unmute ADC0-2 and set the default input to mic-in
4913 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
4914 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4915 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
4916 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4918 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4920 * Note: PASD motherboards uses the Line In 2 as the input for front panel
4923 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
4924 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4925 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4926 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
4927 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
4928 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
4931 * Set up output mixers (0x0c - 0x0f)
4933 /* set vol=0 to output mixers */
4934 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4935 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4936 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4937 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
4938 /* set up input amps for analog loopback */
4939 /* Amp Indices: DAC = 0, mixer = 1 */
4940 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4941 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4942 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4943 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4944 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4945 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4946 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4947 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4948 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4949 {0x26, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4951 /* FIXME: use matrix-type input source selection */
4952 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
4954 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4955 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4956 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
4957 //{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
4958 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
4960 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
4961 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
4962 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
4963 //{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
4964 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
4969 /* capture mixer elements */
4970 static struct snd_kcontrol_new alc883_capture_mixer
[] = {
4971 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
4972 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
4973 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT
),
4974 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT
),
4976 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
4977 /* The multiple "Capture Source" controls confuse alsamixer
4978 * So call somewhat different..
4979 * FIXME: the controls appear in the "playback" view!
4981 /* .name = "Capture Source", */
4982 .name
= "Input Source",
4984 .info
= alc882_mux_enum_info
,
4985 .get
= alc882_mux_enum_get
,
4986 .put
= alc882_mux_enum_put
,
4991 /* pcm configuration: identiacal with ALC880 */
4992 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
4993 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
4994 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
4995 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
4998 * configuration and preset
5000 static struct hda_board_config alc883_cfg_tbl
[] = {
5001 { .modelname
= "3stack-dig", .config
= ALC883_3ST_2ch_DIG
},
5002 { .modelname
= "6stack-dig", .config
= ALC883_6ST_DIG
},
5003 { .modelname
= "6stack-dig-demo", .config
= ALC888_DEMO_BOARD
},
5004 { .pci_subvendor
= 0x1462, .pci_subdevice
= 0x6668,
5005 .config
= ALC883_6ST_DIG
}, /* MSI */
5006 { .pci_subvendor
= 0x105b, .pci_subdevice
= 0x6668,
5007 .config
= ALC883_6ST_DIG
}, /* Foxconn */
5008 { .pci_subvendor
= 0x1019, .pci_subdevice
= 0x6668,
5009 .config
= ALC883_3ST_6ch_DIG
}, /* ECS to Intel*/
5010 { .pci_subvendor
= 0x108e, .pci_subdevice
= 0x534d,
5011 .config
= ALC883_3ST_6ch
},
5012 { .modelname
= "auto", .config
= ALC883_AUTO
},
5016 static struct alc_config_preset alc883_presets
[] = {
5017 [ALC883_3ST_2ch_DIG
] = {
5018 .mixers
= { alc883_3ST_2ch_mixer
},
5019 .init_verbs
= { alc883_init_verbs
},
5020 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5021 .dac_nids
= alc883_dac_nids
,
5022 .dig_out_nid
= ALC883_DIGOUT_NID
,
5023 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5024 .adc_nids
= alc883_adc_nids
,
5025 .dig_in_nid
= ALC883_DIGIN_NID
,
5026 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_2ch_modes
),
5027 .channel_mode
= alc883_3ST_2ch_modes
,
5028 .input_mux
= &alc883_capture_source
,
5030 [ALC883_3ST_6ch_DIG
] = {
5031 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
5032 .init_verbs
= { alc883_init_verbs
},
5033 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5034 .dac_nids
= alc883_dac_nids
,
5035 .dig_out_nid
= ALC883_DIGOUT_NID
,
5036 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5037 .adc_nids
= alc883_adc_nids
,
5038 .dig_in_nid
= ALC883_DIGIN_NID
,
5039 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
5040 .channel_mode
= alc883_3ST_6ch_modes
,
5041 .input_mux
= &alc883_capture_source
,
5043 [ALC883_3ST_6ch
] = {
5044 .mixers
= { alc883_3ST_6ch_mixer
, alc883_chmode_mixer
},
5045 .init_verbs
= { alc883_init_verbs
},
5046 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5047 .dac_nids
= alc883_dac_nids
,
5048 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5049 .adc_nids
= alc883_adc_nids
,
5050 .num_channel_mode
= ARRAY_SIZE(alc883_3ST_6ch_modes
),
5051 .channel_mode
= alc883_3ST_6ch_modes
,
5052 .input_mux
= &alc883_capture_source
,
5054 [ALC883_6ST_DIG
] = {
5055 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
5056 .init_verbs
= { alc883_init_verbs
},
5057 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5058 .dac_nids
= alc883_dac_nids
,
5059 .dig_out_nid
= ALC883_DIGOUT_NID
,
5060 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5061 .adc_nids
= alc883_adc_nids
,
5062 .dig_in_nid
= ALC883_DIGIN_NID
,
5063 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
5064 .channel_mode
= alc883_sixstack_modes
,
5065 .input_mux
= &alc883_capture_source
,
5067 [ALC888_DEMO_BOARD
] = {
5068 .mixers
= { alc883_base_mixer
, alc883_chmode_mixer
},
5069 .init_verbs
= { alc883_init_verbs
},
5070 .num_dacs
= ARRAY_SIZE(alc883_dac_nids
),
5071 .dac_nids
= alc883_dac_nids
,
5072 .dig_out_nid
= ALC883_DIGOUT_NID
,
5073 .num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
),
5074 .adc_nids
= alc883_adc_nids
,
5075 .dig_in_nid
= ALC883_DIGIN_NID
,
5076 .num_channel_mode
= ARRAY_SIZE(alc883_sixstack_modes
),
5077 .channel_mode
= alc883_sixstack_modes
,
5078 .input_mux
= &alc883_capture_source
,
5084 * BIOS auto configuration
5086 static void alc883_auto_set_output_and_unmute(struct hda_codec
*codec
,
5087 hda_nid_t nid
, int pin_type
,
5091 struct alc_spec
*spec
= codec
->spec
;
5094 if (spec
->multiout
.dac_nids
[dac_idx
] == 0x25)
5097 idx
= spec
->multiout
.dac_nids
[dac_idx
] - 2;
5099 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
5101 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_AMP_GAIN_MUTE
,
5103 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_CONNECT_SEL
, idx
);
5107 static void alc883_auto_init_multi_out(struct hda_codec
*codec
)
5109 struct alc_spec
*spec
= codec
->spec
;
5112 for (i
= 0; i
<= HDA_SIDE
; i
++) {
5113 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
5115 alc883_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, i
);
5119 static void alc883_auto_init_hp_out(struct hda_codec
*codec
)
5121 struct alc_spec
*spec
= codec
->spec
;
5124 pin
= spec
->autocfg
.hp_pin
;
5125 if (pin
) /* connect to front */
5127 alc883_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, 0);
5130 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
5131 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
5133 static void alc883_auto_init_analog_input(struct hda_codec
*codec
)
5135 struct alc_spec
*spec
= codec
->spec
;
5138 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
5139 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
5140 if (alc883_is_input_pin(nid
)) {
5141 snd_hda_codec_write(codec
, nid
, 0,
5142 AC_VERB_SET_PIN_WIDGET_CONTROL
,
5143 (i
<= AUTO_PIN_FRONT_MIC
?
5144 PIN_VREF80
: PIN_IN
));
5145 if (nid
!= ALC883_PIN_CD_NID
)
5146 snd_hda_codec_write(codec
, nid
, 0,
5147 AC_VERB_SET_AMP_GAIN_MUTE
,
5153 /* almost identical with ALC880 parser... */
5154 static int alc883_parse_auto_config(struct hda_codec
*codec
)
5156 struct alc_spec
*spec
= codec
->spec
;
5157 int err
= alc880_parse_auto_config(codec
);
5162 /* hack - override the init verbs */
5163 spec
->init_verbs
[0] = alc883_auto_init_verbs
;
5164 spec
->mixers
[spec
->num_mixers
] = alc883_capture_mixer
;
5169 /* additional initialization for auto-configuration model */
5170 static void alc883_auto_init(struct hda_codec
*codec
)
5172 alc883_auto_init_multi_out(codec
);
5173 alc883_auto_init_hp_out(codec
);
5174 alc883_auto_init_analog_input(codec
);
5177 static int patch_alc883(struct hda_codec
*codec
)
5179 struct alc_spec
*spec
;
5180 int err
, board_config
;
5182 spec
= kzalloc(sizeof(*spec
), GFP_KERNEL
);
5188 board_config
= snd_hda_check_board_config(codec
, alc883_cfg_tbl
);
5189 if (board_config
< 0 || board_config
>= ALC883_MODEL_LAST
) {
5190 printk(KERN_INFO
"hda_codec: Unknown model for ALC883, "
5191 "trying auto-probe from BIOS...\n");
5192 board_config
= ALC883_AUTO
;
5195 if (board_config
== ALC883_AUTO
) {
5196 /* automatic parse from the BIOS config */
5197 err
= alc883_parse_auto_config(codec
);
5203 "hda_codec: Cannot set up configuration "
5204 "from BIOS. Using base mode...\n");
5205 board_config
= ALC883_3ST_2ch_DIG
;
5209 if (board_config
!= ALC883_AUTO
)
5210 setup_preset(spec
, &alc883_presets
[board_config
]);
5212 spec
->stream_name_analog
= "ALC883 Analog";
5213 spec
->stream_analog_playback
= &alc883_pcm_analog_playback
;
5214 spec
->stream_analog_capture
= &alc883_pcm_analog_capture
;
5216 spec
->stream_name_digital
= "ALC883 Digital";
5217 spec
->stream_digital_playback
= &alc883_pcm_digital_playback
;
5218 spec
->stream_digital_capture
= &alc883_pcm_digital_capture
;
5220 spec
->adc_nids
= alc883_adc_nids
;
5221 spec
->num_adc_nids
= ARRAY_SIZE(alc883_adc_nids
);
5223 codec
->patch_ops
= alc_patch_ops
;
5224 if (board_config
== ALC883_AUTO
)
5225 spec
->init_hook
= alc883_auto_init
;
5234 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
5235 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
5237 #define alc262_dac_nids alc260_dac_nids
5238 #define alc262_adc_nids alc882_adc_nids
5239 #define alc262_adc_nids_alt alc882_adc_nids_alt
5241 #define alc262_modes alc260_modes
5242 #define alc262_capture_source alc882_capture_source
5244 static struct snd_kcontrol_new alc262_base_mixer
[] = {
5245 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5246 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT
),
5247 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5248 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5249 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5250 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5252 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5253 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5254 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5255 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),
5256 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */
5257 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT
),
5258 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5259 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5260 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
5264 static struct snd_kcontrol_new alc262_HP_BPC_mixer
[] = {
5265 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT
),
5266 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT
),
5267 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT
),
5268 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT
),
5269 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT
),
5271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5272 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5273 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT
),
5274 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT
),
5275 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT
),
5276 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT
),
5277 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5278 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5279 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT
),
5280 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT
),
5281 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT
),
5282 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT
),
5286 #define alc262_capture_mixer alc882_capture_mixer
5287 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
5290 * generic initialization of ADC, input mixers and output mixers
5292 static struct hda_verb alc262_init_verbs
[] = {
5294 * Unmute ADC0-2 and set the default input to mic-in
5296 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5297 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5298 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5299 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5300 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5301 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5303 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5305 * Note: PASD motherboards uses the Line In 2 as the input for front panel
5308 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5309 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5310 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5311 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5312 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
5313 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5316 * Set up output mixers (0x0c - 0x0e)
5318 /* set vol=0 to output mixers */
5319 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5320 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5321 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5322 /* set up input amps for analog loopback */
5323 /* Amp Indices: DAC = 0, mixer = 1 */
5324 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5325 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5326 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5327 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5329 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5331 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5332 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
5333 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40},
5334 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5335 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5336 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5338 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5339 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5340 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5341 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5342 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x0000},
5344 {0x14, AC_VERB_SET_CONNECT_SEL
, 0x00},
5345 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x01},
5347 /* FIXME: use matrix-type input source selection */
5348 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5349 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5350 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5355 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5356 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5357 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5358 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5360 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5361 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5362 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5363 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5370 * 0x14 = headphone/spdif-out, 0x15 = internal speaker
5373 #define ALC_HP_EVENT 0x37
5375 static struct hda_verb alc262_fujitsu_unsol_verbs
[] = {
5376 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE
, AC_USRSP_EN
| ALC_HP_EVENT
},
5377 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_HP
},
5381 static struct hda_input_mux alc262_fujitsu_capture_source
= {
5389 static struct hda_input_mux alc262_HP_capture_source
= {
5393 { "Front Mic", 0x3 },
5400 /* mute/unmute internal speaker according to the hp jack and mute state */
5401 static void alc262_fujitsu_automute(struct hda_codec
*codec
, int force
)
5403 struct alc_spec
*spec
= codec
->spec
;
5406 if (force
|| ! spec
->sense_updated
) {
5407 unsigned int present
;
5408 /* need to execute and sync at first */
5409 snd_hda_codec_read(codec
, 0x14, 0, AC_VERB_SET_PIN_SENSE
, 0);
5410 present
= snd_hda_codec_read(codec
, 0x14, 0,
5411 AC_VERB_GET_PIN_SENSE
, 0);
5412 spec
->jack_present
= (present
& 0x80000000) != 0;
5413 spec
->sense_updated
= 1;
5415 if (spec
->jack_present
) {
5416 /* mute internal speaker */
5417 snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
5419 snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
5422 /* unmute internal speaker if necessary */
5423 mute
= snd_hda_codec_amp_read(codec
, 0x14, 0, HDA_OUTPUT
, 0);
5424 snd_hda_codec_amp_update(codec
, 0x15, 0, HDA_OUTPUT
, 0,
5426 mute
= snd_hda_codec_amp_read(codec
, 0x14, 1, HDA_OUTPUT
, 0);
5427 snd_hda_codec_amp_update(codec
, 0x15, 1, HDA_OUTPUT
, 0,
5432 /* unsolicited event for HP jack sensing */
5433 static void alc262_fujitsu_unsol_event(struct hda_codec
*codec
,
5436 if ((res
>> 26) != ALC_HP_EVENT
)
5438 alc262_fujitsu_automute(codec
, 1);
5441 /* bind volumes of both NID 0x0c and 0x0d */
5442 static int alc262_fujitsu_master_vol_put(struct snd_kcontrol
*kcontrol
,
5443 struct snd_ctl_elem_value
*ucontrol
)
5445 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5446 long *valp
= ucontrol
->value
.integer
.value
;
5449 change
= snd_hda_codec_amp_update(codec
, 0x0c, 0, HDA_OUTPUT
, 0,
5450 0x7f, valp
[0] & 0x7f);
5451 change
|= snd_hda_codec_amp_update(codec
, 0x0c, 1, HDA_OUTPUT
, 0,
5452 0x7f, valp
[1] & 0x7f);
5453 snd_hda_codec_amp_update(codec
, 0x0d, 0, HDA_OUTPUT
, 0,
5454 0x7f, valp
[0] & 0x7f);
5455 snd_hda_codec_amp_update(codec
, 0x0d, 1, HDA_OUTPUT
, 0,
5456 0x7f, valp
[1] & 0x7f);
5460 /* bind hp and internal speaker mute (with plug check) */
5461 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol
*kcontrol
,
5462 struct snd_ctl_elem_value
*ucontrol
)
5464 struct hda_codec
*codec
= snd_kcontrol_chip(kcontrol
);
5465 long *valp
= ucontrol
->value
.integer
.value
;
5468 change
= snd_hda_codec_amp_update(codec
, 0x14, 0, HDA_OUTPUT
, 0,
5469 0x80, valp
[0] ? 0 : 0x80);
5470 change
|= snd_hda_codec_amp_update(codec
, 0x14, 1, HDA_OUTPUT
, 0,
5471 0x80, valp
[1] ? 0 : 0x80);
5472 if (change
|| codec
->in_resume
)
5473 alc262_fujitsu_automute(codec
, codec
->in_resume
);
5477 static struct snd_kcontrol_new alc262_fujitsu_mixer
[] = {
5479 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5480 .name
= "Master Playback Volume",
5481 .info
= snd_hda_mixer_amp_volume_info
,
5482 .get
= snd_hda_mixer_amp_volume_get
,
5483 .put
= alc262_fujitsu_master_vol_put
,
5484 .private_value
= HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
),
5487 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5488 .name
= "Master Playback Switch",
5489 .info
= snd_hda_mixer_amp_switch_info
,
5490 .get
= snd_hda_mixer_amp_switch_get
,
5491 .put
= alc262_fujitsu_master_sw_put
,
5492 .private_value
= HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT
),
5494 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT
),
5495 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT
),
5496 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT
),
5497 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT
),
5498 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT
),
5502 /* add playback controls from the parsed DAC table */
5503 static int alc262_auto_create_multi_out_ctls(struct alc_spec
*spec
, const struct auto_pin_cfg
*cfg
)
5508 spec
->multiout
.num_dacs
= 1; /* only use one dac */
5509 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
5510 spec
->multiout
.dac_nids
[0] = 2;
5512 nid
= cfg
->line_out_pins
[0];
5514 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "Front Playback Volume",
5515 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT
))) < 0)
5517 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Front Playback Switch",
5518 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
5522 nid
= cfg
->speaker_pins
[0];
5525 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "Speaker Playback Volume",
5526 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT
))) < 0)
5528 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Speaker Playback Switch",
5529 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
))) < 0)
5532 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Speaker Playback Switch",
5533 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
5539 /* spec->multiout.hp_nid = 2; */
5541 if ((err
= add_control(spec
, ALC_CTL_WIDGET_VOL
, "Headphone Playback Volume",
5542 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT
))) < 0)
5544 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Headphone Playback Switch",
5545 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
))) < 0)
5548 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Headphone Playback Switch",
5549 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
5556 /* identical with ALC880 */
5557 #define alc262_auto_create_analog_input_ctls alc880_auto_create_analog_input_ctls
5560 * generic initialization of ADC, input mixers and output mixers
5562 static struct hda_verb alc262_volume_init_verbs
[] = {
5564 * Unmute ADC0-2 and set the default input to mic-in
5566 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5567 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5568 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5569 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5570 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5571 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5573 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5575 * Note: PASD motherboards uses the Line In 2 as the input for front panel
5578 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5579 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5580 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5581 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5582 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
5583 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5586 * Set up output mixers (0x0c - 0x0f)
5588 /* set vol=0 to output mixers */
5589 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5590 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5591 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5593 /* set up input amps for analog loopback */
5594 /* Amp Indices: DAC = 0, mixer = 1 */
5595 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5596 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5597 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5598 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5599 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5600 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5602 /* FIXME: use matrix-type input source selection */
5603 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5604 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5605 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5606 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5607 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5608 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5610 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5611 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5612 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5613 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5615 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5616 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x03 << 8))},
5617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8))},
5618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x04 << 8))},
5623 static struct hda_verb alc262_HP_BPC_init_verbs
[] = {
5625 * Unmute ADC0-2 and set the default input to mic-in
5627 {0x07, AC_VERB_SET_CONNECT_SEL
, 0x00},
5628 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5629 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
5630 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5631 {0x09, AC_VERB_SET_CONNECT_SEL
, 0x00},
5632 {0x09, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5634 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5636 * Note: PASD motherboards uses the Line In 2 as the input for front panel
5639 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
5643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
5644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(4)},
5645 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(5)},
5646 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(6)},
5649 * Set up output mixers (0x0c - 0x0e)
5651 /* set vol=0 to output mixers */
5652 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5653 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5654 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_ZERO
},
5656 /* set up input amps for analog loopback */
5657 /* Amp Indices: DAC = 0, mixer = 1 */
5658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5660 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5662 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
5663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
5665 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0},
5666 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5667 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL
, PIN_OUT
},
5669 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
5672 {0x1b, AC_VERB_SET_CONNECT_SEL
, 0x00},
5673 {0x15, AC_VERB_SET_CONNECT_SEL
, 0x00},
5675 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5676 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5677 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24},
5678 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5679 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20},
5681 {0x14, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
5682 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
5683 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
5684 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7023 },
5685 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
5686 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE
, 0x7000 },
5689 /* FIXME: use matrix-type input source selection */
5690 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
5691 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
5692 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5693 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
5694 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
5695 {0x24, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
5697 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5698 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
5699 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
5700 {0x23, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
5702 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x00 << 8))},
5703 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x03 << 8))},
5704 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8))},
5705 {0x22, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x04 << 8))},
5710 /* pcm configuration: identiacal with ALC880 */
5711 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
5712 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
5713 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
5714 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
5717 * BIOS auto configuration
5719 static int alc262_parse_auto_config(struct hda_codec
*codec
)
5721 struct alc_spec
*spec
= codec
->spec
;
5723 static hda_nid_t alc262_ignore
[] = { 0x1d, 0 };
5725 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
5726 alc262_ignore
)) < 0)
5728 if (! spec
->autocfg
.line_outs
)
5729 return 0; /* can't find valid BIOS pin config */
5730 if ((err
= alc262_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0 ||
5731 (err
= alc262_auto_create_analog_input_ctls(spec
, &spec
->autocfg
)) < 0)
5734 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
5736 if (spec
->autocfg
.dig_out_pin
)
5737 spec
->multiout
.dig_out_nid
= ALC262_DIGOUT_NID
;
5738 if (spec
->autocfg
.dig_in_pin
)
5739 spec
->dig_in_nid
= ALC262_DIGIN_NID
;
5741 if (spec
->kctl_alloc
)
5742 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
5744 spec
->init_verbs
[spec
->num_init_verbs
++] = alc262_volume_init_verbs
;
5745 spec
->num_mux_defs
= 1;
5746 spec
->input_mux
= &spec
->private_imux
;
5751 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
5752 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
5753 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
5756 /* init callback for auto-configuration model -- overriding the default init */
5757 static void alc262_auto_init(struct hda_codec
*codec
)
5759 alc262_auto_init_multi_out(codec
);
5760 alc262_auto_init_hp_out(codec
);
5761 alc262_auto_init_analog_input(codec
);
5765 * configuration and preset
5767 static struct hda_board_config alc262_cfg_tbl
[] = {
5768 { .modelname
= "basic", .config
= ALC262_BASIC
},
5769 { .modelname
= "fujitsu", .config
= ALC262_FUJITSU
},
5770 { .pci_subvendor
= 0x10cf, .pci_subdevice
= 0x1397,
5771 .config
= ALC262_FUJITSU
},
5772 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x208c,
5773 .config
= ALC262_HP_BPC
}, /* xw4400 */
5774 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3014,
5775 .config
= ALC262_HP_BPC
}, /* xw6400 */
5776 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x3015,
5777 .config
= ALC262_HP_BPC
}, /* xw8400 */
5778 { .pci_subvendor
= 0x103c, .pci_subdevice
= 0x12fe,
5779 .config
= ALC262_HP_BPC
}, /* xw9400 */
5780 { .modelname
= "auto", .config
= ALC262_AUTO
},
5784 static struct alc_config_preset alc262_presets
[] = {
5786 .mixers
= { alc262_base_mixer
},
5787 .init_verbs
= { alc262_init_verbs
},
5788 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
5789 .dac_nids
= alc262_dac_nids
,
5791 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
5792 .channel_mode
= alc262_modes
,
5793 .input_mux
= &alc262_capture_source
,
5795 [ALC262_FUJITSU
] = {
5796 .mixers
= { alc262_fujitsu_mixer
},
5797 .init_verbs
= { alc262_init_verbs
, alc262_fujitsu_unsol_verbs
},
5798 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
5799 .dac_nids
= alc262_dac_nids
,
5801 .dig_out_nid
= ALC262_DIGOUT_NID
,
5802 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
5803 .channel_mode
= alc262_modes
,
5804 .input_mux
= &alc262_fujitsu_capture_source
,
5805 .unsol_event
= alc262_fujitsu_unsol_event
,
5808 .mixers
= { alc262_HP_BPC_mixer
},
5809 .init_verbs
= { alc262_HP_BPC_init_verbs
},
5810 .num_dacs
= ARRAY_SIZE(alc262_dac_nids
),
5811 .dac_nids
= alc262_dac_nids
,
5813 .num_channel_mode
= ARRAY_SIZE(alc262_modes
),
5814 .channel_mode
= alc262_modes
,
5815 .input_mux
= &alc262_HP_capture_source
,
5819 static int patch_alc262(struct hda_codec
*codec
)
5821 struct alc_spec
*spec
;
5825 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
5831 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is under-run */
5834 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
5835 tmp
= snd_hda_codec_read(codec
, 0x20, 0, AC_VERB_GET_PROC_COEF
, 0);
5836 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_COEF_INDEX
, 7);
5837 snd_hda_codec_write(codec
, 0x1a, 0, AC_VERB_SET_PROC_COEF
, tmp
| 0x80);
5841 board_config
= snd_hda_check_board_config(codec
, alc262_cfg_tbl
);
5843 if (board_config
< 0 || board_config
>= ALC262_MODEL_LAST
) {
5844 printk(KERN_INFO
"hda_codec: Unknown model for ALC262, "
5845 "trying auto-probe from BIOS...\n");
5846 board_config
= ALC262_AUTO
;
5849 if (board_config
== ALC262_AUTO
) {
5850 /* automatic parse from the BIOS config */
5851 err
= alc262_parse_auto_config(codec
);
5857 "hda_codec: Cannot set up configuration "
5858 "from BIOS. Using base mode...\n");
5859 board_config
= ALC262_BASIC
;
5863 if (board_config
!= ALC262_AUTO
)
5864 setup_preset(spec
, &alc262_presets
[board_config
]);
5866 spec
->stream_name_analog
= "ALC262 Analog";
5867 spec
->stream_analog_playback
= &alc262_pcm_analog_playback
;
5868 spec
->stream_analog_capture
= &alc262_pcm_analog_capture
;
5870 spec
->stream_name_digital
= "ALC262 Digital";
5871 spec
->stream_digital_playback
= &alc262_pcm_digital_playback
;
5872 spec
->stream_digital_capture
= &alc262_pcm_digital_capture
;
5874 if (! spec
->adc_nids
&& spec
->input_mux
) {
5875 /* check whether NID 0x07 is valid */
5876 unsigned int wcap
= get_wcaps(codec
, 0x07);
5878 wcap
= (wcap
& AC_WCAP_TYPE
) >> AC_WCAP_TYPE_SHIFT
; /* get type */
5879 if (wcap
!= AC_WID_AUD_IN
) {
5880 spec
->adc_nids
= alc262_adc_nids_alt
;
5881 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids_alt
);
5882 spec
->mixers
[spec
->num_mixers
] = alc262_capture_alt_mixer
;
5885 spec
->adc_nids
= alc262_adc_nids
;
5886 spec
->num_adc_nids
= ARRAY_SIZE(alc262_adc_nids
);
5887 spec
->mixers
[spec
->num_mixers
] = alc262_capture_mixer
;
5892 codec
->patch_ops
= alc_patch_ops
;
5893 if (board_config
== ALC262_AUTO
)
5894 spec
->init_hook
= alc262_auto_init
;
5900 * ALC861 channel source setting (2/6 channel selection for 3-stack)
5904 * set the path ways for 2 channel output
5905 * need to set the codec line out and mic 1 pin widgets to inputs
5907 static struct hda_verb alc861_threestack_ch2_init
[] = {
5908 /* set pin widget 1Ah (line in) for input */
5909 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
5910 /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */
5911 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
5913 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c },
5915 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x01 << 8)) }, /*mic*/
5916 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7000 | (0x02 << 8)) }, /*line-in*/
5922 * need to set the codec line out and mic 1 pin widgets to outputs
5924 static struct hda_verb alc861_threestack_ch6_init
[] = {
5925 /* set pin widget 1Ah (line in) for output (Back Surround)*/
5926 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
5927 /* set pin widget 18h (mic1) for output (CLFE)*/
5928 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
5930 { 0x0c, AC_VERB_SET_CONNECT_SEL
, 0x00 },
5931 { 0x0d, AC_VERB_SET_CONNECT_SEL
, 0x00 },
5933 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb080 },
5935 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x01 << 8)) }, /*mic*/
5936 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE
, (0x7080 | (0x02 << 8)) }, /*line in*/
5941 static struct hda_channel_mode alc861_threestack_modes
[2] = {
5942 { 2, alc861_threestack_ch2_init
},
5943 { 6, alc861_threestack_ch6_init
},
5948 static struct snd_kcontrol_new alc861_base_mixer
[] = {
5949 /* output mixer control */
5950 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
5951 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
5952 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
5953 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
5954 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT
),
5956 /*Input mixer control */
5957 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
5958 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
5959 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
5960 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
5961 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
5962 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
5963 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
5964 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
5965 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
5966 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
5968 /* Capture mixer control */
5969 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
5970 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
5972 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
5973 .name
= "Capture Source",
5975 .info
= alc_mux_enum_info
,
5976 .get
= alc_mux_enum_get
,
5977 .put
= alc_mux_enum_put
,
5982 static struct snd_kcontrol_new alc861_3ST_mixer
[] = {
5983 /* output mixer control */
5984 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT
),
5985 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT
),
5986 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT
),
5987 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT
),
5988 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
5990 /* Input mixer control */
5991 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
5992 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
5993 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT
),
5994 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT
),
5995 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT
),
5996 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT
),
5997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT
),
5998 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT
),
5999 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT
),
6000 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT
),
6002 /* Capture mixer control */
6003 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6004 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6006 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6007 .name
= "Capture Source",
6009 .info
= alc_mux_enum_info
,
6010 .get
= alc_mux_enum_get
,
6011 .put
= alc_mux_enum_put
,
6014 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6015 .name
= "Channel Mode",
6016 .info
= alc_ch_mode_info
,
6017 .get
= alc_ch_mode_get
,
6018 .put
= alc_ch_mode_put
,
6019 .private_value
= ARRAY_SIZE(alc861_threestack_modes
),
6025 * generic initialization of ADC, input mixers and output mixers
6027 static struct hda_verb alc861_base_init_verbs
[] = {
6029 * Unmute ADC0 and set the default input to mic-in
6031 /* port-A for surround (rear panel) */
6032 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6033 { 0x0e, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6034 /* port-B for mic-in (rear panel) with vref */
6035 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6036 /* port-C for line-in (rear panel) */
6037 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6038 /* port-D for Front */
6039 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6040 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6041 /* port-E for HP out (front panel) */
6042 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
6043 /* route front PCM to HP */
6044 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6045 /* port-F for mic-in (front panel) with vref */
6046 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6047 /* port-G for CLFE (rear panel) */
6048 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6049 { 0x1f, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6050 /* port-H for side (rear panel) */
6051 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6052 { 0x20, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6054 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6055 /* route front mic to ADC1*/
6056 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6057 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6059 /* Unmute DAC0~3 & spdif out*/
6060 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6061 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6062 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6063 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6064 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6066 /* Unmute Mixer 14 (mic) 1c (Line in)*/
6067 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6068 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6069 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6070 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6072 /* Unmute Stereo Mixer 15 */
6073 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6074 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6075 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6076 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c }, //Output 0~12 step
6078 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6079 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6080 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6081 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6082 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6083 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6084 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6085 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6086 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front)
6087 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6092 static struct hda_verb alc861_threestack_init_verbs
[] = {
6094 * Unmute ADC0 and set the default input to mic-in
6096 /* port-A for surround (rear panel) */
6097 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6098 /* port-B for mic-in (rear panel) with vref */
6099 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6100 /* port-C for line-in (rear panel) */
6101 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6102 /* port-D for Front */
6103 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x40 },
6104 { 0x0b, AC_VERB_SET_CONNECT_SEL
, 0x00 },
6105 /* port-E for HP out (front panel) */
6106 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0xc0 },
6107 /* route front PCM to HP */
6108 { 0x0f, AC_VERB_SET_CONNECT_SEL
, 0x01 },
6109 /* port-F for mic-in (front panel) with vref */
6110 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x24 },
6111 /* port-G for CLFE (rear panel) */
6112 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6113 /* port-H for side (rear panel) */
6114 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x00 },
6116 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL
, 0x20 },
6117 /* route front mic to ADC1*/
6118 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00},
6119 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6120 /* Unmute DAC0~3 & spdif out*/
6121 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6122 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6123 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6124 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6125 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6127 /* Unmute Mixer 14 (mic) 1c (Line in)*/
6128 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6129 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6130 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6131 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6133 /* Unmute Stereo Mixer 15 */
6134 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6135 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6136 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6137 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c }, //Output 0~12 step
6139 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6140 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6141 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6142 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6143 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6144 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6145 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6146 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6147 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front)
6148 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6152 * generic initialization of ADC, input mixers and output mixers
6154 static struct hda_verb alc861_auto_init_verbs
[] = {
6156 * Unmute ADC0 and set the default input to mic-in
6158 // {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6159 {0x08, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6161 /* Unmute DAC0~3 & spdif out*/
6162 {0x03, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6163 {0x04, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6164 {0x05, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6165 {0x06, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_MUTE
},
6166 {0x07, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
},
6168 /* Unmute Mixer 14 (mic) 1c (Line in)*/
6169 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6170 {0x014, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6171 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6172 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6174 /* Unmute Stereo Mixer 15 */
6175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6176 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6178 {0x15, AC_VERB_SET_AMP_GAIN_MUTE
, 0xb00c},
6180 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6181 {0x16, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6182 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6183 {0x17, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6184 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6185 {0x18, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6186 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(0)},
6187 {0x19, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(1)},
6189 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6190 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6191 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6192 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
6193 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(0)},
6194 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_MUTE(1)},
6195 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(2)},
6196 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_IN_UNMUTE(3)},
6198 {0x08, AC_VERB_SET_CONNECT_SEL
, 0x00}, // set Mic 1
6203 /* pcm configuration: identiacal with ALC880 */
6204 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
6205 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
6206 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
6207 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
6210 #define ALC861_DIGOUT_NID 0x07
6212 static struct hda_channel_mode alc861_8ch_modes
[1] = {
6216 static hda_nid_t alc861_dac_nids
[4] = {
6217 /* front, surround, clfe, side */
6218 0x03, 0x06, 0x05, 0x04
6221 static hda_nid_t alc660_dac_nids
[3] = {
6222 /* front, clfe, surround */
6226 static hda_nid_t alc861_adc_nids
[1] = {
6231 static struct hda_input_mux alc861_capture_source
= {
6235 { "Front Mic", 0x3 },
6242 /* fill in the dac_nids table from the parsed pin configuration */
6243 static int alc861_auto_fill_dac_nids(struct alc_spec
*spec
, const struct auto_pin_cfg
*cfg
)
6248 spec
->multiout
.dac_nids
= spec
->private_dac_nids
;
6249 for (i
= 0; i
< cfg
->line_outs
; i
++) {
6250 nid
= cfg
->line_out_pins
[i
];
6252 if (i
>= ARRAY_SIZE(alc861_dac_nids
))
6254 spec
->multiout
.dac_nids
[i
] = alc861_dac_nids
[i
];
6257 spec
->multiout
.num_dacs
= cfg
->line_outs
;
6261 /* add playback controls from the parsed DAC table */
6262 static int alc861_auto_create_multi_out_ctls(struct alc_spec
*spec
,
6263 const struct auto_pin_cfg
*cfg
)
6266 static const char *chname
[4] = { "Front", "Surround", NULL
/*CLFE*/, "Side" };
6270 for (i
= 0; i
< cfg
->line_outs
; i
++) {
6271 nid
= spec
->multiout
.dac_nids
[i
];
6276 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, "Center Playback Switch",
6277 HDA_COMPOSE_AMP_VAL(nid
, 1, 0, HDA_OUTPUT
))) < 0)
6279 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, "LFE Playback Switch",
6280 HDA_COMPOSE_AMP_VAL(nid
, 2, 0, HDA_OUTPUT
))) < 0)
6283 for (idx
= 0; idx
< ARRAY_SIZE(alc861_dac_nids
) - 1; idx
++)
6284 if (nid
== alc861_dac_nids
[idx
])
6286 sprintf(name
, "%s Playback Switch", chname
[idx
]);
6287 if ((err
= add_control(spec
, ALC_CTL_BIND_MUTE
, name
,
6288 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
6295 static int alc861_auto_create_hp_ctls(struct alc_spec
*spec
, hda_nid_t pin
)
6303 if ((pin
>= 0x0b && pin
<= 0x10) || pin
== 0x1f || pin
== 0x20) {
6305 if ((err
= add_control(spec
, ALC_CTL_WIDGET_MUTE
, "Headphone Playback Switch",
6306 HDA_COMPOSE_AMP_VAL(nid
, 3, 0, HDA_OUTPUT
))) < 0)
6308 spec
->multiout
.hp_nid
= nid
;
6313 /* create playback/capture controls for input pins */
6314 static int alc861_auto_create_analog_input_ctls(struct alc_spec
*spec
, const struct auto_pin_cfg
*cfg
)
6316 struct hda_input_mux
*imux
= &spec
->private_imux
;
6317 int i
, err
, idx
, idx1
;
6319 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
6320 switch(cfg
->input_pins
[i
]) {
6345 err
= new_analog_input(spec
, cfg
->input_pins
[i
],
6346 auto_pin_cfg_labels
[i
], idx
, 0x15);
6350 imux
->items
[imux
->num_items
].label
= auto_pin_cfg_labels
[i
];
6351 imux
->items
[imux
->num_items
].index
= idx1
;
6357 static struct snd_kcontrol_new alc861_capture_mixer
[] = {
6358 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT
),
6359 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT
),
6362 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
6363 /* The multiple "Capture Source" controls confuse alsamixer
6364 * So call somewhat different..
6365 *FIXME: the controls appear in the "playback" view!
6367 /* .name = "Capture Source", */
6368 .name
= "Input Source",
6370 .info
= alc_mux_enum_info
,
6371 .get
= alc_mux_enum_get
,
6372 .put
= alc_mux_enum_put
,
6377 static void alc861_auto_set_output_and_unmute(struct hda_codec
*codec
, hda_nid_t nid
,
6378 int pin_type
, int dac_idx
)
6382 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
, pin_type
);
6383 snd_hda_codec_write(codec
, dac_idx
, 0, AC_VERB_SET_AMP_GAIN_MUTE
, AMP_OUT_UNMUTE
);
6387 static void alc861_auto_init_multi_out(struct hda_codec
*codec
)
6389 struct alc_spec
*spec
= codec
->spec
;
6392 for (i
= 0; i
< spec
->autocfg
.line_outs
; i
++) {
6393 hda_nid_t nid
= spec
->autocfg
.line_out_pins
[i
];
6395 alc861_auto_set_output_and_unmute(codec
, nid
, PIN_OUT
, spec
->multiout
.dac_nids
[i
]);
6399 static void alc861_auto_init_hp_out(struct hda_codec
*codec
)
6401 struct alc_spec
*spec
= codec
->spec
;
6404 pin
= spec
->autocfg
.hp_pin
;
6405 if (pin
) /* connect to front */
6406 alc861_auto_set_output_and_unmute(codec
, pin
, PIN_HP
, spec
->multiout
.dac_nids
[0]);
6409 static void alc861_auto_init_analog_input(struct hda_codec
*codec
)
6411 struct alc_spec
*spec
= codec
->spec
;
6414 for (i
= 0; i
< AUTO_PIN_LAST
; i
++) {
6415 hda_nid_t nid
= spec
->autocfg
.input_pins
[i
];
6416 if ((nid
>=0x0c) && (nid
<=0x11)) {
6417 snd_hda_codec_write(codec
, nid
, 0, AC_VERB_SET_PIN_WIDGET_CONTROL
,
6418 i
<= AUTO_PIN_FRONT_MIC
? PIN_VREF80
: PIN_IN
);
6423 /* parse the BIOS configuration and set up the alc_spec */
6424 /* return 1 if successful, 0 if the proper config is not found, or a negative error code */
6425 static int alc861_parse_auto_config(struct hda_codec
*codec
)
6427 struct alc_spec
*spec
= codec
->spec
;
6429 static hda_nid_t alc861_ignore
[] = { 0x1d, 0 };
6431 if ((err
= snd_hda_parse_pin_def_config(codec
, &spec
->autocfg
,
6432 alc861_ignore
)) < 0)
6434 if (! spec
->autocfg
.line_outs
)
6435 return 0; /* can't find valid BIOS pin config */
6437 if ((err
= alc861_auto_fill_dac_nids(spec
, &spec
->autocfg
)) < 0 ||
6438 (err
= alc861_auto_create_multi_out_ctls(spec
, &spec
->autocfg
)) < 0 ||
6439 (err
= alc861_auto_create_hp_ctls(spec
, spec
->autocfg
.hp_pin
)) < 0 ||
6440 (err
= alc861_auto_create_analog_input_ctls(spec
, &spec
->autocfg
)) < 0)
6443 spec
->multiout
.max_channels
= spec
->multiout
.num_dacs
* 2;
6445 if (spec
->autocfg
.dig_out_pin
)
6446 spec
->multiout
.dig_out_nid
= ALC861_DIGOUT_NID
;
6448 if (spec
->kctl_alloc
)
6449 spec
->mixers
[spec
->num_mixers
++] = spec
->kctl_alloc
;
6451 spec
->init_verbs
[spec
->num_init_verbs
++] = alc861_auto_init_verbs
;
6453 spec
->num_mux_defs
= 1;
6454 spec
->input_mux
= &spec
->private_imux
;
6456 spec
->adc_nids
= alc861_adc_nids
;
6457 spec
->num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
);
6458 spec
->mixers
[spec
->num_mixers
] = alc861_capture_mixer
;
6464 /* additional initialization for auto-configuration model */
6465 static void alc861_auto_init(struct hda_codec
*codec
)
6467 alc861_auto_init_multi_out(codec
);
6468 alc861_auto_init_hp_out(codec
);
6469 alc861_auto_init_analog_input(codec
);
6474 * configuration and preset
6476 static struct hda_board_config alc861_cfg_tbl
[] = {
6477 { .modelname
= "3stack", .config
= ALC861_3ST
},
6478 { .pci_subvendor
= 0x8086, .pci_subdevice
= 0xd600,
6479 .config
= ALC861_3ST
},
6480 { .pci_subvendor
= 0x1043, .pci_subdevice
= 0x81e7,
6481 .config
= ALC660_3ST
},
6482 { .modelname
= "3stack-dig", .config
= ALC861_3ST_DIG
},
6483 { .modelname
= "6stack-dig", .config
= ALC861_6ST_DIG
},
6484 { .modelname
= "auto", .config
= ALC861_AUTO
},
6488 static struct alc_config_preset alc861_presets
[] = {
6490 .mixers
= { alc861_3ST_mixer
},
6491 .init_verbs
= { alc861_threestack_init_verbs
},
6492 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
6493 .dac_nids
= alc861_dac_nids
,
6494 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
6495 .channel_mode
= alc861_threestack_modes
,
6496 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
6497 .adc_nids
= alc861_adc_nids
,
6498 .input_mux
= &alc861_capture_source
,
6500 [ALC861_3ST_DIG
] = {
6501 .mixers
= { alc861_base_mixer
},
6502 .init_verbs
= { alc861_threestack_init_verbs
},
6503 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
6504 .dac_nids
= alc861_dac_nids
,
6505 .dig_out_nid
= ALC861_DIGOUT_NID
,
6506 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
6507 .channel_mode
= alc861_threestack_modes
,
6508 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
6509 .adc_nids
= alc861_adc_nids
,
6510 .input_mux
= &alc861_capture_source
,
6512 [ALC861_6ST_DIG
] = {
6513 .mixers
= { alc861_base_mixer
},
6514 .init_verbs
= { alc861_base_init_verbs
},
6515 .num_dacs
= ARRAY_SIZE(alc861_dac_nids
),
6516 .dac_nids
= alc861_dac_nids
,
6517 .dig_out_nid
= ALC861_DIGOUT_NID
,
6518 .num_channel_mode
= ARRAY_SIZE(alc861_8ch_modes
),
6519 .channel_mode
= alc861_8ch_modes
,
6520 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
6521 .adc_nids
= alc861_adc_nids
,
6522 .input_mux
= &alc861_capture_source
,
6525 .mixers
= { alc861_3ST_mixer
},
6526 .init_verbs
= { alc861_threestack_init_verbs
},
6527 .num_dacs
= ARRAY_SIZE(alc660_dac_nids
),
6528 .dac_nids
= alc660_dac_nids
,
6529 .num_channel_mode
= ARRAY_SIZE(alc861_threestack_modes
),
6530 .channel_mode
= alc861_threestack_modes
,
6531 .num_adc_nids
= ARRAY_SIZE(alc861_adc_nids
),
6532 .adc_nids
= alc861_adc_nids
,
6533 .input_mux
= &alc861_capture_source
,
6538 static int patch_alc861(struct hda_codec
*codec
)
6540 struct alc_spec
*spec
;
6544 spec
= kcalloc(1, sizeof(*spec
), GFP_KERNEL
);
6550 board_config
= snd_hda_check_board_config(codec
, alc861_cfg_tbl
);
6552 if (board_config
< 0 || board_config
>= ALC861_MODEL_LAST
) {
6553 printk(KERN_INFO
"hda_codec: Unknown model for ALC861, "
6554 "trying auto-probe from BIOS...\n");
6555 board_config
= ALC861_AUTO
;
6558 if (board_config
== ALC861_AUTO
) {
6559 /* automatic parse from the BIOS config */
6560 err
= alc861_parse_auto_config(codec
);
6566 "hda_codec: Cannot set up configuration "
6567 "from BIOS. Using base mode...\n");
6568 board_config
= ALC861_3ST_DIG
;
6572 if (board_config
!= ALC861_AUTO
)
6573 setup_preset(spec
, &alc861_presets
[board_config
]);
6575 spec
->stream_name_analog
= "ALC861 Analog";
6576 spec
->stream_analog_playback
= &alc861_pcm_analog_playback
;
6577 spec
->stream_analog_capture
= &alc861_pcm_analog_capture
;
6579 spec
->stream_name_digital
= "ALC861 Digital";
6580 spec
->stream_digital_playback
= &alc861_pcm_digital_playback
;
6581 spec
->stream_digital_capture
= &alc861_pcm_digital_capture
;
6583 codec
->patch_ops
= alc_patch_ops
;
6584 if (board_config
== ALC861_AUTO
)
6585 spec
->init_hook
= alc861_auto_init
;
6593 struct hda_codec_preset snd_hda_preset_realtek
[] = {
6594 { .id
= 0x10ec0260, .name
= "ALC260", .patch
= patch_alc260
},
6595 { .id
= 0x10ec0262, .name
= "ALC262", .patch
= patch_alc262
},
6596 { .id
= 0x10ec0880, .name
= "ALC880", .patch
= patch_alc880
},
6597 { .id
= 0x10ec0882, .name
= "ALC882", .patch
= patch_alc882
},
6598 { .id
= 0x10ec0883, .name
= "ALC883", .patch
= patch_alc883
},
6599 { .id
= 0x10ec0885, .name
= "ALC885", .patch
= patch_alc882
},
6600 { .id
= 0x10ec0888, .name
= "ALC888", .patch
= patch_alc883
},
6601 { .id
= 0x10ec0861, .rev
= 0x100300, .name
= "ALC861",
6602 .patch
= patch_alc861
},
6603 { .id
= 0x10ec0861, .rev
= 0x100340, .name
= "ALC660",
6604 .patch
= patch_alc861
},