aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-02 12:26:49 -0500
committerJaroslav Kysela <perex@suse.cz>2005-11-04 07:25:53 -0500
commit985be54ba8b042923f5a76276a1c0490aa8af7a1 (patch)
tree93abfe8da6aa0b1ddfce2c71ff3251e05f1e3465 /sound/pci/hda/patch_realtek.c
parentb7027cc29e158ec2d1c5e53c69f3e9e6a0d02a48 (diff)
[ALSA] hda-codec - Minor rewrites
Modules: HDA Codec driver,HDA generic driver - Make bound controls global to all patches - Clean up analog patches (for the upcoming extension to AD1988) Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c152
1 files changed, 40 insertions, 112 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 48356ab04579..cffb83fdcff7 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -115,8 +115,6 @@ struct alc_spec {
115 /* PCM information */ 115 /* PCM information */
116 struct hda_pcm pcm_rec[2]; /* used in alc_build_pcms() */ 116 struct hda_pcm pcm_rec[2]; /* used in alc_build_pcms() */
117 117
118 struct semaphore bind_mutex; /* for bound controls */
119
120 /* dynamic controls, init_verbs and input_mux */ 118 /* dynamic controls, init_verbs and input_mux */
121 struct auto_pin_cfg autocfg; 119 struct auto_pin_cfg autocfg;
122 unsigned int num_kctl_alloc, num_kctl_used; 120 unsigned int num_kctl_alloc, num_kctl_used;
@@ -220,73 +218,6 @@ static int alc880_ch_mode_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc
220 218
221 219
222/* 220/*
223 * bound volume controls
224 *
225 * bind multiple volumes (# indices, from 0)
226 */
227
228#define AMP_VAL_IDX_SHIFT 19
229#define AMP_VAL_IDX_MASK (0x0f<<19)
230
231static int alc_bind_switch_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
232{
233 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
234 struct alc_spec *spec = codec->spec;
235 unsigned long pval;
236
237 down(&spec->bind_mutex);
238 pval = kcontrol->private_value;
239 kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */
240 snd_hda_mixer_amp_switch_info(kcontrol, uinfo);
241 kcontrol->private_value = pval;
242 up(&spec->bind_mutex);
243 return 0;
244}
245
246static int alc_bind_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
247{
248 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
249 struct alc_spec *spec = codec->spec;
250 unsigned long pval;
251
252 down(&spec->bind_mutex);
253 pval = kcontrol->private_value;
254 kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */
255 snd_hda_mixer_amp_switch_get(kcontrol, ucontrol);
256 kcontrol->private_value = pval;
257 up(&spec->bind_mutex);
258 return 0;
259}
260
261static int alc_bind_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
262{
263 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
264 struct alc_spec *spec = codec->spec;
265 unsigned long pval;
266 int i, indices, change = 0;
267
268 down(&spec->bind_mutex);
269 pval = kcontrol->private_value;
270 indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT;
271 for (i = 0; i < indices; i++) {
272 kcontrol->private_value = (pval & ~AMP_VAL_IDX_MASK) | (i << AMP_VAL_IDX_SHIFT);
273 change |= snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
274 }
275 kcontrol->private_value = pval;
276 up(&spec->bind_mutex);
277 return change;
278}
279
280#define ALC_BIND_MUTE_MONO(xname, nid, channel, indices, direction) \
281 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
282 .info = alc_bind_switch_info, \
283 .get = alc_bind_switch_get, \
284 .put = alc_bind_switch_put, \
285 .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, indices, direction) }
286
287#define ALC_BIND_MUTE(xname,nid,indices,dir) ALC_BIND_MUTE_MONO(xname,nid,3,indices,dir)
288
289/*
290 * Control of pin widget settings via the mixer. Only boolean settings are 221 * Control of pin widget settings via the mixer. Only boolean settings are
291 * supported, so VrefEn can't be controlled using these functions as they 222 * supported, so VrefEn can't be controlled using these functions as they
292 * stand. 223 * stand.
@@ -404,13 +335,13 @@ static struct alc_channel_mode alc880_threestack_modes[2] = {
404 335
405static snd_kcontrol_new_t alc880_three_stack_mixer[] = { 336static snd_kcontrol_new_t alc880_three_stack_mixer[] = {
406 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 337 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
407 ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 338 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
408 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 339 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
409 ALC_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), 340 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
410 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 341 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
411 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 342 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
412 ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 343 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
413 ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 344 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
414 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 345 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
415 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 346 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
416 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 347 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
@@ -491,7 +422,7 @@ static snd_kcontrol_new_t alc880_capture_alt_mixer[] = {
491/* additional mixers to alc880_three_stack_mixer */ 422/* additional mixers to alc880_three_stack_mixer */
492static snd_kcontrol_new_t alc880_five_stack_mixer[] = { 423static snd_kcontrol_new_t alc880_five_stack_mixer[] = {
493 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 424 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
494 ALC_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), 425 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
495 { } /* end */ 426 { } /* end */
496}; 427};
497 428
@@ -548,15 +479,15 @@ static struct alc_channel_mode alc880_sixstack_modes[1] = {
548 479
549static snd_kcontrol_new_t alc880_six_stack_mixer[] = { 480static snd_kcontrol_new_t alc880_six_stack_mixer[] = {
550 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 481 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
551 ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 482 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
552 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 483 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
553 ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 484 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
554 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 485 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
555 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 486 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
556 ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 487 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
557 ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 488 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
558 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 489 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
559 ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), 490 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
560 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 491 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
561 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 492 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
562 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 493 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
@@ -616,13 +547,13 @@ static struct alc_channel_mode alc880_w810_modes[1] = {
616/* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ 547/* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
617static snd_kcontrol_new_t alc880_w810_base_mixer[] = { 548static snd_kcontrol_new_t alc880_w810_base_mixer[] = {
618 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 549 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
619 ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 550 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
620 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 551 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
621 ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 552 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
622 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 553 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
623 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 554 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
624 ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 555 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
625 ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 556 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
626 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 557 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
627 { } /* end */ 558 { } /* end */
628}; 559};
@@ -647,9 +578,9 @@ static struct alc_channel_mode alc880_2_jack_modes[1] = {
647 578
648static snd_kcontrol_new_t alc880_z71v_mixer[] = { 579static snd_kcontrol_new_t alc880_z71v_mixer[] = {
649 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 580 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
650 ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 581 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
651 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 582 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
652 ALC_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), 583 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
653 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 584 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
654 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 585 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
655 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 586 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
@@ -673,9 +604,9 @@ static hda_nid_t alc880_f1734_dac_nids[1] = {
673 604
674static snd_kcontrol_new_t alc880_f1734_mixer[] = { 605static snd_kcontrol_new_t alc880_f1734_mixer[] = {
675 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 606 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
676 ALC_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), 607 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
677 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 608 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
678 ALC_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), 609 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
679 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 610 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
680 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 611 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 612 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
@@ -698,13 +629,13 @@ static snd_kcontrol_new_t alc880_f1734_mixer[] = {
698 629
699static snd_kcontrol_new_t alc880_asus_mixer[] = { 630static snd_kcontrol_new_t alc880_asus_mixer[] = {
700 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 631 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
701 ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 632 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
702 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 633 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
703 ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 634 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
704 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 635 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
705 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 636 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
706 ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 637 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
707 ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 638 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
708 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 639 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
709 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 640 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
710 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 641 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
@@ -1433,10 +1364,10 @@ static snd_kcontrol_new_t alc880_test_mixer[] = {
1433 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 1364 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1434 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), 1365 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
1435 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 1366 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1436 ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 1367 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1437 ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 1368 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1438 ALC_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), 1369 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
1439 ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), 1370 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1440 PIN_CTL_TEST("Front Pin Mode", 0x14), 1371 PIN_CTL_TEST("Front Pin Mode", 0x14),
1441 PIN_CTL_TEST("Surround Pin Mode", 0x15), 1372 PIN_CTL_TEST("Surround Pin Mode", 0x15),
1442 PIN_CTL_TEST("CLFE Pin Mode", 0x16), 1373 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
@@ -1819,7 +1750,7 @@ enum {
1819static snd_kcontrol_new_t alc880_control_templates[] = { 1750static snd_kcontrol_new_t alc880_control_templates[] = {
1820 HDA_CODEC_VOLUME(NULL, 0, 0, 0), 1751 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
1821 HDA_CODEC_MUTE(NULL, 0, 0, 0), 1752 HDA_CODEC_MUTE(NULL, 0, 0, 0),
1822 ALC_BIND_MUTE(NULL, 0, 0, 0), 1753 HDA_BIND_MUTE(NULL, 0, 0, 0),
1823}; 1754};
1824 1755
1825/* add dynamic controls */ 1756/* add dynamic controls */
@@ -2137,7 +2068,6 @@ static int patch_alc880(struct hda_codec *codec)
2137 if (spec == NULL) 2068 if (spec == NULL)
2138 return -ENOMEM; 2069 return -ENOMEM;
2139 2070
2140 init_MUTEX(&spec->bind_mutex);
2141 codec->spec = spec; 2071 codec->spec = spec;
2142 2072
2143 board_config = snd_hda_check_board_config(codec, alc880_cfg_tbl); 2073 board_config = snd_hda_check_board_config(codec, alc880_cfg_tbl);
@@ -2278,7 +2208,7 @@ static struct alc_channel_mode alc260_modes[1] = {
2278 2208
2279static snd_kcontrol_new_t alc260_base_mixer[] = { 2209static snd_kcontrol_new_t alc260_base_mixer[] = {
2280 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), 2210 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
2281 ALC_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), 2211 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
2282 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 2212 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
2283 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 2213 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
2284 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), 2214 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
@@ -2290,9 +2220,9 @@ static snd_kcontrol_new_t alc260_base_mixer[] = {
2290 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), 2220 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),
2291 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), 2221 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),
2292 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), 2222 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
2293 ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), 2223 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
2294 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), 2224 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
2295 ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), 2225 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
2296 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), 2226 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
2297 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), 2227 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
2298 { 2228 {
@@ -2307,7 +2237,7 @@ static snd_kcontrol_new_t alc260_base_mixer[] = {
2307 2237
2308static snd_kcontrol_new_t alc260_hp_mixer[] = { 2238static snd_kcontrol_new_t alc260_hp_mixer[] = {
2309 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), 2239 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
2310 ALC_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), 2240 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
2311 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 2241 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
2312 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 2242 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
2313 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), 2243 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
@@ -2317,9 +2247,9 @@ static snd_kcontrol_new_t alc260_hp_mixer[] = {
2317 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), 2247 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
2318 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), 2248 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
2319 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), 2249 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
2320 ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), 2250 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
2321 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), 2251 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
2322 ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), 2252 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
2323 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), 2253 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT),
2324 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), 2254 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT),
2325 { 2255 {
@@ -2334,7 +2264,7 @@ static snd_kcontrol_new_t alc260_hp_mixer[] = {
2334 2264
2335static snd_kcontrol_new_t alc260_fujitsu_mixer[] = { 2265static snd_kcontrol_new_t alc260_fujitsu_mixer[] = {
2336 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), 2266 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
2337 ALC_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), 2267 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
2338 ALC_PINCTL_SWITCH("Headphone Amp Switch", 0x14, PIN_HP_AMP), 2268 ALC_PINCTL_SWITCH("Headphone Amp Switch", 0x14, PIN_HP_AMP),
2339 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 2269 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
2340 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 2270 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
@@ -2343,7 +2273,7 @@ static snd_kcontrol_new_t alc260_fujitsu_mixer[] = {
2343 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), 2273 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
2344 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), 2274 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
2345 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), 2275 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
2346 ALC_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), 2276 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT),
2347 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), 2277 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
2348 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), 2278 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT),
2349 { 2279 {
@@ -2500,7 +2430,6 @@ static int patch_alc260(struct hda_codec *codec)
2500 if (spec == NULL) 2430 if (spec == NULL)
2501 return -ENOMEM; 2431 return -ENOMEM;
2502 2432
2503 init_MUTEX(&spec->bind_mutex);
2504 codec->spec = spec; 2433 codec->spec = spec;
2505 2434
2506 board_config = snd_hda_check_board_config(codec, alc260_cfg_tbl); 2435 board_config = snd_hda_check_board_config(codec, alc260_cfg_tbl);
@@ -2637,15 +2566,15 @@ static int alc882_mux_enum_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u
2637 */ 2566 */
2638static snd_kcontrol_new_t alc882_base_mixer[] = { 2567static snd_kcontrol_new_t alc882_base_mixer[] = {
2639 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 2568 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2640 ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 2569 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2641 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 2570 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2642 ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 2571 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2643 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 2572 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2644 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 2573 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2645 ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 2574 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2646 ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 2575 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2647 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 2576 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2648 ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), 2577 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2649 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 2578 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2650 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 2579 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2651 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 2580 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
@@ -2763,7 +2692,6 @@ static int patch_alc882(struct hda_codec *codec)
2763 if (spec == NULL) 2692 if (spec == NULL)
2764 return -ENOMEM; 2693 return -ENOMEM;
2765 2694
2766 init_MUTEX(&spec->bind_mutex);
2767 codec->spec = spec; 2695 codec->spec = spec;
2768 2696
2769 spec->mixers[spec->num_mixers] = alc882_base_mixer; 2697 spec->mixers[spec->num_mixers] = alc882_base_mixer;