aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/ad1816a/ad1816a_lib.c15
-rw-r--r--sound/isa/ad1848/ad1848.c4
-rw-r--r--sound/isa/ad1848/ad1848_lib.c18
-rw-r--r--sound/isa/cs423x/cs4231.c4
-rw-r--r--sound/isa/cs423x/cs4231_lib.c30
-rw-r--r--sound/isa/cs423x/cs4236.c6
-rw-r--r--sound/isa/cs423x/cs4236_lib.c6
-rw-r--r--sound/isa/es1688/es1688.c4
-rw-r--r--sound/isa/es18xx.c223
-rw-r--r--sound/isa/gus/gus_dma.c10
-rw-r--r--sound/isa/gus/gus_main.c2
-rw-r--r--sound/isa/gus/gus_mem.c14
-rw-r--r--sound/isa/gus/gus_pcm.c2
-rw-r--r--sound/isa/gus/gus_synth.c14
-rw-r--r--sound/isa/gus/gusclassic.c4
-rw-r--r--sound/isa/gus/gusextreme.c4
-rw-r--r--sound/isa/gus/gusmax.c4
-rw-r--r--sound/isa/gus/interwave.c4
-rw-r--r--sound/isa/opl3sa2.c4
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c6
-rw-r--r--sound/isa/sb/sb16.c4
-rw-r--r--sound/isa/sb/sb16_csp.c12
-rw-r--r--sound/isa/sb/sb8.c4
-rw-r--r--sound/isa/sb/sb_mixer.c4
-rw-r--r--sound/isa/sgalaxy.c4
-rw-r--r--sound/isa/wavefront/wavefront.c4
26 files changed, 296 insertions, 114 deletions
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c
index ac0d808fff57..fd8fe16c09ee 100644
--- a/sound/isa/ad1816a/ad1816a_lib.c
+++ b/sound/isa/ad1816a/ad1816a_lib.c
@@ -1,4 +1,3 @@
1
2/* 1/*
3 ad1816a.c - lowlevel code for Analog Devices AD1816A chip. 2 ad1816a.c - lowlevel code for Analog Devices AD1816A chip.
4 Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it> 3 Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it>
@@ -175,7 +174,7 @@ static void snd_ad1816a_close(struct snd_ad1816a *chip, unsigned int mode)
175 174
176 175
177static int snd_ad1816a_trigger(struct snd_ad1816a *chip, unsigned char what, 176static int snd_ad1816a_trigger(struct snd_ad1816a *chip, unsigned char what,
178 int channel, int cmd) 177 int channel, int cmd, int iscapture)
179{ 178{
180 int error = 0; 179 int error = 0;
181 180
@@ -184,10 +183,14 @@ static int snd_ad1816a_trigger(struct snd_ad1816a *chip, unsigned char what,
184 case SNDRV_PCM_TRIGGER_STOP: 183 case SNDRV_PCM_TRIGGER_STOP:
185 spin_lock(&chip->lock); 184 spin_lock(&chip->lock);
186 cmd = (cmd == SNDRV_PCM_TRIGGER_START) ? 0xff: 0x00; 185 cmd = (cmd == SNDRV_PCM_TRIGGER_START) ? 0xff: 0x00;
187 if (what & AD1816A_PLAYBACK_ENABLE) 186 /* if (what & AD1816A_PLAYBACK_ENABLE) */
187 /* That is not valid, because playback and capture enable
188 * are the same bit pattern, just to different addresses
189 */
190 if (! iscapture)
188 snd_ad1816a_out_mask(chip, AD1816A_PLAYBACK_CONFIG, 191 snd_ad1816a_out_mask(chip, AD1816A_PLAYBACK_CONFIG,
189 AD1816A_PLAYBACK_ENABLE, cmd); 192 AD1816A_PLAYBACK_ENABLE, cmd);
190 if (what & AD1816A_CAPTURE_ENABLE) 193 else
191 snd_ad1816a_out_mask(chip, AD1816A_CAPTURE_CONFIG, 194 snd_ad1816a_out_mask(chip, AD1816A_CAPTURE_CONFIG,
192 AD1816A_CAPTURE_ENABLE, cmd); 195 AD1816A_CAPTURE_ENABLE, cmd);
193 spin_unlock(&chip->lock); 196 spin_unlock(&chip->lock);
@@ -204,14 +207,14 @@ static int snd_ad1816a_playback_trigger(struct snd_pcm_substream *substream, int
204{ 207{
205 struct snd_ad1816a *chip = snd_pcm_substream_chip(substream); 208 struct snd_ad1816a *chip = snd_pcm_substream_chip(substream);
206 return snd_ad1816a_trigger(chip, AD1816A_PLAYBACK_ENABLE, 209 return snd_ad1816a_trigger(chip, AD1816A_PLAYBACK_ENABLE,
207 SNDRV_PCM_STREAM_PLAYBACK, cmd); 210 SNDRV_PCM_STREAM_PLAYBACK, cmd, 0);
208} 211}
209 212
210static int snd_ad1816a_capture_trigger(struct snd_pcm_substream *substream, int cmd) 213static int snd_ad1816a_capture_trigger(struct snd_pcm_substream *substream, int cmd)
211{ 214{
212 struct snd_ad1816a *chip = snd_pcm_substream_chip(substream); 215 struct snd_ad1816a *chip = snd_pcm_substream_chip(substream);
213 return snd_ad1816a_trigger(chip, AD1816A_CAPTURE_ENABLE, 216 return snd_ad1816a_trigger(chip, AD1816A_CAPTURE_ENABLE,
214 SNDRV_PCM_STREAM_CAPTURE, cmd); 217 SNDRV_PCM_STREAM_CAPTURE, cmd, 1);
215} 218}
216 219
217static int snd_ad1816a_hw_params(struct snd_pcm_substream *substream, 220static int snd_ad1816a_hw_params(struct snd_pcm_substream *substream,
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
index e091bbeffd2a..326a057f752f 100644
--- a/sound/isa/ad1848/ad1848.c
+++ b/sound/isa/ad1848/ad1848.c
@@ -187,8 +187,10 @@ static int __init alsa_card_ad1848_init(void)
187 return err; 187 return err;
188 188
189 cards = 0; 189 cards = 0;
190 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 190 for (i = 0; i < SNDRV_CARDS; i++) {
191 struct platform_device *device; 191 struct platform_device *device;
192 if (! enable[i])
193 continue;
192 device = platform_device_register_simple(SND_AD1848_DRIVER, 194 device = platform_device_register_simple(SND_AD1848_DRIVER,
193 i, NULL, 0); 195 i, NULL, 0);
194 if (IS_ERR(device)) { 196 if (IS_ERR(device)) {
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
index b78530d7ea90..e0f8baa843b9 100644
--- a/sound/isa/ad1848/ad1848_lib.c
+++ b/sound/isa/ad1848/ad1848_lib.c
@@ -387,9 +387,9 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode)
387{ 387{
388 unsigned long flags; 388 unsigned long flags;
389 389
390 down(&chip->open_mutex); 390 mutex_lock(&chip->open_mutex);
391 if (chip->mode & AD1848_MODE_OPEN) { 391 if (chip->mode & AD1848_MODE_OPEN) {
392 up(&chip->open_mutex); 392 mutex_unlock(&chip->open_mutex);
393 return -EAGAIN; 393 return -EAGAIN;
394 } 394 }
395 snd_ad1848_mce_down(chip); 395 snd_ad1848_mce_down(chip);
@@ -432,7 +432,7 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode)
432 spin_unlock_irqrestore(&chip->reg_lock, flags); 432 spin_unlock_irqrestore(&chip->reg_lock, flags);
433 433
434 chip->mode = mode; 434 chip->mode = mode;
435 up(&chip->open_mutex); 435 mutex_unlock(&chip->open_mutex);
436 436
437 return 0; 437 return 0;
438} 438}
@@ -441,9 +441,9 @@ static void snd_ad1848_close(struct snd_ad1848 *chip)
441{ 441{
442 unsigned long flags; 442 unsigned long flags;
443 443
444 down(&chip->open_mutex); 444 mutex_lock(&chip->open_mutex);
445 if (!chip->mode) { 445 if (!chip->mode) {
446 up(&chip->open_mutex); 446 mutex_unlock(&chip->open_mutex);
447 return; 447 return;
448 } 448 }
449 /* disable IRQ */ 449 /* disable IRQ */
@@ -471,7 +471,7 @@ static void snd_ad1848_close(struct snd_ad1848 *chip)
471 spin_unlock_irqrestore(&chip->reg_lock, flags); 471 spin_unlock_irqrestore(&chip->reg_lock, flags);
472 472
473 chip->mode = 0; 473 chip->mode = 0;
474 up(&chip->open_mutex); 474 mutex_unlock(&chip->open_mutex);
475} 475}
476 476
477/* 477/*
@@ -889,7 +889,7 @@ int snd_ad1848_create(struct snd_card *card,
889 if (chip == NULL) 889 if (chip == NULL)
890 return -ENOMEM; 890 return -ENOMEM;
891 spin_lock_init(&chip->reg_lock); 891 spin_lock_init(&chip->reg_lock);
892 init_MUTEX(&chip->open_mutex); 892 mutex_init(&chip->open_mutex);
893 chip->card = card; 893 chip->card = card;
894 chip->port = port; 894 chip->port = port;
895 chip->irq = -1; 895 chip->irq = -1;
@@ -1202,10 +1202,8 @@ int snd_ad1848_add_ctl(struct snd_ad1848 *chip, const char *name, int index, int
1202 strlcpy(ctl->id.name, name, sizeof(ctl->id.name)); 1202 strlcpy(ctl->id.name, name, sizeof(ctl->id.name));
1203 ctl->id.index = index; 1203 ctl->id.index = index;
1204 ctl->private_value = value; 1204 ctl->private_value = value;
1205 if ((err = snd_ctl_add(chip->card, ctl)) < 0) { 1205 if ((err = snd_ctl_add(chip->card, ctl)) < 0)
1206 snd_ctl_free_one(ctl);
1207 return err; 1206 return err;
1208 }
1209 return 0; 1207 return 0;
1210} 1208}
1211 1209
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
index ab67b5c2590d..a30dcd962525 100644
--- a/sound/isa/cs423x/cs4231.c
+++ b/sound/isa/cs423x/cs4231.c
@@ -203,8 +203,10 @@ static int __init alsa_card_cs4231_init(void)
203 return err; 203 return err;
204 204
205 cards = 0; 205 cards = 0;
206 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 206 for (i = 0; i < SNDRV_CARDS; i++) {
207 struct platform_device *device; 207 struct platform_device *device;
208 if (! enable[i])
209 continue;
208 device = platform_device_register_simple(SND_CS4231_DRIVER, 210 device = platform_device_register_simple(SND_CS4231_DRIVER,
209 i, NULL, 0); 211 i, NULL, 0);
210 if (IS_ERR(device)) { 212 if (IS_ERR(device)) {
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c
index eab7eb59b5f7..823db8246701 100644
--- a/sound/isa/cs423x/cs4231_lib.c
+++ b/sound/isa/cs423x/cs4231_lib.c
@@ -531,7 +531,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip,
531 unsigned long flags; 531 unsigned long flags;
532 int full_calib = 1; 532 int full_calib = 1;
533 533
534 down(&chip->mce_mutex); 534 mutex_lock(&chip->mce_mutex);
535 snd_cs4231_calibrate_mute(chip, 1); 535 snd_cs4231_calibrate_mute(chip, 1);
536 if (chip->hardware == CS4231_HW_CS4231A || 536 if (chip->hardware == CS4231_HW_CS4231A ||
537 (chip->hardware & CS4231_HW_CS4232_MASK)) { 537 (chip->hardware & CS4231_HW_CS4232_MASK)) {
@@ -560,7 +560,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip,
560 snd_cs4231_mce_down(chip); 560 snd_cs4231_mce_down(chip);
561 } 561 }
562 snd_cs4231_calibrate_mute(chip, 0); 562 snd_cs4231_calibrate_mute(chip, 0);
563 up(&chip->mce_mutex); 563 mutex_unlock(&chip->mce_mutex);
564} 564}
565 565
566static void snd_cs4231_capture_format(struct snd_cs4231 *chip, 566static void snd_cs4231_capture_format(struct snd_cs4231 *chip,
@@ -570,7 +570,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip,
570 unsigned long flags; 570 unsigned long flags;
571 int full_calib = 1; 571 int full_calib = 1;
572 572
573 down(&chip->mce_mutex); 573 mutex_lock(&chip->mce_mutex);
574 snd_cs4231_calibrate_mute(chip, 1); 574 snd_cs4231_calibrate_mute(chip, 1);
575 if (chip->hardware == CS4231_HW_CS4231A || 575 if (chip->hardware == CS4231_HW_CS4231A ||
576 (chip->hardware & CS4231_HW_CS4232_MASK)) { 576 (chip->hardware & CS4231_HW_CS4232_MASK)) {
@@ -603,7 +603,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip,
603 snd_cs4231_mce_down(chip); 603 snd_cs4231_mce_down(chip);
604 } 604 }
605 snd_cs4231_calibrate_mute(chip, 0); 605 snd_cs4231_calibrate_mute(chip, 0);
606 up(&chip->mce_mutex); 606 mutex_unlock(&chip->mce_mutex);
607} 607}
608 608
609/* 609/*
@@ -709,15 +709,15 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
709{ 709{
710 unsigned long flags; 710 unsigned long flags;
711 711
712 down(&chip->open_mutex); 712 mutex_lock(&chip->open_mutex);
713 if ((chip->mode & mode) || 713 if ((chip->mode & mode) ||
714 ((chip->mode & CS4231_MODE_OPEN) && chip->single_dma)) { 714 ((chip->mode & CS4231_MODE_OPEN) && chip->single_dma)) {
715 up(&chip->open_mutex); 715 mutex_unlock(&chip->open_mutex);
716 return -EAGAIN; 716 return -EAGAIN;
717 } 717 }
718 if (chip->mode & CS4231_MODE_OPEN) { 718 if (chip->mode & CS4231_MODE_OPEN) {
719 chip->mode |= mode; 719 chip->mode |= mode;
720 up(&chip->open_mutex); 720 mutex_unlock(&chip->open_mutex);
721 return 0; 721 return 0;
722 } 722 }
723 /* ok. now enable and ack CODEC IRQ */ 723 /* ok. now enable and ack CODEC IRQ */
@@ -737,7 +737,7 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
737 spin_unlock_irqrestore(&chip->reg_lock, flags); 737 spin_unlock_irqrestore(&chip->reg_lock, flags);
738 738
739 chip->mode = mode; 739 chip->mode = mode;
740 up(&chip->open_mutex); 740 mutex_unlock(&chip->open_mutex);
741 return 0; 741 return 0;
742} 742}
743 743
@@ -745,10 +745,10 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode)
745{ 745{
746 unsigned long flags; 746 unsigned long flags;
747 747
748 down(&chip->open_mutex); 748 mutex_lock(&chip->open_mutex);
749 chip->mode &= ~mode; 749 chip->mode &= ~mode;
750 if (chip->mode & CS4231_MODE_OPEN) { 750 if (chip->mode & CS4231_MODE_OPEN) {
751 up(&chip->open_mutex); 751 mutex_unlock(&chip->open_mutex);
752 return; 752 return;
753 } 753 }
754 snd_cs4231_calibrate_mute(chip, 1); 754 snd_cs4231_calibrate_mute(chip, 1);
@@ -785,7 +785,7 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode)
785 snd_cs4231_calibrate_mute(chip, 0); 785 snd_cs4231_calibrate_mute(chip, 0);
786 786
787 chip->mode = 0; 787 chip->mode = 0;
788 up(&chip->open_mutex); 788 mutex_unlock(&chip->open_mutex);
789} 789}
790 790
791/* 791/*
@@ -1408,8 +1408,8 @@ static int snd_cs4231_new(struct snd_card *card,
1408 chip->hwshare = hwshare; 1408 chip->hwshare = hwshare;
1409 1409
1410 spin_lock_init(&chip->reg_lock); 1410 spin_lock_init(&chip->reg_lock);
1411 init_MUTEX(&chip->mce_mutex); 1411 mutex_init(&chip->mce_mutex);
1412 init_MUTEX(&chip->open_mutex); 1412 mutex_init(&chip->open_mutex);
1413 chip->card = card; 1413 chip->card = card;
1414 chip->rate_constraint = snd_cs4231_xrate; 1414 chip->rate_constraint = snd_cs4231_xrate;
1415 chip->set_playback_format = snd_cs4231_playback_format; 1415 chip->set_playback_format = snd_cs4231_playback_format;
@@ -1538,8 +1538,8 @@ int snd_cs4231_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm)
1538 return err; 1538 return err;
1539 1539
1540 spin_lock_init(&chip->reg_lock); 1540 spin_lock_init(&chip->reg_lock);
1541 init_MUTEX(&chip->mce_mutex); 1541 mutex_init(&chip->mce_mutex);
1542 init_MUTEX(&chip->open_mutex); 1542 mutex_init(&chip->open_mutex);
1543 1543
1544 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cs4231_playback_ops); 1544 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cs4231_playback_ops);
1545 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cs4231_capture_ops); 1545 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cs4231_capture_ops);
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 4fa431040564..4060918e0327 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -414,7 +414,7 @@ static int __devinit snd_card_cs423x_pnpc(int dev, struct snd_card_cs4236 *acard
414 } 414 }
415 /* MPU initialization */ 415 /* MPU initialization */
416 if (acard->mpu && mpu_port[dev] > 0) { 416 if (acard->mpu && mpu_port[dev] > 0) {
417 if (snd_cs423x_pnp_init_mpu(dev, acard->ctrl, cfg) < 0) 417 if (snd_cs423x_pnp_init_mpu(dev, acard->mpu, cfg) < 0)
418 goto error; 418 goto error;
419 } 419 }
420 kfree(cfg); 420 kfree(cfg);
@@ -771,9 +771,9 @@ static int __init alsa_card_cs423x_init(void)
771 if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0) 771 if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0)
772 return err; 772 return err;
773 773
774 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 774 for (i = 0; i < SNDRV_CARDS; i++) {
775 struct platform_device *device; 775 struct platform_device *device;
776 if (is_isapnp_selected(i)) 776 if (! enable[i] || is_isapnp_selected(i))
777 continue; 777 continue;
778 device = platform_device_register_simple(CS423X_DRIVER, 778 device = platform_device_register_simple(CS423X_DRIVER,
779 i, NULL, 0); 779 i, NULL, 0);
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c
index e36981d64ec5..7a5a6c71f5e4 100644
--- a/sound/isa/cs423x/cs4236_lib.c
+++ b/sound/isa/cs423x/cs4236_lib.c
@@ -644,7 +644,7 @@ static int snd_cs4236_put_master_digital(struct snd_kcontrol *kcontrol, struct s
644 val2 = (chip->eimage[CS4236_REG(CS4236_RIGHT_MASTER)] & ~0x7f) | val2; 644 val2 = (chip->eimage[CS4236_REG(CS4236_RIGHT_MASTER)] & ~0x7f) | val2;
645 change = val1 != chip->eimage[CS4236_REG(CS4236_LEFT_MASTER)] || val2 != chip->eimage[CS4236_REG(CS4236_RIGHT_MASTER)]; 645 change = val1 != chip->eimage[CS4236_REG(CS4236_LEFT_MASTER)] || val2 != chip->eimage[CS4236_REG(CS4236_RIGHT_MASTER)];
646 snd_cs4236_ext_out(chip, CS4236_LEFT_MASTER, val1); 646 snd_cs4236_ext_out(chip, CS4236_LEFT_MASTER, val1);
647 snd_cs4236_ext_out(chip, CS4236_RIGHT_MASTER, val1); 647 snd_cs4236_ext_out(chip, CS4236_RIGHT_MASTER, val2);
648 spin_unlock_irqrestore(&chip->reg_lock, flags); 648 spin_unlock_irqrestore(&chip->reg_lock, flags);
649 return change; 649 return change;
650} 650}
@@ -841,7 +841,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
841 841
842 enable = ucontrol->value.integer.value[0] & 1; 842 enable = ucontrol->value.integer.value[0] & 1;
843 843
844 down(&chip->mce_mutex); 844 mutex_lock(&chip->mce_mutex);
845 snd_cs4231_mce_up(chip); 845 snd_cs4231_mce_up(chip);
846 spin_lock_irqsave(&chip->reg_lock, flags); 846 spin_lock_irqsave(&chip->reg_lock, flags);
847 val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1); 847 val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1);
@@ -854,7 +854,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
854 snd_cs4236_ctrl_out(chip, 4, val); 854 snd_cs4236_ctrl_out(chip, 4, val);
855 spin_unlock_irqrestore(&chip->reg_lock, flags); 855 spin_unlock_irqrestore(&chip->reg_lock, flags);
856 snd_cs4231_mce_down(chip); 856 snd_cs4231_mce_down(chip);
857 up(&chip->mce_mutex); 857 mutex_unlock(&chip->mce_mutex);
858 858
859#if 0 859#if 0
860 printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", 860 printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index 50d23cf3d7cc..2b69fc829265 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -207,8 +207,10 @@ static int __init alsa_card_es1688_init(void)
207 return err; 207 return err;
208 208
209 cards = 0; 209 cards = 0;
210 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 210 for (i = 0; i < SNDRV_CARDS; i++) {
211 struct platform_device *device; 211 struct platform_device *device;
212 if (! enable[i])
213 continue;
212 device = platform_device_register_simple(ES1688_DRIVER, 214 device = platform_device_register_simple(ES1688_DRIVER,
213 i, NULL, 0); 215 i, NULL, 0);
214 if (IS_ERR(device)) { 216 if (IS_ERR(device)) {
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 08f032b51107..721955d26194 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -49,6 +49,10 @@
49 * - contrarily to some pages in DS_1869.PDF the rates can be set 49 * - contrarily to some pages in DS_1869.PDF the rates can be set
50 * independently. 50 * independently.
51 * 51 *
52 * - Zoom Video is implemented by sharing the FM DAC, thus the user can
53 * have either FM playback or Video playback but not both simultaneously.
54 * The Video Playback Switch mixer control toggles this choice.
55 *
52 * BUGS: 56 * BUGS:
53 * 57 *
54 * - There is a major trouble I noted: 58 * - There is a major trouble I noted:
@@ -63,7 +67,16 @@
63 * 67 *
64 */ 68 */
65 69
66 70/*
71 * ES1879 NOTES:
72 * - When Zoom Video is enabled (reg 0x71 bit 6 toggled on) the PCM playback
73 * seems to be effected (speaker_test plays a lower frequency). Can't find
74 * anything in the datasheet to account for this, so a Video Playback Switch
75 * control has been included to allow ZV to be enabled only when necessary.
76 * Then again on at least one test system the 0x71 bit 6 enable bit is not
77 * needed for ZV, so maybe the datasheet is entirely wrong here.
78 */
79
67#include <sound/driver.h> 80#include <sound/driver.h>
68#include <linux/init.h> 81#include <linux/init.h>
69#include <linux/err.h> 82#include <linux/err.h>
@@ -148,7 +161,7 @@ struct snd_audiodrive {
148#define ES18XX_DUPLEX_SAME 0x0010 /* Playback and record must share the same rate */ 161#define ES18XX_DUPLEX_SAME 0x0010 /* Playback and record must share the same rate */
149#define ES18XX_NEW_RATE 0x0020 /* More precise rate setting */ 162#define ES18XX_NEW_RATE 0x0020 /* More precise rate setting */
150#define ES18XX_AUXB 0x0040 /* AuxB mixer control */ 163#define ES18XX_AUXB 0x0040 /* AuxB mixer control */
151#define ES18XX_HWV 0x0080 /* Has hardware volume */ 164#define ES18XX_HWV 0x0080 /* Has seperate hardware volume mixer controls*/
152#define ES18XX_MONO 0x0100 /* Mono_in mixer control */ 165#define ES18XX_MONO 0x0100 /* Mono_in mixer control */
153#define ES18XX_I2S 0x0200 /* I2S mixer control */ 166#define ES18XX_I2S 0x0200 /* I2S mixer control */
154#define ES18XX_MUTEREC 0x0400 /* Record source can be muted */ 167#define ES18XX_MUTEREC 0x0400 /* Record source can be muted */
@@ -788,9 +801,12 @@ static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id, struct pt_regs *r
788 801
789 /* Hardware volume */ 802 /* Hardware volume */
790 if (status & HWV_IRQ) { 803 if (status & HWV_IRQ) {
791 int split = snd_es18xx_mixer_read(chip, 0x64) & 0x80; 804 int split = 0;
792 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_switch->id); 805 if (chip->caps & ES18XX_HWV) {
793 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_volume->id); 806 split = snd_es18xx_mixer_read(chip, 0x64) & 0x80;
807 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_switch->id);
808 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_volume->id);
809 }
794 if (!split) { 810 if (!split) {
795 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id); 811 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id);
796 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id); 812 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id);
@@ -939,37 +955,118 @@ static int snd_es18xx_capture_close(struct snd_pcm_substream *substream)
939 * MIXER part 955 * MIXER part
940 */ 956 */
941 957
958/* Record source mux routines:
959 * Depending on the chipset this mux switches between 4, 5, or 8 possible inputs.
960 * bit table for the 4/5 source mux:
961 * reg 1C:
962 * b2 b1 b0 muxSource
963 * x 0 x microphone
964 * 0 1 x CD
965 * 1 1 0 line
966 * 1 1 1 mixer
967 * if it's "mixer" and it's a 5 source mux chipset then reg 7A bit 3 determines
968 * either the play mixer or the capture mixer.
969 *
970 * "map4Source" translates from source number to reg bit pattern
971 * "invMap4Source" translates from reg bit pattern to source number
972 */
973
942static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 974static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
943{ 975{
944 static char *texts[8] = { 976 static char *texts4Source[4] = {
977 "Mic", "CD", "Line", "Master"
978 };
979 static char *texts5Source[5] = {
980 "Mic", "CD", "Line", "Master", "Mix"
981 };
982 static char *texts8Source[8] = {
945 "Mic", "Mic Master", "CD", "AOUT", 983 "Mic", "Mic Master", "CD", "AOUT",
946 "Mic1", "Mix", "Line", "Master" 984 "Mic1", "Mix", "Line", "Master"
947 }; 985 };
986 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
948 987
949 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 988 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
950 uinfo->count = 1; 989 uinfo->count = 1;
951 uinfo->value.enumerated.items = 8; 990 switch (chip->version) {
952 if (uinfo->value.enumerated.item > 7) 991 case 0x1868:
953 uinfo->value.enumerated.item = 7; 992 case 0x1878:
954 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 993 uinfo->value.enumerated.items = 4;
994 if (uinfo->value.enumerated.item > 3)
995 uinfo->value.enumerated.item = 3;
996 strcpy(uinfo->value.enumerated.name, texts4Source[uinfo->value.enumerated.item]);
997 break;
998 case 0x1887:
999 case 0x1888:
1000 uinfo->value.enumerated.items = 5;
1001 if (uinfo->value.enumerated.item > 4)
1002 uinfo->value.enumerated.item = 4;
1003 strcpy(uinfo->value.enumerated.name, texts5Source[uinfo->value.enumerated.item]);
1004 break;
1005 case 0x1869: /* DS somewhat contradictory for 1869: could be be 5 or 8 */
1006 case 0x1879:
1007 uinfo->value.enumerated.items = 8;
1008 if (uinfo->value.enumerated.item > 7)
1009 uinfo->value.enumerated.item = 7;
1010 strcpy(uinfo->value.enumerated.name, texts8Source[uinfo->value.enumerated.item]);
1011 break;
1012 default:
1013 return -EINVAL;
1014 }
955 return 0; 1015 return 0;
956} 1016}
957 1017
958static int snd_es18xx_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1018static int snd_es18xx_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
959{ 1019{
1020 static unsigned char invMap4Source[8] = {0, 0, 1, 1, 0, 0, 2, 3};
960 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); 1021 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
961 ucontrol->value.enumerated.item[0] = snd_es18xx_mixer_read(chip, 0x1c) & 0x07; 1022 int muxSource = snd_es18xx_mixer_read(chip, 0x1c) & 0x07;
1023 if (!(chip->version == 0x1869 || chip->version == 0x1879)) {
1024 muxSource = invMap4Source[muxSource];
1025 if (muxSource==3 &&
1026 (chip->version == 0x1887 || chip->version == 0x1888) &&
1027 (snd_es18xx_mixer_read(chip, 0x7a) & 0x08)
1028 )
1029 muxSource = 4;
1030 }
1031 ucontrol->value.enumerated.item[0] = muxSource;
962 return 0; 1032 return 0;
963} 1033}
964 1034
965static int snd_es18xx_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1035static int snd_es18xx_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
966{ 1036{
1037 static unsigned char map4Source[4] = {0, 2, 6, 7};
967 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); 1038 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
968 unsigned char val = ucontrol->value.enumerated.item[0]; 1039 unsigned char val = ucontrol->value.enumerated.item[0];
969 1040 unsigned char retVal = 0;
970 if (val > 7) 1041
1042 switch (chip->version) {
1043 /* 5 source chips */
1044 case 0x1887:
1045 case 0x1888:
1046 if (val > 4)
1047 return -EINVAL;
1048 if (val == 4) {
1049 retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x08) != 0x08;
1050 val = 3;
1051 } else
1052 retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x00) != 0x00;
1053 /* 4 source chips */
1054 case 0x1868:
1055 case 0x1878:
1056 if (val > 3)
1057 return -EINVAL;
1058 val = map4Source[val];
1059 break;
1060 /* 8 source chips */
1061 case 0x1869:
1062 case 0x1879:
1063 if (val > 7)
1064 return -EINVAL;
1065 break;
1066 default:
971 return -EINVAL; 1067 return -EINVAL;
972 return snd_es18xx_mixer_bits(chip, 0x1c, 0x07, val) != val; 1068 }
1069 return (snd_es18xx_mixer_bits(chip, 0x1c, 0x07, val) != val) || retVal;
973} 1070}
974 1071
975static int snd_es18xx_info_spatializer_enable(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 1072static int snd_es18xx_info_spatializer_enable(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
@@ -1191,19 +1288,22 @@ static int snd_es18xx_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
1191 return change; 1288 return change;
1192} 1289}
1193 1290
1291/* Mixer controls
1292 * These arrays contain setup data for mixer controls.
1293 *
1294 * The controls that are universal to all chipsets are fully initialized
1295 * here.
1296 */
1194static struct snd_kcontrol_new snd_es18xx_base_controls[] = { 1297static struct snd_kcontrol_new snd_es18xx_base_controls[] = {
1195ES18XX_DOUBLE("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0), 1298ES18XX_DOUBLE("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0),
1196ES18XX_DOUBLE("Master Playback Switch", 0, 0x60, 0x62, 6, 6, 1, 1), 1299ES18XX_DOUBLE("Master Playback Switch", 0, 0x60, 0x62, 6, 6, 1, 1),
1197ES18XX_DOUBLE("Line Playback Volume", 0, 0x3e, 0x3e, 4, 0, 15, 0), 1300ES18XX_DOUBLE("Line Playback Volume", 0, 0x3e, 0x3e, 4, 0, 15, 0),
1198ES18XX_DOUBLE("CD Playback Volume", 0, 0x38, 0x38, 4, 0, 15, 0), 1301ES18XX_DOUBLE("CD Playback Volume", 0, 0x38, 0x38, 4, 0, 15, 0),
1199ES18XX_DOUBLE("FM Playback Volume", 0, 0x36, 0x36, 4, 0, 15, 0), 1302ES18XX_DOUBLE("FM Playback Volume", 0, 0x36, 0x36, 4, 0, 15, 0),
1200ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0),
1201ES18XX_DOUBLE("Mic Playback Volume", 0, 0x1a, 0x1a, 4, 0, 15, 0), 1303ES18XX_DOUBLE("Mic Playback Volume", 0, 0x1a, 0x1a, 4, 0, 15, 0),
1202ES18XX_DOUBLE("Aux Playback Volume", 0, 0x3a, 0x3a, 4, 0, 15, 0), 1304ES18XX_DOUBLE("Aux Playback Volume", 0, 0x3a, 0x3a, 4, 0, 15, 0),
1203ES18XX_SINGLE("PC Speaker Playback Volume", 0, 0x3c, 0, 7, 0),
1204ES18XX_SINGLE("Record Monitor", 0, 0xa8, 3, 1, 0), 1305ES18XX_SINGLE("Record Monitor", 0, 0xa8, 3, 1, 0),
1205ES18XX_DOUBLE("Capture Volume", 0, 0xb4, 0xb4, 4, 0, 15, 0), 1306ES18XX_DOUBLE("Capture Volume", 0, 0xb4, 0xb4, 4, 0, 15, 0),
1206ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1),
1207{ 1307{
1208 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1308 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1209 .name = "Capture Source", 1309 .name = "Capture Source",
@@ -1213,19 +1313,37 @@ ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1),
1213} 1313}
1214}; 1314};
1215 1315
1216static struct snd_kcontrol_new snd_es18xx_mono_in_control =
1217ES18XX_DOUBLE("Mono Input Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0);
1218
1219static struct snd_kcontrol_new snd_es18xx_recmix_controls[] = { 1316static struct snd_kcontrol_new snd_es18xx_recmix_controls[] = {
1220ES18XX_DOUBLE("PCM Capture Volume", 0, 0x69, 0x69, 4, 0, 15, 0), 1317ES18XX_DOUBLE("PCM Capture Volume", 0, 0x69, 0x69, 4, 0, 15, 0),
1221ES18XX_DOUBLE("Mic Capture Volume", 0, 0x68, 0x68, 4, 0, 15, 0), 1318ES18XX_DOUBLE("Mic Capture Volume", 0, 0x68, 0x68, 4, 0, 15, 0),
1222ES18XX_DOUBLE("Line Capture Volume", 0, 0x6e, 0x6e, 4, 0, 15, 0), 1319ES18XX_DOUBLE("Line Capture Volume", 0, 0x6e, 0x6e, 4, 0, 15, 0),
1223ES18XX_DOUBLE("FM Capture Volume", 0, 0x6b, 0x6b, 4, 0, 15, 0), 1320ES18XX_DOUBLE("FM Capture Volume", 0, 0x6b, 0x6b, 4, 0, 15, 0),
1224ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0),
1225ES18XX_DOUBLE("CD Capture Volume", 0, 0x6a, 0x6a, 4, 0, 15, 0), 1321ES18XX_DOUBLE("CD Capture Volume", 0, 0x6a, 0x6a, 4, 0, 15, 0),
1226ES18XX_DOUBLE("Aux Capture Volume", 0, 0x6c, 0x6c, 4, 0, 15, 0) 1322ES18XX_DOUBLE("Aux Capture Volume", 0, 0x6c, 0x6c, 4, 0, 15, 0)
1227}; 1323};
1228 1324
1325/*
1326 * The chipset specific mixer controls
1327 */
1328static struct snd_kcontrol_new snd_es18xx_opt_speaker =
1329 ES18XX_SINGLE("PC Speaker Playback Volume", 0, 0x3c, 0, 7, 0);
1330
1331static struct snd_kcontrol_new snd_es18xx_opt_1869[] = {
1332ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1),
1333ES18XX_SINGLE("Video Playback Switch", 0, 0x7f, 0, 1, 0),
1334ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0),
1335ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0)
1336};
1337
1338static struct snd_kcontrol_new snd_es18xx_opt_1878 =
1339 ES18XX_DOUBLE("Video Playback Volume", 0, 0x68, 0x68, 4, 0, 15, 0);
1340
1341static struct snd_kcontrol_new snd_es18xx_opt_1879[] = {
1342ES18XX_SINGLE("Video Playback Switch", 0, 0x71, 6, 1, 0),
1343ES18XX_DOUBLE("Video Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0),
1344ES18XX_DOUBLE("Video Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0)
1345};
1346
1229static struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = { 1347static struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = {
1230ES18XX_DOUBLE("PCM Playback Volume", 0, 0x14, 0x14, 4, 0, 15, 0), 1348ES18XX_DOUBLE("PCM Playback Volume", 0, 0x14, 0x14, 4, 0, 15, 0),
1231}; 1349};
@@ -1270,7 +1388,6 @@ static struct snd_kcontrol_new snd_es18xx_hw_volume_controls[] = {
1270ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0), 1388ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0),
1271}; 1389};
1272 1390
1273#if 0
1274static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg) 1391static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg)
1275{ 1392{
1276 int data; 1393 int data;
@@ -1281,7 +1398,6 @@ static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned ch
1281 spin_unlock_irqrestore(&chip->ctrl_lock, flags); 1398 spin_unlock_irqrestore(&chip->ctrl_lock, flags);
1282 return data; 1399 return data;
1283} 1400}
1284#endif
1285 1401
1286static void __devinit snd_es18xx_config_write(struct snd_es18xx *chip, 1402static void __devinit snd_es18xx_config_write(struct snd_es18xx *chip,
1287 unsigned char reg, unsigned char data) 1403 unsigned char reg, unsigned char data)
@@ -1427,6 +1543,17 @@ static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip)
1427 snd_es18xx_mixer_write(chip, 0x58, 0x94); 1543 snd_es18xx_mixer_write(chip, 0x58, 0x94);
1428 snd_es18xx_mixer_write(chip, 0x5a, 0x80); 1544 snd_es18xx_mixer_write(chip, 0x5a, 0x80);
1429 } 1545 }
1546 /* Flip the "enable I2S" bits for those chipsets that need it */
1547 switch (chip->version) {
1548 case 0x1879:
1549 //Leaving I2S enabled on the 1879 screws up the PCM playback (rate effected somehow)
1550 //so a Switch control has been added to toggle this 0x71 bit on/off:
1551 //snd_es18xx_mixer_bits(chip, 0x71, 0x40, 0x40);
1552 /* Note: we fall through on purpose here. */
1553 case 0x1878:
1554 snd_es18xx_config_write(chip, 0x29, snd_es18xx_config_read(chip, 0x29) | 0x40);
1555 break;
1556 }
1430 /* Mute input source */ 1557 /* Mute input source */
1431 if (chip->caps & ES18XX_MUTEREC) 1558 if (chip->caps & ES18XX_MUTEREC)
1432 mask = 0x10; 1559 mask = 0x10;
@@ -1476,11 +1603,14 @@ static int __devinit snd_es18xx_identify(struct snd_es18xx *chip)
1476 } 1603 }
1477 1604
1478 outb(0x40, chip->port + 0x04); 1605 outb(0x40, chip->port + 0x04);
1606 udelay(10);
1479 hi = inb(chip->port + 0x05); 1607 hi = inb(chip->port + 0x05);
1608 udelay(10);
1480 lo = inb(chip->port + 0x05); 1609 lo = inb(chip->port + 0x05);
1481 if (hi != lo) { 1610 if (hi != lo) {
1482 chip->version = hi << 8 | lo; 1611 chip->version = hi << 8 | lo;
1483 chip->ctrl_port = inb(chip->port + 0x05) << 8; 1612 chip->ctrl_port = inb(chip->port + 0x05) << 8;
1613 udelay(10);
1484 chip->ctrl_port += inb(chip->port + 0x05); 1614 chip->ctrl_port += inb(chip->port + 0x05);
1485 1615
1486 if ((chip->res_ctrl_port = request_region(chip->ctrl_port, 8, "ES18xx - CTRL")) == NULL) { 1616 if ((chip->res_ctrl_port = request_region(chip->ctrl_port, 8, "ES18xx - CTRL")) == NULL) {
@@ -1519,22 +1649,22 @@ static int __devinit snd_es18xx_probe(struct snd_es18xx *chip)
1519 1649
1520 switch (chip->version) { 1650 switch (chip->version) {
1521 case 0x1868: 1651 case 0x1868:
1522 chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_CONTROL | ES18XX_HWV; 1652 chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_CONTROL;
1523 break; 1653 break;
1524 case 0x1869: 1654 case 0x1869:
1525 chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_MONO | ES18XX_MUTEREC | ES18XX_CONTROL | ES18XX_HWV; 1655 chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_MONO | ES18XX_MUTEREC | ES18XX_CONTROL | ES18XX_HWV;
1526 break; 1656 break;
1527 case 0x1878: 1657 case 0x1878:
1528 chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV; 1658 chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_I2S | ES18XX_CONTROL;
1529 break; 1659 break;
1530 case 0x1879: 1660 case 0x1879:
1531 chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV; 1661 chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV;
1532 break; 1662 break;
1533 case 0x1887: 1663 case 0x1887:
1534 chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME | ES18XX_HWV; 1664 chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME;
1535 break; 1665 break;
1536 case 0x1888: 1666 case 0x1888:
1537 chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME | ES18XX_HWV; 1667 chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME;
1538 break; 1668 break;
1539 default: 1669 default:
1540 snd_printk(KERN_ERR "[0x%lx] unsupported chip ES%x\n", 1670 snd_printk(KERN_ERR "[0x%lx] unsupported chip ES%x\n",
@@ -1778,10 +1908,6 @@ static int __devinit snd_es18xx_mixer(struct snd_es18xx *chip)
1778 } 1908 }
1779 } 1909 }
1780 1910
1781 if (chip->caps & ES18XX_MONO) {
1782 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_mono_in_control, chip))) < 0)
1783 return err;
1784 }
1785 if (chip->caps & ES18XX_RECMIX) { 1911 if (chip->caps & ES18XX_RECMIX) {
1786 for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_recmix_controls); idx++) { 1912 for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_recmix_controls); idx++) {
1787 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_recmix_controls[idx], chip))) < 0) 1913 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_recmix_controls[idx], chip))) < 0)
@@ -1819,6 +1945,36 @@ static int __devinit snd_es18xx_mixer(struct snd_es18xx *chip)
1819 1945
1820 } 1946 }
1821 } 1947 }
1948 /* finish initializing other chipset specific controls
1949 */
1950 if (chip->version != 0x1868) {
1951 err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_opt_speaker,
1952 chip));
1953 if (err < 0)
1954 return err;
1955 }
1956 if (chip->version == 0x1869) {
1957 for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_opt_1869); idx++) {
1958 err = snd_ctl_add(card,
1959 snd_ctl_new1(&snd_es18xx_opt_1869[idx],
1960 chip));
1961 if (err < 0)
1962 return err;
1963 }
1964 } else if (chip->version == 0x1878) {
1965 err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_opt_1878,
1966 chip));
1967 if (err < 0)
1968 return err;
1969 } else if (chip->version == 0x1879) {
1970 for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_opt_1879); idx++) {
1971 err = snd_ctl_add(card,
1972 snd_ctl_new1(&snd_es18xx_opt_1879[idx],
1973 chip));
1974 if (err < 0)
1975 return err;
1976 }
1977 }
1822 return 0; 1978 return 0;
1823} 1979}
1824 1980
@@ -1927,6 +2083,7 @@ static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard,
1927 err = pnp_activate_dev(acard->devc); 2083 err = pnp_activate_dev(acard->devc);
1928 if (err < 0) { 2084 if (err < 0) {
1929 snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n"); 2085 snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n");
2086 kfree(cfg);
1930 return -EAGAIN; 2087 return -EAGAIN;
1931 } 2088 }
1932 snd_printdd("pnp: port=0x%lx\n", pnp_port_start(acard->devc, 0)); 2089 snd_printdd("pnp: port=0x%lx\n", pnp_port_start(acard->devc, 0));
@@ -2225,9 +2382,9 @@ static int __init alsa_card_es18xx_init(void)
2225 if ((err = platform_driver_register(&snd_es18xx_nonpnp_driver)) < 0) 2382 if ((err = platform_driver_register(&snd_es18xx_nonpnp_driver)) < 0)
2226 return err; 2383 return err;
2227 2384
2228 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 2385 for (i = 0; i < SNDRV_CARDS; i++) {
2229 struct platform_device *device; 2386 struct platform_device *device;
2230 if (is_isapnp_selected(i)) 2387 if (! enable[i] || is_isapnp_selected(i))
2231 continue; 2388 continue;
2232 device = platform_device_register_simple(ES18XX_DRIVER, 2389 device = platform_device_register_simple(ES18XX_DRIVER,
2233 i, NULL, 0); 2390 i, NULL, 0);
diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c
index 930f4bc56f34..44ee5d3674a1 100644
--- a/sound/isa/gus/gus_dma.c
+++ b/sound/isa/gus/gus_dma.c
@@ -149,10 +149,10 @@ static void snd_gf1_dma_interrupt(struct snd_gus_card * gus)
149 149
150int snd_gf1_dma_init(struct snd_gus_card * gus) 150int snd_gf1_dma_init(struct snd_gus_card * gus)
151{ 151{
152 down(&gus->dma_mutex); 152 mutex_lock(&gus->dma_mutex);
153 gus->gf1.dma_shared++; 153 gus->gf1.dma_shared++;
154 if (gus->gf1.dma_shared > 1) { 154 if (gus->gf1.dma_shared > 1) {
155 up(&gus->dma_mutex); 155 mutex_unlock(&gus->dma_mutex);
156 return 0; 156 return 0;
157 } 157 }
158 gus->gf1.interrupt_handler_dma_write = snd_gf1_dma_interrupt; 158 gus->gf1.interrupt_handler_dma_write = snd_gf1_dma_interrupt;
@@ -160,7 +160,7 @@ int snd_gf1_dma_init(struct snd_gus_card * gus)
160 gus->gf1.dma_data_pcm_last = 160 gus->gf1.dma_data_pcm_last =
161 gus->gf1.dma_data_synth = 161 gus->gf1.dma_data_synth =
162 gus->gf1.dma_data_synth_last = NULL; 162 gus->gf1.dma_data_synth_last = NULL;
163 up(&gus->dma_mutex); 163 mutex_unlock(&gus->dma_mutex);
164 return 0; 164 return 0;
165} 165}
166 166
@@ -168,7 +168,7 @@ int snd_gf1_dma_done(struct snd_gus_card * gus)
168{ 168{
169 struct snd_gf1_dma_block *block; 169 struct snd_gf1_dma_block *block;
170 170
171 down(&gus->dma_mutex); 171 mutex_lock(&gus->dma_mutex);
172 gus->gf1.dma_shared--; 172 gus->gf1.dma_shared--;
173 if (!gus->gf1.dma_shared) { 173 if (!gus->gf1.dma_shared) {
174 snd_dma_disable(gus->gf1.dma1); 174 snd_dma_disable(gus->gf1.dma1);
@@ -185,7 +185,7 @@ int snd_gf1_dma_done(struct snd_gus_card * gus)
185 gus->gf1.dma_data_pcm_last = 185 gus->gf1.dma_data_pcm_last =
186 gus->gf1.dma_data_synth_last = NULL; 186 gus->gf1.dma_data_synth_last = NULL;
187 } 187 }
188 up(&gus->dma_mutex); 188 mutex_unlock(&gus->dma_mutex);
189 return 0; 189 return 0;
190} 190}
191 191
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index 6d15b3d18a87..53eeaf37007d 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -225,7 +225,7 @@ int snd_gus_create(struct snd_card *card,
225 spin_lock_init(&gus->dma_lock); 225 spin_lock_init(&gus->dma_lock);
226 spin_lock_init(&gus->pcm_volume_level_lock); 226 spin_lock_init(&gus->pcm_volume_level_lock);
227 spin_lock_init(&gus->uart_cmd_lock); 227 spin_lock_init(&gus->uart_cmd_lock);
228 init_MUTEX(&gus->dma_mutex); 228 mutex_init(&gus->dma_mutex);
229 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, gus, &ops)) < 0) { 229 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, gus, &ops)) < 0) {
230 snd_gus_free(gus); 230 snd_gus_free(gus);
231 return err; 231 return err;
diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c
index e8bdb860a19f..3c0d27aa08b3 100644
--- a/sound/isa/gus/gus_mem.c
+++ b/sound/isa/gus/gus_mem.c
@@ -34,9 +34,9 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
34void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup) 34void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup)
35{ 35{
36 if (!xup) { 36 if (!xup) {
37 down(&alloc->memory_mutex); 37 mutex_lock(&alloc->memory_mutex);
38 } else { 38 } else {
39 up(&alloc->memory_mutex); 39 mutex_unlock(&alloc->memory_mutex);
40 } 40 }
41} 41}
42 42
@@ -59,7 +59,7 @@ static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc,
59 alloc->first = nblock; 59 alloc->first = nblock;
60 else 60 else
61 nblock->prev->next = nblock; 61 nblock->prev->next = nblock;
62 up(&alloc->memory_mutex); 62 mutex_unlock(&alloc->memory_mutex);
63 return NULL; 63 return NULL;
64 } 64 }
65 pblock = pblock->next; 65 pblock = pblock->next;
@@ -80,7 +80,7 @@ int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * blo
80{ 80{
81 if (block->share) { /* ok.. shared block */ 81 if (block->share) { /* ok.. shared block */
82 block->share--; 82 block->share--;
83 up(&alloc->memory_mutex); 83 mutex_unlock(&alloc->memory_mutex);
84 return 0; 84 return 0;
85 } 85 }
86 if (alloc->first == block) { 86 if (alloc->first == block) {
@@ -244,7 +244,7 @@ int snd_gf1_mem_init(struct snd_gus_card * gus)
244#endif 244#endif
245 245
246 alloc = &gus->gf1.mem_alloc; 246 alloc = &gus->gf1.mem_alloc;
247 init_MUTEX(&alloc->memory_mutex); 247 mutex_init(&alloc->memory_mutex);
248 alloc->first = alloc->last = NULL; 248 alloc->first = alloc->last = NULL;
249 if (!gus->gf1.memory) 249 if (!gus->gf1.memory)
250 return 0; 250 return 0;
@@ -299,7 +299,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
299 299
300 gus = entry->private_data; 300 gus = entry->private_data;
301 alloc = &gus->gf1.mem_alloc; 301 alloc = &gus->gf1.mem_alloc;
302 down(&alloc->memory_mutex); 302 mutex_lock(&alloc->memory_mutex);
303 snd_iprintf(buffer, "8-bit banks : \n "); 303 snd_iprintf(buffer, "8-bit banks : \n ");
304 for (i = 0; i < 4; i++) 304 for (i = 0; i < 4; i++)
305 snd_iprintf(buffer, "0x%06x (%04ik)%s", alloc->banks_8[i].address, alloc->banks_8[i].size >> 10, i + 1 < 4 ? "," : ""); 305 snd_iprintf(buffer, "0x%06x (%04ik)%s", alloc->banks_8[i].address, alloc->banks_8[i].size >> 10, i + 1 < 4 ? "," : "");
@@ -343,7 +343,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
343 } 343 }
344 snd_iprintf(buffer, " Total: memory = %i, used = %i, free = %i\n", 344 snd_iprintf(buffer, " Total: memory = %i, used = %i, free = %i\n",
345 total, used, total - used); 345 total, used, total - used);
346 up(&alloc->memory_mutex); 346 mutex_unlock(&alloc->memory_mutex);
347#if 0 347#if 0
348 ultra_iprintf(buffer, " Verify: free = %i, max 8-bit block = %i, max 16-bit block = %i\n", 348 ultra_iprintf(buffer, " Verify: free = %i, max 8-bit block = %i, max 16-bit block = %i\n",
349 ultra_memory_free_size(card, &card->gf1.mem_alloc), 349 ultra_memory_free_size(card, &card->gf1.mem_alloc),
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c
index d0829393ec8a..c7f95e7aa018 100644
--- a/sound/isa/gus/gus_pcm.c
+++ b/sound/isa/gus/gus_pcm.c
@@ -114,8 +114,6 @@ static void snd_gf1_pcm_trigger_up(struct snd_pcm_substream *substream)
114 unsigned char pan; 114 unsigned char pan;
115 unsigned int voice; 115 unsigned int voice;
116 116
117 if (substream == NULL)
118 return;
119 spin_lock_irqsave(&pcmp->lock, flags); 117 spin_lock_irqsave(&pcmp->lock, flags);
120 if (pcmp->flags & SNDRV_GF1_PCM_PFLG_ACTIVE) { 118 if (pcmp->flags & SNDRV_GF1_PCM_PFLG_ACTIVE) {
121 spin_unlock_irqrestore(&pcmp->lock, flags); 119 spin_unlock_irqrestore(&pcmp->lock, flags);
diff --git a/sound/isa/gus/gus_synth.c b/sound/isa/gus/gus_synth.c
index 85a1b051f09a..2767cc187ae3 100644
--- a/sound/isa/gus/gus_synth.c
+++ b/sound/isa/gus/gus_synth.c
@@ -55,9 +55,9 @@ static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe *
55 55
56 if (info->voices > 32) 56 if (info->voices > 32)
57 return -EINVAL; 57 return -EINVAL;
58 down(&gus->register_mutex); 58 mutex_lock(&gus->register_mutex);
59 if (!snd_gus_use_inc(gus)) { 59 if (!snd_gus_use_inc(gus)) {
60 up(&gus->register_mutex); 60 mutex_unlock(&gus->register_mutex);
61 return -EFAULT; 61 return -EFAULT;
62 } 62 }
63 for (idx = 0; idx < info->voices; idx++) { 63 for (idx = 0; idx < info->voices; idx++) {
@@ -65,12 +65,12 @@ static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe *
65 if (voice == NULL) { 65 if (voice == NULL) {
66 snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port); 66 snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port);
67 snd_gus_use_dec(gus); 67 snd_gus_use_dec(gus);
68 up(&gus->register_mutex); 68 mutex_unlock(&gus->register_mutex);
69 return -EBUSY; 69 return -EBUSY;
70 } 70 }
71 voice->index = idx; 71 voice->index = idx;
72 } 72 }
73 up(&gus->register_mutex); 73 mutex_unlock(&gus->register_mutex);
74 return 0; 74 return 0;
75} 75}
76 76
@@ -79,10 +79,10 @@ static int snd_gus_synth_unuse(void *private_data, struct snd_seq_port_subscribe
79 struct snd_gus_port * port = private_data; 79 struct snd_gus_port * port = private_data;
80 struct snd_gus_card * gus = port->gus; 80 struct snd_gus_card * gus = port->gus;
81 81
82 down(&gus->register_mutex); 82 mutex_lock(&gus->register_mutex);
83 snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port); 83 snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port);
84 snd_gus_use_dec(gus); 84 snd_gus_use_dec(gus);
85 up(&gus->register_mutex); 85 mutex_unlock(&gus->register_mutex);
86 return 0; 86 return 0;
87} 87}
88 88
@@ -223,7 +223,7 @@ static int snd_gus_synth_new_device(struct snd_seq_device *dev)
223 if (gus == NULL) 223 if (gus == NULL)
224 return -EINVAL; 224 return -EINVAL;
225 225
226 init_MUTEX(&gus->register_mutex); 226 mutex_init(&gus->register_mutex);
227 gus->gf1.seq_client = -1; 227 gus->gf1.seq_client = -1;
228 228
229 /* allocate new client */ 229 /* allocate new client */
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c
index 91c219116d7a..26dccfea2437 100644
--- a/sound/isa/gus/gusclassic.c
+++ b/sound/isa/gus/gusclassic.c
@@ -247,8 +247,10 @@ static int __init alsa_card_gusclassic_init(void)
247 return err; 247 return err;
248 248
249 cards = 0; 249 cards = 0;
250 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 250 for (i = 0; i < SNDRV_CARDS; i++) {
251 struct platform_device *device; 251 struct platform_device *device;
252 if (! enable[i])
253 continue;
252 device = platform_device_register_simple(GUSCLASSIC_DRIVER, 254 device = platform_device_register_simple(GUSCLASSIC_DRIVER,
253 i, NULL, 0); 255 i, NULL, 0);
254 if (IS_ERR(device)) { 256 if (IS_ERR(device)) {
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index 239f16e6b9ee..31dc20501d0c 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -357,8 +357,10 @@ static int __init alsa_card_gusextreme_init(void)
357 return err; 357 return err;
358 358
359 cards = 0; 359 cards = 0;
360 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 360 for (i = 0; i < SNDRV_CARDS; i++) {
361 struct platform_device *device; 361 struct platform_device *device;
362 if (! enable[i])
363 continue;
362 device = platform_device_register_simple(GUSEXTREME_DRIVER, 364 device = platform_device_register_simple(GUSEXTREME_DRIVER,
363 i, NULL, 0); 365 i, NULL, 0);
364 if (IS_ERR(device)) { 366 if (IS_ERR(device)) {
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index d4d2b2a517d5..cafb9b67fa72 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -384,8 +384,10 @@ static int __init alsa_card_gusmax_init(void)
384 return err; 384 return err;
385 385
386 cards = 0; 386 cards = 0;
387 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 387 for (i = 0; i < SNDRV_CARDS; i++) {
388 struct platform_device *device; 388 struct platform_device *device;
389 if (! enable[i])
390 continue;
389 device = platform_device_register_simple(GUSMAX_DRIVER, 391 device = platform_device_register_simple(GUSMAX_DRIVER,
390 i, NULL, 0); 392 i, NULL, 0);
391 if (IS_ERR(device)) { 393 if (IS_ERR(device)) {
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 9838d992b101..2cacd0fa6871 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -935,8 +935,10 @@ static int __init alsa_card_interwave_init(void)
935 if ((err = platform_driver_register(&snd_interwave_driver)) < 0) 935 if ((err = platform_driver_register(&snd_interwave_driver)) < 0)
936 return err; 936 return err;
937 937
938 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 938 for (i = 0; i < SNDRV_CARDS; i++) {
939 struct platform_device *device; 939 struct platform_device *device;
940 if (! enable[i])
941 continue;
940#ifdef CONFIG_PNP 942#ifdef CONFIG_PNP
941 if (isapnp[i]) 943 if (isapnp[i])
942 continue; 944 continue;
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 9d8431978501..56fcd8a946a4 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -949,8 +949,10 @@ static int __init alsa_card_opl3sa2_init(void)
949 if ((err = platform_driver_register(&snd_opl3sa2_nonpnp_driver)) < 0) 949 if ((err = platform_driver_register(&snd_opl3sa2_nonpnp_driver)) < 0)
950 return err; 950 return err;
951 951
952 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 952 for (i = 0; i < SNDRV_CARDS; i++) {
953 struct platform_device *device; 953 struct platform_device *device;
954 if (! enable[i])
955 continue;
954#ifdef CONFIG_PNP 956#ifdef CONFIG_PNP
955 if (isapnp[i]) 957 if (isapnp[i])
956 continue; 958 continue;
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 63d96be11b2b..65b28cbc0ebd 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -2088,9 +2088,11 @@ static int __init alsa_card_opti9xx_init(void)
2088 int error; 2088 int error;
2089 struct platform_device *device; 2089 struct platform_device *device;
2090 2090
2091#ifdef CONFIG_PNP
2091 pnp_register_card_driver(&opti9xx_pnpc_driver); 2092 pnp_register_card_driver(&opti9xx_pnpc_driver);
2092 if (snd_opti9xx_pnp_is_probed) 2093 if (snd_opti9xx_pnp_is_probed)
2093 return 0; 2094 return 0;
2095#endif
2094 if (! is_isapnp_selected()) { 2096 if (! is_isapnp_selected()) {
2095 error = platform_driver_register(&snd_opti9xx_driver); 2097 error = platform_driver_register(&snd_opti9xx_driver);
2096 if (error < 0) 2098 if (error < 0)
@@ -2102,7 +2104,9 @@ static int __init alsa_card_opti9xx_init(void)
2102 } 2104 }
2103 platform_driver_unregister(&snd_opti9xx_driver); 2105 platform_driver_unregister(&snd_opti9xx_driver);
2104 } 2106 }
2107#ifdef CONFIG_PNP
2105 pnp_unregister_card_driver(&opti9xx_pnpc_driver); 2108 pnp_unregister_card_driver(&opti9xx_pnpc_driver);
2109#endif
2106#ifdef MODULE 2110#ifdef MODULE
2107 printk(KERN_ERR "no OPTi " CHIP_NAME " soundcard found\n"); 2111 printk(KERN_ERR "no OPTi " CHIP_NAME " soundcard found\n");
2108#endif 2112#endif
@@ -2115,7 +2119,9 @@ static void __exit alsa_card_opti9xx_exit(void)
2115 platform_device_unregister(snd_opti9xx_platform_device); 2119 platform_device_unregister(snd_opti9xx_platform_device);
2116 platform_driver_unregister(&snd_opti9xx_driver); 2120 platform_driver_unregister(&snd_opti9xx_driver);
2117 } 2121 }
2122#ifdef CONFIG_PNP
2118 pnp_unregister_card_driver(&opti9xx_pnpc_driver); 2123 pnp_unregister_card_driver(&opti9xx_pnpc_driver);
2124#endif
2119} 2125}
2120 2126
2121module_init(alsa_card_opti9xx_init) 2127module_init(alsa_card_opti9xx_init)
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 0667bd14ad60..5737ab76160c 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -712,9 +712,9 @@ static int __init alsa_card_sb16_init(void)
712 if ((err = platform_driver_register(&snd_sb16_nonpnp_driver)) < 0) 712 if ((err = platform_driver_register(&snd_sb16_nonpnp_driver)) < 0)
713 return err; 713 return err;
714 714
715 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 715 for (i = 0; i < SNDRV_CARDS; i++) {
716 struct platform_device *device; 716 struct platform_device *device;
717 if (is_isapnp_selected(i)) 717 if (! enable[i] || is_isapnp_selected(i))
718 continue; 718 continue;
719 device = platform_device_register_simple(SND_SB16_DRIVER, 719 device = platform_device_register_simple(SND_SB16_DRIVER,
720 i, NULL, 0); 720 i, NULL, 0);
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
index 9c2b5efbacbf..9703c68e4e08 100644
--- a/sound/isa/sb/sb16_csp.c
+++ b/sound/isa/sb/sb16_csp.c
@@ -138,7 +138,7 @@ int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep)
138 p->ops.csp_stop = snd_sb_csp_stop; 138 p->ops.csp_stop = snd_sb_csp_stop;
139 p->ops.csp_qsound_transfer = snd_sb_csp_qsound_transfer; 139 p->ops.csp_qsound_transfer = snd_sb_csp_qsound_transfer;
140 140
141 init_MUTEX(&p->access_mutex); 141 mutex_init(&p->access_mutex);
142 sprintf(hw->name, "CSP v%d.%d", (version >> 4), (version & 0x0f)); 142 sprintf(hw->name, "CSP v%d.%d", (version >> 4), (version & 0x0f));
143 hw->iface = SNDRV_HWDEP_IFACE_SB16CSP; 143 hw->iface = SNDRV_HWDEP_IFACE_SB16CSP;
144 hw->private_data = p; 144 hw->private_data = p;
@@ -265,13 +265,13 @@ static int snd_sb_csp_release(struct snd_hwdep * hw, struct file *file)
265 */ 265 */
266static int snd_sb_csp_use(struct snd_sb_csp * p) 266static int snd_sb_csp_use(struct snd_sb_csp * p)
267{ 267{
268 down(&p->access_mutex); 268 mutex_lock(&p->access_mutex);
269 if (p->used) { 269 if (p->used) {
270 up(&p->access_mutex); 270 mutex_unlock(&p->access_mutex);
271 return -EAGAIN; 271 return -EAGAIN;
272 } 272 }
273 p->used++; 273 p->used++;
274 up(&p->access_mutex); 274 mutex_unlock(&p->access_mutex);
275 275
276 return 0; 276 return 0;
277 277
@@ -282,9 +282,9 @@ static int snd_sb_csp_use(struct snd_sb_csp * p)
282 */ 282 */
283static int snd_sb_csp_unuse(struct snd_sb_csp * p) 283static int snd_sb_csp_unuse(struct snd_sb_csp * p)
284{ 284{
285 down(&p->access_mutex); 285 mutex_lock(&p->access_mutex);
286 p->used--; 286 p->used--;
287 up(&p->access_mutex); 287 mutex_unlock(&p->access_mutex);
288 288
289 return 0; 289 return 0;
290} 290}
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index 60ee79cd14a3..3efa23d303c3 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -258,8 +258,10 @@ static int __init alsa_card_sb8_init(void)
258 return err; 258 return err;
259 259
260 cards = 0; 260 cards = 0;
261 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 261 for (i = 0; i < SNDRV_CARDS; i++) {
262 struct platform_device *device; 262 struct platform_device *device;
263 if (! enable[i])
264 continue;
263 device = platform_device_register_simple(SND_SB8_DRIVER, 265 device = platform_device_register_simple(SND_SB8_DRIVER,
264 i, NULL, 0); 266 i, NULL, 0);
265 if (IS_ERR(device)) { 267 if (IS_ERR(device)) {
diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c
index 1a6ee344dddb..490b1ca5cf58 100644
--- a/sound/isa/sb/sb_mixer.c
+++ b/sound/isa/sb/sb_mixer.c
@@ -453,10 +453,8 @@ int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int ty
453 strlcpy(ctl->id.name, name, sizeof(ctl->id.name)); 453 strlcpy(ctl->id.name, name, sizeof(ctl->id.name));
454 ctl->id.index = index; 454 ctl->id.index = index;
455 ctl->private_value = value; 455 ctl->private_value = value;
456 if ((err = snd_ctl_add(chip->card, ctl)) < 0) { 456 if ((err = snd_ctl_add(chip->card, ctl)) < 0)
457 snd_ctl_free_one(ctl);
458 return err; 457 return err;
459 }
460 return 0; 458 return 0;
461} 459}
462 460
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c
index 0dbbb35b242c..a60e66afbf90 100644
--- a/sound/isa/sgalaxy.c
+++ b/sound/isa/sgalaxy.c
@@ -360,8 +360,10 @@ static int __init alsa_card_sgalaxy_init(void)
360 return err; 360 return err;
361 361
362 cards = 0; 362 cards = 0;
363 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 363 for (i = 0; i < SNDRV_CARDS; i++) {
364 struct platform_device *device; 364 struct platform_device *device;
365 if (! enable[i])
366 continue;
365 device = platform_device_register_simple(SND_SGALAXY_DRIVER, 367 device = platform_device_register_simple(SND_SGALAXY_DRIVER,
366 i, NULL, 0); 368 i, NULL, 0);
367 if (IS_ERR(device)) { 369 if (IS_ERR(device)) {
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index fa3ab960de17..c0115bf9065e 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -710,8 +710,10 @@ static int __init alsa_card_wavefront_init(void)
710 if ((err = platform_driver_register(&snd_wavefront_driver)) < 0) 710 if ((err = platform_driver_register(&snd_wavefront_driver)) < 0)
711 return err; 711 return err;
712 712
713 for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { 713 for (i = 0; i < SNDRV_CARDS; i++) {
714 struct platform_device *device; 714 struct platform_device *device;
715 if (! enable[i])
716 continue;
715#ifdef CONFIG_PNP 717#ifdef CONFIG_PNP
716 if (isapnp[i]) 718 if (isapnp[i])
717 continue; 719 continue;