aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/ad1816a/ad1816a.c54
-rw-r--r--sound/isa/ad1816a/ad1816a_lib.c1
-rw-r--r--sound/isa/ad1848/ad1848.c1
-rw-r--r--sound/isa/ad1848/ad1848_lib.c3
-rw-r--r--sound/isa/adlib.c1
-rw-r--r--sound/isa/als100.c50
-rw-r--r--sound/isa/azt2320.c51
-rw-r--r--sound/isa/cmi8330.c43
-rw-r--r--sound/isa/cs423x/cs4231.c1
-rw-r--r--sound/isa/cs423x/cs4231_lib.c2
-rw-r--r--sound/isa/cs423x/cs4236.c92
-rw-r--r--sound/isa/cs423x/cs4236_lib.c1
-rw-r--r--sound/isa/dt019x.c47
-rw-r--r--sound/isa/es1688/es1688.c1
-rw-r--r--sound/isa/es1688/es1688_lib.c1
-rw-r--r--sound/isa/es18xx.c61
-rw-r--r--sound/isa/gus/Makefile12
-rw-r--r--sound/isa/gus/gus_dma.c1
-rw-r--r--sound/isa/gus/gus_dram.c1
-rw-r--r--sound/isa/gus/gus_instr.c1
-rw-r--r--sound/isa/gus/gus_io.c1
-rw-r--r--sound/isa/gus/gus_irq.c1
-rw-r--r--sound/isa/gus/gus_main.c24
-rw-r--r--sound/isa/gus/gus_mem.c1
-rw-r--r--sound/isa/gus/gus_mem_proc.c1
-rw-r--r--sound/isa/gus/gus_mixer.c1
-rw-r--r--sound/isa/gus/gus_pcm.c1
-rw-r--r--sound/isa/gus/gus_reset.c1
-rw-r--r--sound/isa/gus/gus_sample.c165
-rw-r--r--sound/isa/gus/gus_simple.c634
-rw-r--r--sound/isa/gus/gus_synth.c314
-rw-r--r--sound/isa/gus/gus_timer.c1
-rw-r--r--sound/isa/gus/gus_uart.c1
-rw-r--r--sound/isa/gus/gus_volume.c1
-rw-r--r--sound/isa/gus/gusclassic.c1
-rw-r--r--sound/isa/gus/gusextreme.c1
-rw-r--r--sound/isa/gus/gusmax.c1
-rw-r--r--sound/isa/gus/interwave.c40
-rw-r--r--sound/isa/opl3sa2.c37
-rw-r--r--sound/isa/opti9xx/miro.c11
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c51
-rw-r--r--sound/isa/sb/emu8000.c1
-rw-r--r--sound/isa/sb/emu8000_local.h1
-rw-r--r--sound/isa/sb/es968.c28
-rw-r--r--sound/isa/sb/sb16.c40
-rw-r--r--sound/isa/sb/sb16_csp.c4
-rw-r--r--sound/isa/sb/sb16_main.c1
-rw-r--r--sound/isa/sb/sb8.c1
-rw-r--r--sound/isa/sb/sb8_main.c1
-rw-r--r--sound/isa/sb/sb8_midi.c1
-rw-r--r--sound/isa/sb/sb_common.c1
-rw-r--r--sound/isa/sb/sb_mixer.c1
-rw-r--r--sound/isa/sc6000.c3
-rw-r--r--sound/isa/sgalaxy.c1
-rw-r--r--sound/isa/sscape.c1
-rw-r--r--sound/isa/wavefront/wavefront.c56
-rw-r--r--sound/isa/wavefront/wavefront_fx.c1
-rw-r--r--sound/isa/wavefront/wavefront_midi.c1
-rw-r--r--sound/isa/wavefront/wavefront_synth.c1
59 files changed, 73 insertions, 1785 deletions
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index fc88a31da6f5..68f1260b5602 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -18,7 +18,6 @@
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19*/ 19*/
20 20
21#include <sound/driver.h>
22#include <linux/init.h> 21#include <linux/init.h>
23#include <linux/time.h> 22#include <linux/time.h>
24#include <linux/wait.h> 23#include <linux/wait.h>
@@ -61,20 +60,6 @@ module_param_array(id, charp, NULL, 0444);
61MODULE_PARM_DESC(id, "ID string for ad1816a based soundcard."); 60MODULE_PARM_DESC(id, "ID string for ad1816a based soundcard.");
62module_param_array(enable, bool, NULL, 0444); 61module_param_array(enable, bool, NULL, 0444);
63MODULE_PARM_DESC(enable, "Enable ad1816a based soundcard."); 62MODULE_PARM_DESC(enable, "Enable ad1816a based soundcard.");
64module_param_array(port, long, NULL, 0444);
65MODULE_PARM_DESC(port, "Port # for ad1816a driver.");
66module_param_array(mpu_port, long, NULL, 0444);
67MODULE_PARM_DESC(mpu_port, "MPU-401 port # for ad1816a driver.");
68module_param_array(fm_port, long, NULL, 0444);
69MODULE_PARM_DESC(fm_port, "FM port # for ad1816a driver.");
70module_param_array(irq, int, NULL, 0444);
71MODULE_PARM_DESC(irq, "IRQ # for ad1816a driver.");
72module_param_array(mpu_irq, int, NULL, 0444);
73MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for ad1816a driver.");
74module_param_array(dma1, int, NULL, 0444);
75MODULE_PARM_DESC(dma1, "1st DMA # for ad1816a driver.");
76module_param_array(dma2, int, NULL, 0444);
77MODULE_PARM_DESC(dma2, "2nd DMA # for ad1816a driver.");
78module_param_array(clockfreq, int, NULL, 0444); 63module_param_array(clockfreq, int, NULL, 0444);
79MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0)."); 64MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0).");
80 65
@@ -117,16 +102,12 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
117 const struct pnp_card_device_id *id) 102 const struct pnp_card_device_id *id)
118{ 103{
119 struct pnp_dev *pdev; 104 struct pnp_dev *pdev;
120 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
121 int err; 105 int err;
122 106
123 if (!cfg)
124 return -ENOMEM;
125 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 107 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
126 if (acard->dev == NULL) { 108 if (acard->dev == NULL)
127 kfree(cfg);
128 return -EBUSY; 109 return -EBUSY;
129 } 110
130 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL); 111 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL);
131 if (acard->devmpu == NULL) { 112 if (acard->devmpu == NULL) {
132 mpu_port[dev] = -1; 113 mpu_port[dev] = -1;
@@ -134,25 +115,10 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
134 } 115 }
135 116
136 pdev = acard->dev; 117 pdev = acard->dev;
137 pnp_init_resource_table(cfg); 118
138
139 if (port[dev] != SNDRV_AUTO_PORT)
140 pnp_resource_change(&cfg->port_resource[2], port[dev], 16);
141 if (fm_port[dev] != SNDRV_AUTO_PORT)
142 pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
143 if (dma1[dev] != SNDRV_AUTO_DMA)
144 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
145 if (dma2[dev] != SNDRV_AUTO_DMA)
146 pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
147 if (irq[dev] != SNDRV_AUTO_IRQ)
148 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
149
150 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
151 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
152 err = pnp_activate_dev(pdev); 119 err = pnp_activate_dev(pdev);
153 if (err < 0) { 120 if (err < 0) {
154 printk(KERN_ERR PFX "AUDIO PnP configure failure\n"); 121 printk(KERN_ERR PFX "AUDIO PnP configure failure\n");
155 kfree(cfg);
156 return -EBUSY; 122 return -EBUSY;
157 } 123 }
158 124
@@ -162,20 +128,11 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
162 dma2[dev] = pnp_dma(pdev, 1); 128 dma2[dev] = pnp_dma(pdev, 1);
163 irq[dev] = pnp_irq(pdev, 0); 129 irq[dev] = pnp_irq(pdev, 0);
164 130
165 if (acard->devmpu == NULL) { 131 if (acard->devmpu == NULL)
166 kfree(cfg);
167 return 0; 132 return 0;
168 }
169 pdev = acard->devmpu;
170 pnp_init_resource_table(cfg);
171 133
172 if (mpu_port[dev] != SNDRV_AUTO_PORT) 134 pdev = acard->devmpu;
173 pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
174 if (mpu_irq[dev] != SNDRV_AUTO_IRQ)
175 pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
176 135
177 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
178 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
179 err = pnp_activate_dev(pdev); 136 err = pnp_activate_dev(pdev);
180 if (err < 0) { 137 if (err < 0) {
181 printk(KERN_ERR PFX "MPU401 PnP configure failure\n"); 138 printk(KERN_ERR PFX "MPU401 PnP configure failure\n");
@@ -186,7 +143,6 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
186 mpu_irq[dev] = pnp_irq(pdev, 0); 143 mpu_irq[dev] = pnp_irq(pdev, 0);
187 } 144 }
188 145
189 kfree(cfg);
190 return 0; 146 return 0;
191} 147}
192 148
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c
index cf18fe4617a1..4b8dfe2e3dcb 100644
--- a/sound/isa/ad1816a/ad1816a_lib.c
+++ b/sound/isa/ad1816a/ad1816a_lib.c
@@ -17,7 +17,6 @@
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/ 18*/
19 19
20#include <sound/driver.h>
21#include <linux/delay.h> 20#include <linux/delay.h>
22#include <linux/init.h> 21#include <linux/init.h>
23#include <linux/interrupt.h> 22#include <linux/interrupt.h>
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
index a4710b5e214c..5f5271efdc59 100644
--- a/sound/isa/ad1848/ad1848.c
+++ b/sound/isa/ad1848/ad1848.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include <sound/driver.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/err.h> 25#include <linux/err.h>
27#include <linux/isa.h> 26#include <linux/isa.h>
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
index a901cd1ee692..630c90f9ee50 100644
--- a/sound/isa/ad1848/ad1848_lib.c
+++ b/sound/isa/ad1848/ad1848_lib.c
@@ -20,7 +20,6 @@
20 */ 20 */
21 21
22#define SNDRV_MAIN_OBJECT_FILE 22#define SNDRV_MAIN_OBJECT_FILE
23#include <sound/driver.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
@@ -213,7 +212,7 @@ static void snd_ad1848_mce_down(struct snd_ad1848 *chip)
213 for (timeout = 12000; timeout > 0 && (inb(AD1848P(chip, REGSEL)) & AD1848_INIT); timeout--) 212 for (timeout = 12000; timeout > 0 && (inb(AD1848P(chip, REGSEL)) & AD1848_INIT); timeout--)
214 udelay(100); 213 udelay(100);
215 214
216 snd_printdd("(1) timeout = %d\n", timeout); 215 snd_printdd("(1) timeout = %ld\n", timeout);
217 216
218#ifdef CONFIG_SND_DEBUG 217#ifdef CONFIG_SND_DEBUG
219 if (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) 218 if (inb(AD1848P(chip, REGSEL)) & AD1848_INIT)
diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c
index d68720724c91..efa8c80d05b6 100644
--- a/sound/isa/adlib.c
+++ b/sound/isa/adlib.c
@@ -2,7 +2,6 @@
2 * AdLib FM card driver. 2 * AdLib FM card driver.
3 */ 3 */
4 4
5#include <sound/driver.h>
6#include <linux/kernel.h> 5#include <linux/kernel.h>
7#include <linux/module.h> 6#include <linux/module.h>
8#include <linux/isa.h> 7#include <linux/isa.h>
diff --git a/sound/isa/als100.c b/sound/isa/als100.c
index f2bcfb2cf5f5..f1ce30f379c9 100644
--- a/sound/isa/als100.c
+++ b/sound/isa/als100.c
@@ -20,7 +20,6 @@
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/ 21*/
22 22
23#include <sound/driver.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/wait.h> 24#include <linux/wait.h>
26#include <linux/time.h> 25#include <linux/time.h>
@@ -63,20 +62,6 @@ module_param_array(id, charp, NULL, 0444);
63MODULE_PARM_DESC(id, "ID string for als100 based soundcard."); 62MODULE_PARM_DESC(id, "ID string for als100 based soundcard.");
64module_param_array(enable, bool, NULL, 0444); 63module_param_array(enable, bool, NULL, 0444);
65MODULE_PARM_DESC(enable, "Enable als100 based soundcard."); 64MODULE_PARM_DESC(enable, "Enable als100 based soundcard.");
66module_param_array(port, long, NULL, 0444);
67MODULE_PARM_DESC(port, "Port # for als100 driver.");
68module_param_array(mpu_port, long, NULL, 0444);
69MODULE_PARM_DESC(mpu_port, "MPU-401 port # for als100 driver.");
70module_param_array(fm_port, long, NULL, 0444);
71MODULE_PARM_DESC(fm_port, "FM port # for als100 driver.");
72module_param_array(irq, int, NULL, 0444);
73MODULE_PARM_DESC(irq, "IRQ # for als100 driver.");
74module_param_array(mpu_irq, int, NULL, 0444);
75MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for als100 driver.");
76module_param_array(dma8, int, NULL, 0444);
77MODULE_PARM_DESC(dma8, "8-bit DMA # for als100 driver.");
78module_param_array(dma16, int, NULL, 0444);
79MODULE_PARM_DESC(dma16, "16-bit DMA # for als100 driver.");
80 65
81struct snd_card_als100 { 66struct snd_card_als100 {
82 int dev_no; 67 int dev_no;
@@ -111,38 +96,20 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
111 const struct pnp_card_device_id *id) 96 const struct pnp_card_device_id *id)
112{ 97{
113 struct pnp_dev *pdev; 98 struct pnp_dev *pdev;
114 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
115 int err; 99 int err;
116 100
117 if (!cfg)
118 return -ENOMEM;
119 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 101 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
120 if (acard->dev == NULL) { 102 if (acard->dev == NULL)
121 kfree(cfg);
122 return -ENODEV; 103 return -ENODEV;
123 } 104
124 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, acard->dev); 105 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, acard->dev);
125 acard->devopl = pnp_request_card_device(card, id->devs[2].id, acard->dev); 106 acard->devopl = pnp_request_card_device(card, id->devs[2].id, acard->dev);
126 107
127 pdev = acard->dev; 108 pdev = acard->dev;
128 109
129 pnp_init_resource_table(cfg);
130
131 /* override resources */
132 if (port[dev] != SNDRV_AUTO_PORT)
133 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
134 if (dma8[dev] != SNDRV_AUTO_DMA)
135 pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 1);
136 if (dma16[dev] != SNDRV_AUTO_DMA)
137 pnp_resource_change(&cfg->dma_resource[1], dma16[dev], 1);
138 if (irq[dev] != SNDRV_AUTO_IRQ)
139 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
140 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
141 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
142 err = pnp_activate_dev(pdev); 110 err = pnp_activate_dev(pdev);
143 if (err < 0) { 111 if (err < 0) {
144 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n"); 112 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n");
145 kfree(cfg);
146 return err; 113 return err;
147 } 114 }
148 port[dev] = pnp_port_start(pdev, 0); 115 port[dev] = pnp_port_start(pdev, 0);
@@ -152,13 +119,6 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
152 119
153 pdev = acard->devmpu; 120 pdev = acard->devmpu;
154 if (pdev != NULL) { 121 if (pdev != NULL) {
155 pnp_init_resource_table(cfg);
156 if (mpu_port[dev] != SNDRV_AUTO_PORT)
157 pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
158 if (mpu_irq[dev] != SNDRV_AUTO_IRQ)
159 pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
160 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
161 snd_printk(KERN_ERR PFX "MPU401 the requested resources are invalid, using auto config\n");
162 err = pnp_activate_dev(pdev); 122 err = pnp_activate_dev(pdev);
163 if (err < 0) 123 if (err < 0)
164 goto __mpu_error; 124 goto __mpu_error;
@@ -176,11 +136,6 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
176 136
177 pdev = acard->devopl; 137 pdev = acard->devopl;
178 if (pdev != NULL) { 138 if (pdev != NULL) {
179 pnp_init_resource_table(cfg);
180 if (fm_port[dev] != SNDRV_AUTO_PORT)
181 pnp_resource_change(&cfg->port_resource[0], fm_port[dev], 4);
182 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
183 snd_printk(KERN_ERR PFX "OPL3 the requested resources are invalid, using auto config\n");
184 err = pnp_activate_dev(pdev); 139 err = pnp_activate_dev(pdev);
185 if (err < 0) 140 if (err < 0)
186 goto __fm_error; 141 goto __fm_error;
@@ -195,7 +150,6 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
195 fm_port[dev] = -1; 150 fm_port[dev] = -1;
196 } 151 }
197 152
198 kfree(cfg);
199 return 0; 153 return 0;
200} 154}
201 155
diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c
index b615538a928d..154e728f592d 100644
--- a/sound/isa/azt2320.c
+++ b/sound/isa/azt2320.c
@@ -29,7 +29,6 @@
29 activation method (full-duplex audio!). 29 activation method (full-duplex audio!).
30*/ 30*/
31 31
32#include <sound/driver.h>
33#include <asm/io.h> 32#include <asm/io.h>
34#include <linux/delay.h> 33#include <linux/delay.h>
35#include <linux/init.h> 34#include <linux/init.h>
@@ -72,22 +71,6 @@ module_param_array(id, charp, NULL, 0444);
72MODULE_PARM_DESC(id, "ID string for azt2320 based soundcard."); 71MODULE_PARM_DESC(id, "ID string for azt2320 based soundcard.");
73module_param_array(enable, bool, NULL, 0444); 72module_param_array(enable, bool, NULL, 0444);
74MODULE_PARM_DESC(enable, "Enable azt2320 based soundcard."); 73MODULE_PARM_DESC(enable, "Enable azt2320 based soundcard.");
75module_param_array(port, long, NULL, 0444);
76MODULE_PARM_DESC(port, "Port # for azt2320 driver.");
77module_param_array(wss_port, long, NULL, 0444);
78MODULE_PARM_DESC(wss_port, "WSS Port # for azt2320 driver.");
79module_param_array(mpu_port, long, NULL, 0444);
80MODULE_PARM_DESC(mpu_port, "MPU-401 port # for azt2320 driver.");
81module_param_array(fm_port, long, NULL, 0444);
82MODULE_PARM_DESC(fm_port, "FM port # for azt2320 driver.");
83module_param_array(irq, int, NULL, 0444);
84MODULE_PARM_DESC(irq, "IRQ # for azt2320 driver.");
85module_param_array(mpu_irq, int, NULL, 0444);
86MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for azt2320 driver.");
87module_param_array(dma1, int, NULL, 0444);
88MODULE_PARM_DESC(dma1, "1st DMA # for azt2320 driver.");
89module_param_array(dma2, int, NULL, 0444);
90MODULE_PARM_DESC(dma2, "2nd DMA # for azt2320 driver.");
91 74
92struct snd_card_azt2320 { 75struct snd_card_azt2320 {
93 int dev_no; 76 int dev_no;
@@ -121,43 +104,19 @@ static int __devinit snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acar
121 const struct pnp_card_device_id *id) 104 const struct pnp_card_device_id *id)
122{ 105{
123 struct pnp_dev *pdev; 106 struct pnp_dev *pdev;
124 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
125 int err; 107 int err;
126 108
127 if (!cfg)
128 return -ENOMEM;
129
130 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 109 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
131 if (acard->dev == NULL) { 110 if (acard->dev == NULL)
132 kfree(cfg);
133 return -ENODEV; 111 return -ENODEV;
134 }
135 112
136 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL); 113 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL);
137 114
138 pdev = acard->dev; 115 pdev = acard->dev;
139 pnp_init_resource_table(cfg);
140
141 /* override resources */
142 if (port[dev] != SNDRV_AUTO_PORT)
143 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
144 if (fm_port[dev] != SNDRV_AUTO_PORT)
145 pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
146 if (wss_port[dev] != SNDRV_AUTO_PORT)
147 pnp_resource_change(&cfg->port_resource[2], wss_port[dev], 4);
148 if (dma1[dev] != SNDRV_AUTO_DMA)
149 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
150 if (dma2[dev] != SNDRV_AUTO_DMA)
151 pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
152 if (irq[dev] != SNDRV_AUTO_IRQ)
153 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
154 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
155 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
156 116
157 err = pnp_activate_dev(pdev); 117 err = pnp_activate_dev(pdev);
158 if (err < 0) { 118 if (err < 0) {
159 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n"); 119 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n");
160 kfree(cfg);
161 return err; 120 return err;
162 } 121 }
163 port[dev] = pnp_port_start(pdev, 0); 122 port[dev] = pnp_port_start(pdev, 0);
@@ -169,13 +128,6 @@ static int __devinit snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acar
169 128
170 pdev = acard->devmpu; 129 pdev = acard->devmpu;
171 if (pdev != NULL) { 130 if (pdev != NULL) {
172 pnp_init_resource_table(cfg);
173 if (mpu_port[dev] != SNDRV_AUTO_PORT)
174 pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
175 if (mpu_irq[dev] != SNDRV_AUTO_IRQ)
176 pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
177 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
178 snd_printk(KERN_ERR PFX "MPU401 the requested resources are invalid, using auto config\n");
179 err = pnp_activate_dev(pdev); 131 err = pnp_activate_dev(pdev);
180 if (err < 0) 132 if (err < 0)
181 goto __mpu_error; 133 goto __mpu_error;
@@ -191,7 +143,6 @@ static int __devinit snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acar
191 mpu_port[dev] = -1; 143 mpu_port[dev] = -1;
192 } 144 }
193 145
194 kfree (cfg);
195 return 0; 146 return 0;
196} 147}
197 148
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index f471f8ad6885..4d198ec71e9b 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -43,7 +43,6 @@
43 * full control over both mixers. 43 * full control over both mixers.
44 */ 44 */
45 45
46#include <sound/driver.h>
47#include <linux/init.h> 46#include <linux/init.h>
48#include <linux/err.h> 47#include <linux/err.h>
49#include <linux/isa.h> 48#include <linux/isa.h>
@@ -286,39 +285,21 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
286 const struct pnp_card_device_id *id) 285 const struct pnp_card_device_id *id)
287{ 286{
288 struct pnp_dev *pdev; 287 struct pnp_dev *pdev;
289 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
290 int err; 288 int err;
291 289
292 if (!cfg)
293 return -ENOMEM;
294 acard->cap = pnp_request_card_device(card, id->devs[0].id, NULL); 290 acard->cap = pnp_request_card_device(card, id->devs[0].id, NULL);
295 if (acard->cap == NULL) { 291 if (acard->cap == NULL)
296 kfree(cfg);
297 return -EBUSY; 292 return -EBUSY;
298 } 293
299 acard->play = pnp_request_card_device(card, id->devs[1].id, NULL); 294 acard->play = pnp_request_card_device(card, id->devs[1].id, NULL);
300 if (acard->play == NULL) { 295 if (acard->play == NULL)
301 kfree(cfg);
302 return -EBUSY; 296 return -EBUSY;
303 }
304 297
305 pdev = acard->cap; 298 pdev = acard->cap;
306 pnp_init_resource_table(cfg); 299
307 /* allocate AD1848 resources */
308 if (wssport[dev] != SNDRV_AUTO_PORT)
309 pnp_resource_change(&cfg->port_resource[0], wssport[dev], 8);
310 if (wssdma[dev] != SNDRV_AUTO_DMA)
311 pnp_resource_change(&cfg->dma_resource[0], wssdma[dev], 1);
312 if (wssirq[dev] != SNDRV_AUTO_IRQ)
313 pnp_resource_change(&cfg->irq_resource[0], wssirq[dev], 1);
314
315 err = pnp_manual_config_dev(pdev, cfg, 0);
316 if (err < 0)
317 snd_printk(KERN_ERR "CMI8330/C3D (AD1848) PnP manual resources are invalid, using auto config\n");
318 err = pnp_activate_dev(pdev); 300 err = pnp_activate_dev(pdev);
319 if (err < 0) { 301 if (err < 0) {
320 snd_printk(KERN_ERR "CMI8330/C3D (AD1848) PnP configure failure\n"); 302 snd_printk(KERN_ERR "CMI8330/C3D (AD1848) PnP configure failure\n");
321 kfree(cfg);
322 return -EBUSY; 303 return -EBUSY;
323 } 304 }
324 wssport[dev] = pnp_port_start(pdev, 0); 305 wssport[dev] = pnp_port_start(pdev, 0);
@@ -327,23 +308,10 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
327 308
328 /* allocate SB16 resources */ 309 /* allocate SB16 resources */
329 pdev = acard->play; 310 pdev = acard->play;
330 pnp_init_resource_table(cfg); 311
331 if (sbport[dev] != SNDRV_AUTO_PORT)
332 pnp_resource_change(&cfg->port_resource[0], sbport[dev], 16);
333 if (sbdma8[dev] != SNDRV_AUTO_DMA)
334 pnp_resource_change(&cfg->dma_resource[0], sbdma8[dev], 1);
335 if (sbdma16[dev] != SNDRV_AUTO_DMA)
336 pnp_resource_change(&cfg->dma_resource[1], sbdma16[dev], 1);
337 if (sbirq[dev] != SNDRV_AUTO_IRQ)
338 pnp_resource_change(&cfg->irq_resource[0], sbirq[dev], 1);
339
340 err = pnp_manual_config_dev(pdev, cfg, 0);
341 if (err < 0)
342 snd_printk(KERN_ERR "CMI8330/C3D (SB16) PnP manual resources are invalid, using auto config\n");
343 err = pnp_activate_dev(pdev); 312 err = pnp_activate_dev(pdev);
344 if (err < 0) { 313 if (err < 0) {
345 snd_printk(KERN_ERR "CMI8330/C3D (SB16) PnP configure failure\n"); 314 snd_printk(KERN_ERR "CMI8330/C3D (SB16) PnP configure failure\n");
346 kfree(cfg);
347 return -EBUSY; 315 return -EBUSY;
348 } 316 }
349 sbport[dev] = pnp_port_start(pdev, 0); 317 sbport[dev] = pnp_port_start(pdev, 0);
@@ -351,7 +319,6 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
351 sbdma16[dev] = pnp_dma(pdev, 1); 319 sbdma16[dev] = pnp_dma(pdev, 1);
352 sbirq[dev] = pnp_irq(pdev, 0); 320 sbirq[dev] = pnp_irq(pdev, 0);
353 321
354 kfree(cfg);
355 return 0; 322 return 0;
356} 323}
357#endif 324#endif
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
index 13db6842eaaa..e9462b9944be 100644
--- a/sound/isa/cs423x/cs4231.c
+++ b/sound/isa/cs423x/cs4231.c
@@ -20,7 +20,6 @@
20 * 20 *
21 */ 21 */
22 22
23#include <sound/driver.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/err.h> 24#include <linux/err.h>
26#include <linux/isa.h> 25#include <linux/isa.h>
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c
index a5eb9659b519..0aa8649e5c7f 100644
--- a/sound/isa/cs423x/cs4231_lib.c
+++ b/sound/isa/cs423x/cs4231_lib.c
@@ -24,7 +24,6 @@
24 * 24 *
25 */ 25 */
26 26
27#include <sound/driver.h>
28#include <linux/delay.h> 27#include <linux/delay.h>
29#include <linux/pm.h> 28#include <linux/pm.h>
30#include <linux/init.h> 29#include <linux/init.h>
@@ -333,7 +332,6 @@ void snd_cs4231_mce_down(struct snd_cs4231 *chip)
333 !(chip->hardware & (CS4231_HW_CS4231_MASK | CS4231_HW_CS4232_MASK))) { 332 !(chip->hardware & (CS4231_HW_CS4231_MASK | CS4231_HW_CS4232_MASK))) {
334 return; 333 return;
335 } 334 }
336 snd_cs4231_busy_wait(chip);
337 335
338 /* 336 /*
339 * Wait for (possible -- during init auto-calibration may not be set) 337 * Wait for (possible -- during init auto-calibration may not be set)
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 5784b43f4123..dbe63db4bfd6 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/err.h> 23#include <linux/err.h>
25#include <linux/isa.h> 24#include <linux/isa.h>
@@ -270,29 +269,9 @@ static struct pnp_card_device_id snd_cs423x_pnpids[] = {
270MODULE_DEVICE_TABLE(pnp_card, snd_cs423x_pnpids); 269MODULE_DEVICE_TABLE(pnp_card, snd_cs423x_pnpids);
271 270
272/* WSS initialization */ 271/* WSS initialization */
273static int __devinit snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev, 272static int __devinit snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev)
274 struct pnp_resource_table *cfg)
275{ 273{
276 int err; 274 if (pnp_activate_dev(pdev) < 0) {
277
278 pnp_init_resource_table(cfg);
279 if (port[dev] != SNDRV_AUTO_PORT)
280 pnp_resource_change(&cfg->port_resource[0], port[dev], 4);
281 if (fm_port[dev] != SNDRV_AUTO_PORT && fm_port[dev] > 0)
282 pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
283 if (sb_port[dev] != SNDRV_AUTO_PORT)
284 pnp_resource_change(&cfg->port_resource[2], sb_port[dev], 16);
285 if (irq[dev] != SNDRV_AUTO_IRQ)
286 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
287 if (dma1[dev] != SNDRV_AUTO_DMA)
288 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
289 if (dma2[dev] != SNDRV_AUTO_DMA)
290 pnp_resource_change(&cfg->dma_resource[1], dma2[dev] < 0 ? 4 : dma2[dev], 1);
291 err = pnp_manual_config_dev(pdev, cfg, 0);
292 if (err < 0)
293 snd_printk(KERN_ERR IDENT " WSS PnP manual resources are invalid, using auto config\n");
294 err = pnp_activate_dev(pdev);
295 if (err < 0) {
296 printk(KERN_ERR IDENT " WSS PnP configure failed for WSS (out of resources?)\n"); 275 printk(KERN_ERR IDENT " WSS PnP configure failed for WSS (out of resources?)\n");
297 return -EBUSY; 276 return -EBUSY;
298 } 277 }
@@ -311,19 +290,9 @@ static int __devinit snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev,
311} 290}
312 291
313/* CTRL initialization */ 292/* CTRL initialization */
314static int __devinit snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev, 293static int __devinit snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev)
315 struct pnp_resource_table *cfg)
316{ 294{
317 int err; 295 if (pnp_activate_dev(pdev) < 0) {
318
319 pnp_init_resource_table(cfg);
320 if (cport[dev] != SNDRV_AUTO_PORT)
321 pnp_resource_change(&cfg->port_resource[0], cport[dev], 8);
322 err = pnp_manual_config_dev(pdev, cfg, 0);
323 if (err < 0)
324 snd_printk(KERN_ERR IDENT " CTRL PnP manual resources are invalid, using auto config\n");
325 err = pnp_activate_dev(pdev);
326 if (err < 0) {
327 printk(KERN_ERR IDENT " CTRL PnP configure failed for WSS (out of resources?)\n"); 296 printk(KERN_ERR IDENT " CTRL PnP configure failed for WSS (out of resources?)\n");
328 return -EBUSY; 297 return -EBUSY;
329 } 298 }
@@ -333,21 +302,9 @@ static int __devinit snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev,
333} 302}
334 303
335/* MPU initialization */ 304/* MPU initialization */
336static int __devinit snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev, 305static int __devinit snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
337 struct pnp_resource_table *cfg)
338{ 306{
339 int err; 307 if (pnp_activate_dev(pdev) < 0) {
340
341 pnp_init_resource_table(cfg);
342 if (mpu_port[dev] != SNDRV_AUTO_PORT)
343 pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
344 if (mpu_irq[dev] != SNDRV_AUTO_IRQ && mpu_irq[dev] >= 0)
345 pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
346 err = pnp_manual_config_dev(pdev, cfg, 0);
347 if (err < 0)
348 snd_printk(KERN_ERR IDENT " MPU401 PnP manual resources are invalid, using auto config\n");
349 err = pnp_activate_dev(pdev);
350 if (err < 0) {
351 printk(KERN_ERR IDENT " MPU401 PnP configure failed for WSS (out of resources?)\n"); 308 printk(KERN_ERR IDENT " MPU401 PnP configure failed for WSS (out of resources?)\n");
352 mpu_port[dev] = SNDRV_AUTO_PORT; 309 mpu_port[dev] = SNDRV_AUTO_PORT;
353 mpu_irq[dev] = SNDRV_AUTO_IRQ; 310 mpu_irq[dev] = SNDRV_AUTO_IRQ;
@@ -368,15 +325,8 @@ static int __devinit snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev,
368static int __devinit snd_card_cs4232_pnp(int dev, struct snd_card_cs4236 *acard, 325static int __devinit snd_card_cs4232_pnp(int dev, struct snd_card_cs4236 *acard,
369 struct pnp_dev *pdev) 326 struct pnp_dev *pdev)
370{ 327{
371 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); 328 if (snd_cs423x_pnp_init_wss(dev, acard->wss) < 0)
372
373 if (!cfg)
374 return -ENOMEM;
375 if (snd_cs423x_pnp_init_wss(dev, acard->wss, cfg) < 0) {
376 kfree(cfg);
377 return -EBUSY; 329 return -EBUSY;
378 }
379 kfree(cfg);
380 cport[dev] = -1; 330 cport[dev] = -1;
381 return 0; 331 return 0;
382} 332}
@@ -386,43 +336,33 @@ static int __devinit snd_card_cs423x_pnpc(int dev, struct snd_card_cs4236 *acard
386 struct pnp_card_link *card, 336 struct pnp_card_link *card,
387 const struct pnp_card_device_id *id) 337 const struct pnp_card_device_id *id)
388{ 338{
389 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
390
391 if (!cfg)
392 return -ENOMEM;
393
394 acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL); 339 acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL);
395 if (acard->wss == NULL) 340 if (acard->wss == NULL)
396 goto error; 341 return -EBUSY;
397 acard->ctrl = pnp_request_card_device(card, id->devs[1].id, NULL); 342 acard->ctrl = pnp_request_card_device(card, id->devs[1].id, NULL);
398 if (acard->ctrl == NULL) 343 if (acard->ctrl == NULL)
399 goto error; 344 return -EBUSY;
400 if (id->devs[2].id[0]) { 345 if (id->devs[2].id[0]) {
401 acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL); 346 acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL);
402 if (acard->mpu == NULL) 347 if (acard->mpu == NULL)
403 goto error; 348 return -EBUSY;
404 } 349 }
405 350
406 /* WSS initialization */ 351 /* WSS initialization */
407 if (snd_cs423x_pnp_init_wss(dev, acard->wss, cfg) < 0) 352 if (snd_cs423x_pnp_init_wss(dev, acard->wss) < 0)
408 goto error; 353 return -EBUSY;
409 354
410 /* CTRL initialization */ 355 /* CTRL initialization */
411 if (acard->ctrl && cport[dev] > 0) { 356 if (acard->ctrl && cport[dev] > 0) {
412 if (snd_cs423x_pnp_init_ctrl(dev, acard->ctrl, cfg) < 0) 357 if (snd_cs423x_pnp_init_ctrl(dev, acard->ctrl) < 0)
413 goto error; 358 return -EBUSY;
414 } 359 }
415 /* MPU initialization */ 360 /* MPU initialization */
416 if (acard->mpu && mpu_port[dev] > 0) { 361 if (acard->mpu && mpu_port[dev] > 0) {
417 if (snd_cs423x_pnp_init_mpu(dev, acard->mpu, cfg) < 0) 362 if (snd_cs423x_pnp_init_mpu(dev, acard->mpu) < 0)
418 goto error; 363 return -EBUSY;
419 } 364 }
420 kfree(cfg);
421 return 0; 365 return 0;
422
423 error:
424 kfree(cfg);
425 return -EBUSY;
426} 366}
427#endif /* CONFIG_PNP */ 367#endif /* CONFIG_PNP */
428 368
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c
index 6bd064470d4c..de71910401ea 100644
--- a/sound/isa/cs423x/cs4236_lib.c
+++ b/sound/isa/cs423x/cs4236_lib.c
@@ -79,7 +79,6 @@
79 * 79 *
80 */ 80 */
81 81
82#include <sound/driver.h>
83#include <asm/io.h> 82#include <asm/io.h>
84#include <linux/delay.h> 83#include <linux/delay.h>
85#include <linux/init.h> 84#include <linux/init.h>
diff --git a/sound/isa/dt019x.c b/sound/isa/dt019x.c
index ce57d526f7bc..a0242c3b613e 100644
--- a/sound/isa/dt019x.c
+++ b/sound/isa/dt019x.c
@@ -21,7 +21,6 @@
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*/ 22*/
23 23
24#include <sound/driver.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/wait.h> 25#include <linux/wait.h>
27#include <linux/pnp.h> 26#include <linux/pnp.h>
@@ -56,18 +55,6 @@ module_param_array(id, charp, NULL, 0444);
56MODULE_PARM_DESC(id, "ID string for DT-019X based soundcard."); 55MODULE_PARM_DESC(id, "ID string for DT-019X based soundcard.");
57module_param_array(enable, bool, NULL, 0444); 56module_param_array(enable, bool, NULL, 0444);
58MODULE_PARM_DESC(enable, "Enable DT-019X based soundcard."); 57MODULE_PARM_DESC(enable, "Enable DT-019X based soundcard.");
59module_param_array(port, long, NULL, 0444);
60MODULE_PARM_DESC(port, "Port # for dt019x driver.");
61module_param_array(mpu_port, long, NULL, 0444);
62MODULE_PARM_DESC(mpu_port, "MPU-401 port # for dt019x driver.");
63module_param_array(fm_port, long, NULL, 0444);
64MODULE_PARM_DESC(fm_port, "FM port # for dt019x driver.");
65module_param_array(irq, int, NULL, 0444);
66MODULE_PARM_DESC(irq, "IRQ # for dt019x driver.");
67module_param_array(mpu_irq, int, NULL, 0444);
68MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for dt019x driver.");
69module_param_array(dma8, int, NULL, 0444);
70MODULE_PARM_DESC(dma8, "8-bit DMA # for dt019x driver.");
71 58
72struct snd_card_dt019x { 59struct snd_card_dt019x {
73 struct pnp_dev *dev; 60 struct pnp_dev *dev;
@@ -95,36 +82,20 @@ static int __devinit snd_card_dt019x_pnp(int dev, struct snd_card_dt019x *acard,
95 const struct pnp_card_device_id *pid) 82 const struct pnp_card_device_id *pid)
96{ 83{
97 struct pnp_dev *pdev; 84 struct pnp_dev *pdev;
98 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
99 int err; 85 int err;
100 86
101 if (!cfg)
102 return -ENOMEM;
103
104 acard->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); 87 acard->dev = pnp_request_card_device(card, pid->devs[0].id, NULL);
105 if (acard->dev == NULL) { 88 if (acard->dev == NULL)
106 kfree (cfg);
107 return -ENODEV; 89 return -ENODEV;
108 } 90
109 acard->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); 91 acard->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL);
110 acard->devopl = pnp_request_card_device(card, pid->devs[2].id, NULL); 92 acard->devopl = pnp_request_card_device(card, pid->devs[2].id, NULL);
111 93
112 pdev = acard->dev; 94 pdev = acard->dev;
113 pnp_init_resource_table(cfg);
114
115 if (port[dev] != SNDRV_AUTO_PORT)
116 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
117 if (dma8[dev] != SNDRV_AUTO_DMA)
118 pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 1);
119 if (irq[dev] != SNDRV_AUTO_IRQ)
120 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
121 95
122 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
123 snd_printk(KERN_ERR PFX "DT-019X AUDIO the requested resources are invalid, using auto config\n");
124 err = pnp_activate_dev(pdev); 96 err = pnp_activate_dev(pdev);
125 if (err < 0) { 97 if (err < 0) {
126 snd_printk(KERN_ERR PFX "DT-019X AUDIO pnp configure failure\n"); 98 snd_printk(KERN_ERR PFX "DT-019X AUDIO pnp configure failure\n");
127 kfree(cfg);
128 return err; 99 return err;
129 } 100 }
130 101
@@ -135,15 +106,7 @@ static int __devinit snd_card_dt019x_pnp(int dev, struct snd_card_dt019x *acard,
135 port[dev],irq[dev],dma8[dev]); 106 port[dev],irq[dev],dma8[dev]);
136 107
137 pdev = acard->devmpu; 108 pdev = acard->devmpu;
138
139 if (pdev != NULL) { 109 if (pdev != NULL) {
140 pnp_init_resource_table(cfg);
141 if (mpu_port[dev] != SNDRV_AUTO_PORT)
142 pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
143 if (mpu_irq[dev] != SNDRV_AUTO_IRQ)
144 pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
145 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
146 snd_printk(KERN_ERR PFX "DT-019X MPU401 the requested resources are invalid, using auto config\n");
147 err = pnp_activate_dev(pdev); 110 err = pnp_activate_dev(pdev);
148 if (err < 0) { 111 if (err < 0) {
149 pnp_release_card_device(pdev); 112 pnp_release_card_device(pdev);
@@ -162,11 +125,6 @@ static int __devinit snd_card_dt019x_pnp(int dev, struct snd_card_dt019x *acard,
162 125
163 pdev = acard->devopl; 126 pdev = acard->devopl;
164 if (pdev != NULL) { 127 if (pdev != NULL) {
165 pnp_init_resource_table(cfg);
166 if (fm_port[dev] != SNDRV_AUTO_PORT)
167 pnp_resource_change(&cfg->port_resource[0], fm_port[dev], 4);
168 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
169 snd_printk(KERN_ERR PFX "DT-019X OPL3 the requested resources are invalid, using auto config\n");
170 err = pnp_activate_dev(pdev); 128 err = pnp_activate_dev(pdev);
171 if (err < 0) { 129 if (err < 0) {
172 pnp_release_card_device(pdev); 130 pnp_release_card_device(pdev);
@@ -181,7 +139,6 @@ static int __devinit snd_card_dt019x_pnp(int dev, struct snd_card_dt019x *acard,
181 fm_port[dev] = -1; 139 fm_port[dev] = -1;
182 } 140 }
183 141
184 kfree(cfg);
185 return 0; 142 return 0;
186} 143}
187 144
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index 74bbc92f2e7c..f88639ea64b2 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/err.h> 23#include <linux/err.h>
25#include <linux/isa.h> 24#include <linux/isa.h>
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c
index 5c26d495daa8..1e1e575b1db3 100644
--- a/sound/isa/es1688/es1688_lib.c
+++ b/sound/isa/es1688/es1688_lib.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/interrupt.h> 23#include <linux/interrupt.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index c1af28fd4a1f..90498e4ca260 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -77,7 +77,6 @@
77 * needed for ZV, so maybe the datasheet is entirely wrong here. 77 * needed for ZV, so maybe the datasheet is entirely wrong here.
78 */ 78 */
79 79
80#include <sound/driver.h>
81#include <linux/init.h> 80#include <linux/init.h>
82#include <linux/err.h> 81#include <linux/err.h>
83#include <linux/isa.h> 82#include <linux/isa.h>
@@ -163,7 +162,7 @@ struct snd_audiodrive {
163#define ES18XX_DUPLEX_SAME 0x0010 /* Playback and record must share the same rate */ 162#define ES18XX_DUPLEX_SAME 0x0010 /* Playback and record must share the same rate */
164#define ES18XX_NEW_RATE 0x0020 /* More precise rate setting */ 163#define ES18XX_NEW_RATE 0x0020 /* More precise rate setting */
165#define ES18XX_AUXB 0x0040 /* AuxB mixer control */ 164#define ES18XX_AUXB 0x0040 /* AuxB mixer control */
166#define ES18XX_HWV 0x0080 /* Has seperate hardware volume mixer controls*/ 165#define ES18XX_HWV 0x0080 /* Has separate hardware volume mixer controls*/
167#define ES18XX_MONO 0x0100 /* Mono_in mixer control */ 166#define ES18XX_MONO 0x0100 /* Mono_in mixer control */
168#define ES18XX_I2S 0x0200 /* I2S mixer control */ 167#define ES18XX_I2S 0x0200 /* I2S mixer control */
169#define ES18XX_MUTEREC 0x0400 /* Record source can be muted */ 168#define ES18XX_MUTEREC 0x0400 /* Record source can be muted */
@@ -1442,6 +1441,8 @@ static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip)
1442 snd_es18xx_write(chip, 0xB2, 0x50); 1441 snd_es18xx_write(chip, 0xB2, 0x50);
1443 /* Enable MPU and hardware volume interrupt */ 1442 /* Enable MPU and hardware volume interrupt */
1444 snd_es18xx_mixer_write(chip, 0x64, 0x42); 1443 snd_es18xx_mixer_write(chip, 0x64, 0x42);
1444 /* Enable ESS wavetable input */
1445 snd_es18xx_mixer_bits(chip, 0x48, 0x10, 0x10);
1445 } 1446 }
1446 else { 1447 else {
1447 int irqmask, dma1mask, dma2mask; 1448 int irqmask, dma1mask, dma2mask;
@@ -2035,31 +2036,9 @@ static struct pnp_device_id snd_audiodrive_pnpbiosids[] = {
2035MODULE_DEVICE_TABLE(pnp, snd_audiodrive_pnpbiosids); 2036MODULE_DEVICE_TABLE(pnp, snd_audiodrive_pnpbiosids);
2036 2037
2037/* PnP main device initialization */ 2038/* PnP main device initialization */
2038static int __devinit snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev, 2039static int __devinit snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev)
2039 struct pnp_resource_table *cfg)
2040{ 2040{
2041 int err; 2041 if (pnp_activate_dev(pdev) < 0) {
2042
2043 pnp_init_resource_table(cfg);
2044 if (port[dev] != SNDRV_AUTO_PORT)
2045 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
2046 if (fm_port[dev] != SNDRV_AUTO_PORT)
2047 pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
2048 if (mpu_port[dev] != SNDRV_AUTO_PORT)
2049 pnp_resource_change(&cfg->port_resource[2], mpu_port[dev], 2);
2050 if (dma1[dev] != SNDRV_AUTO_DMA)
2051 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
2052 if (dma2[dev] != SNDRV_AUTO_DMA)
2053 pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
2054 if (irq[dev] != SNDRV_AUTO_IRQ)
2055 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
2056 if (pnp_device_is_isapnp(pdev)) {
2057 err = pnp_manual_config_dev(pdev, cfg, 0);
2058 if (err < 0)
2059 snd_printk(KERN_ERR PFX "PnP manual resources are invalid, using auto config\n");
2060 }
2061 err = pnp_activate_dev(pdev);
2062 if (err < 0) {
2063 snd_printk(KERN_ERR PFX "PnP configure failure (out of resources?)\n"); 2042 snd_printk(KERN_ERR PFX "PnP configure failure (out of resources?)\n");
2064 return -EBUSY; 2043 return -EBUSY;
2065 } 2044 }
@@ -2087,16 +2066,9 @@ static int __devinit snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev,
2087static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard, 2066static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard,
2088 struct pnp_dev *pdev) 2067 struct pnp_dev *pdev)
2089{ 2068{
2090 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
2091
2092 if (!cfg)
2093 return -ENOMEM;
2094 acard->dev = pdev; 2069 acard->dev = pdev;
2095 if (snd_audiodrive_pnp_init_main(dev, acard->dev, cfg) < 0) { 2070 if (snd_audiodrive_pnp_init_main(dev, acard->dev) < 0)
2096 kfree(cfg);
2097 return -EBUSY; 2071 return -EBUSY;
2098 }
2099 kfree(cfg);
2100 return 0; 2072 return 0;
2101} 2073}
2102 2074
@@ -2125,33 +2097,24 @@ static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard,
2125 struct pnp_card_link *card, 2097 struct pnp_card_link *card,
2126 const struct pnp_card_device_id *id) 2098 const struct pnp_card_device_id *id)
2127{ 2099{
2128 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
2129
2130 if (!cfg)
2131 return -ENOMEM;
2132 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 2100 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
2133 if (acard->dev == NULL) { 2101 if (acard->dev == NULL)
2134 kfree(cfg);
2135 return -EBUSY; 2102 return -EBUSY;
2136 } 2103
2137 acard->devc = pnp_request_card_device(card, id->devs[1].id, NULL); 2104 acard->devc = pnp_request_card_device(card, id->devs[1].id, NULL);
2138 if (acard->devc == NULL) { 2105 if (acard->devc == NULL)
2139 kfree(cfg);
2140 return -EBUSY; 2106 return -EBUSY;
2141 } 2107
2142 /* Control port initialization */ 2108 /* Control port initialization */
2143 if (pnp_activate_dev(acard->devc) < 0) { 2109 if (pnp_activate_dev(acard->devc) < 0) {
2144 kfree(cfg);
2145 snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n"); 2110 snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n");
2146 return -EAGAIN; 2111 return -EAGAIN;
2147 } 2112 }
2148 snd_printdd("pnp: port=0x%llx\n", 2113 snd_printdd("pnp: port=0x%llx\n",
2149 (unsigned long long)pnp_port_start(acard->devc, 0)); 2114 (unsigned long long)pnp_port_start(acard->devc, 0));
2150 if (snd_audiodrive_pnp_init_main(dev, acard->dev, cfg) < 0) { 2115 if (snd_audiodrive_pnp_init_main(dev, acard->dev) < 0)
2151 kfree(cfg);
2152 return -EBUSY; 2116 return -EBUSY;
2153 } 2117
2154 kfree(cfg);
2155 return 0; 2118 return 0;
2156} 2119}
2157#endif /* CONFIG_PNP */ 2120#endif /* CONFIG_PNP */
diff --git a/sound/isa/gus/Makefile b/sound/isa/gus/Makefile
index df3d59f25f5e..6cd4ee03754a 100644
--- a/sound/isa/gus/Makefile
+++ b/sound/isa/gus/Makefile
@@ -9,7 +9,6 @@ snd-gus-lib-objs := gus_main.o \
9 gus_pcm.o gus_mixer.o \ 9 gus_pcm.o gus_mixer.o \
10 gus_uart.o \ 10 gus_uart.o \
11 gus_reset.o 11 gus_reset.o
12snd-gus-synth-objs := gus_synth.o gus_sample.o gus_simple.o gus_instr.o
13 12
14snd-gusclassic-objs := gusclassic.o 13snd-gusclassic-objs := gusclassic.o
15snd-gusextreme-objs := gusextreme.o 14snd-gusextreme-objs := gusextreme.o
@@ -17,20 +16,9 @@ snd-gusmax-objs := gusmax.o
17snd-interwave-objs := interwave.o 16snd-interwave-objs := interwave.o
18snd-interwave-stb-objs := interwave-stb.o 17snd-interwave-stb-objs := interwave-stb.o
19 18
20#
21# this function returns:
22# "m" - CONFIG_SND_SEQUENCER is m
23# <empty string> - CONFIG_SND_SEQUENCER is undefined
24# otherwise parameter #1 value
25#
26sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_SND_SEQUENCER),$(1)))
27
28# Toplevel Module Dependency 19# Toplevel Module Dependency
29obj-$(CONFIG_SND_GUSCLASSIC) += snd-gusclassic.o snd-gus-lib.o 20obj-$(CONFIG_SND_GUSCLASSIC) += snd-gusclassic.o snd-gus-lib.o
30obj-$(CONFIG_SND_GUSMAX) += snd-gusmax.o snd-gus-lib.o 21obj-$(CONFIG_SND_GUSMAX) += snd-gusmax.o snd-gus-lib.o
31obj-$(CONFIG_SND_GUSEXTREME) += snd-gusextreme.o snd-gus-lib.o 22obj-$(CONFIG_SND_GUSEXTREME) += snd-gusextreme.o snd-gus-lib.o
32obj-$(CONFIG_SND_INTERWAVE) += snd-interwave.o snd-gus-lib.o 23obj-$(CONFIG_SND_INTERWAVE) += snd-interwave.o snd-gus-lib.o
33obj-$(CONFIG_SND_INTERWAVE_STB) += snd-interwave-stb.o snd-gus-lib.o 24obj-$(CONFIG_SND_INTERWAVE_STB) += snd-interwave-stb.o snd-gus-lib.o
34obj-$(call sequencer,$(CONFIG_SND_GUS_SYNTH)) += snd-gus-synth.o
35
36obj-m := $(sort $(obj-m))
diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c
index fc905141e8a5..f45f6116c77a 100644
--- a/sound/isa/gus/gus_dma.c
+++ b/sound/isa/gus/gus_dma.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <asm/dma.h> 22#include <asm/dma.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
25#include <sound/core.h> 24#include <sound/core.h>
diff --git a/sound/isa/gus/gus_dram.c b/sound/isa/gus/gus_dram.c
index 9eaa932f6efe..fd2e2e2ed4e7 100644
--- a/sound/isa/gus/gus_dram.c
+++ b/sound/isa/gus/gus_dram.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/time.h> 22#include <linux/time.h>
24#include <sound/core.h> 23#include <sound/core.h>
25#include <sound/gus.h> 24#include <sound/gus.h>
diff --git a/sound/isa/gus/gus_instr.c b/sound/isa/gus/gus_instr.c
index bf137ea72329..4dc9caf8ddcf 100644
--- a/sound/isa/gus/gus_instr.c
+++ b/sound/isa/gus/gus_instr.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/time.h> 22#include <linux/time.h>
24#include <sound/core.h> 23#include <sound/core.h>
25#include <sound/gus.h> 24#include <sound/gus.h>
diff --git a/sound/isa/gus/gus_io.c b/sound/isa/gus/gus_io.c
index 3d4f899285ef..ca79878d8d8c 100644
--- a/sound/isa/gus/gus_io.c
+++ b/sound/isa/gus/gus_io.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/delay.h> 22#include <linux/delay.h>
24#include <linux/time.h> 23#include <linux/time.h>
25#include <sound/core.h> 24#include <sound/core.h>
diff --git a/sound/isa/gus/gus_irq.c b/sound/isa/gus/gus_irq.c
index cd9a6f1c99e6..041894ddd014 100644
--- a/sound/isa/gus/gus_irq.c
+++ b/sound/isa/gus/gus_irq.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <sound/core.h> 22#include <sound/core.h>
24#include <sound/info.h> 23#include <sound/info.h>
25#include <sound/gus.h> 24#include <sound/gus.h>
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index b14d5d6d9a32..cccc16c8113f 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/interrupt.h> 23#include <linux/interrupt.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
@@ -104,12 +103,6 @@ static int snd_gus_free(struct snd_gus_card *gus)
104{ 103{
105 if (gus->gf1.res_port2 == NULL) 104 if (gus->gf1.res_port2 == NULL)
106 goto __hw_end; 105 goto __hw_end;
107#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
108 if (gus->seq_dev) {
109 snd_device_free(gus->card, gus->seq_dev);
110 gus->seq_dev = NULL;
111 }
112#endif
113 snd_gf1_stop(gus); 106 snd_gf1_stop(gus);
114 snd_gus_init_dma_irq(gus, 0); 107 snd_gus_init_dma_irq(gus, 0);
115 __hw_end: 108 __hw_end:
@@ -408,14 +401,6 @@ static int snd_gus_check_version(struct snd_gus_card * gus)
408 return 0; 401 return 0;
409} 402}
410 403
411#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
412static void snd_gus_seq_dev_free(struct snd_seq_device *seq_dev)
413{
414 struct snd_gus_card *gus = seq_dev->private_data;
415 gus->seq_dev = NULL;
416}
417#endif
418
419int snd_gus_initialize(struct snd_gus_card *gus) 404int snd_gus_initialize(struct snd_gus_card *gus)
420{ 405{
421 int err; 406 int err;
@@ -430,15 +415,6 @@ int snd_gus_initialize(struct snd_gus_card *gus)
430 } 415 }
431 if ((err = snd_gus_init_dma_irq(gus, 1)) < 0) 416 if ((err = snd_gus_init_dma_irq(gus, 1)) < 0)
432 return err; 417 return err;
433#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
434 if (snd_seq_device_new(gus->card, 1, SNDRV_SEQ_DEV_ID_GUS,
435 sizeof(struct snd_gus_card *), &gus->seq_dev) >= 0) {
436 strcpy(gus->seq_dev->name, "GUS");
437 *(struct snd_gus_card **)SNDRV_SEQ_DEVICE_ARGPTR(gus->seq_dev) = gus;
438 gus->seq_dev->private_data = gus;
439 gus->seq_dev->private_free = snd_gus_seq_dev_free;
440 }
441#endif
442 snd_gf1_start(gus); 418 snd_gf1_start(gus);
443 gus->initialized = 1; 419 gus->initialized = 1;
444 return 0; 420 return 0;
diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c
index bcf4656853c4..661205c4dcea 100644
--- a/sound/isa/gus/gus_mem.c
+++ b/sound/isa/gus/gus_mem.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/slab.h> 22#include <linux/slab.h>
24#include <linux/string.h> 23#include <linux/string.h>
25#include <sound/core.h> 24#include <sound/core.h>
diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c
index f69a44728ebf..2803e227aec9 100644
--- a/sound/isa/gus/gus_mem_proc.c
+++ b/sound/isa/gus/gus_mem_proc.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/slab.h> 22#include <linux/slab.h>
24#include <sound/core.h> 23#include <sound/core.h>
25#include <sound/gus.h> 24#include <sound/gus.h>
diff --git a/sound/isa/gus/gus_mixer.c b/sound/isa/gus/gus_mixer.c
index a96253e16654..ebdb33469306 100644
--- a/sound/isa/gus/gus_mixer.c
+++ b/sound/isa/gus/gus_mixer.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/time.h> 22#include <linux/time.h>
24#include <linux/wait.h> 23#include <linux/wait.h>
25#include <sound/core.h> 24#include <sound/core.h>
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c
index a7971f5ffe63..99731dc97325 100644
--- a/sound/isa/gus/gus_pcm.c
+++ b/sound/isa/gus/gus_pcm.c
@@ -25,7 +25,6 @@
25 * 25 *
26 */ 26 */
27 27
28#include <sound/driver.h>
29#include <asm/dma.h> 28#include <asm/dma.h>
30#include <linux/slab.h> 29#include <linux/slab.h>
31#include <sound/core.h> 30#include <sound/core.h>
diff --git a/sound/isa/gus/gus_reset.c b/sound/isa/gus/gus_reset.c
index 20cfdb87f84a..3d1fed0c2620 100644
--- a/sound/isa/gus/gus_reset.c
+++ b/sound/isa/gus/gus_reset.c
@@ -18,7 +18,6 @@
18 * 18 *
19 */ 19 */
20 20
21#include <sound/driver.h>
22#include <linux/delay.h> 21#include <linux/delay.h>
23#include <linux/interrupt.h> 22#include <linux/interrupt.h>
24#include <linux/time.h> 23#include <linux/time.h>
diff --git a/sound/isa/gus/gus_sample.c b/sound/isa/gus/gus_sample.c
deleted file mode 100644
index cba0829a7106..000000000000
--- a/sound/isa/gus/gus_sample.c
+++ /dev/null
@@ -1,165 +0,0 @@
1/*
2 * Routines for Gravis UltraSound soundcards - Sample support
3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#include <sound/driver.h>
23#include <linux/time.h>
24#include <sound/core.h>
25#include <sound/gus.h>
26
27/*
28 *
29 */
30
31static void select_instrument(struct snd_gus_card * gus, struct snd_gus_voice * v)
32{
33 struct snd_seq_kinstr *instr;
34
35#if 0
36 printk("select instrument: cluster = %li, std = 0x%x, bank = %i, prg = %i\n",
37 v->instr.cluster,
38 v->instr.std,
39 v->instr.bank,
40 v->instr.prg);
41#endif
42 instr = snd_seq_instr_find(gus->gf1.ilist, &v->instr, 0, 1);
43 if (instr != NULL) {
44 if (instr->ops) {
45 if (!strcmp(instr->ops->instr_type, SNDRV_SEQ_INSTR_ID_SIMPLE))
46 snd_gf1_simple_init(v);
47 }
48 snd_seq_instr_free_use(gus->gf1.ilist, instr);
49 }
50}
51
52/*
53 *
54 */
55
56static void event_sample(struct snd_seq_event *ev, struct snd_gus_port *p,
57 struct snd_gus_voice *v)
58{
59 if (v->sample_ops && v->sample_ops->sample_stop)
60 v->sample_ops->sample_stop(p->gus, v, SAMPLE_STOP_IMMEDIATELY);
61 v->instr.std = ev->data.sample.param.sample.std;
62 if (v->instr.std & 0xff000000) { /* private instrument */
63 v->instr.std &= 0x00ffffff;
64 v->instr.std |= (unsigned int)ev->source.client << 24;
65 }
66 v->instr.bank = ev->data.sample.param.sample.bank;
67 v->instr.prg = ev->data.sample.param.sample.prg;
68 select_instrument(p->gus, v);
69}
70
71static void event_cluster(struct snd_seq_event *ev, struct snd_gus_port *p,
72 struct snd_gus_voice *v)
73{
74 if (v->sample_ops && v->sample_ops->sample_stop)
75 v->sample_ops->sample_stop(p->gus, v, SAMPLE_STOP_IMMEDIATELY);
76 v->instr.cluster = ev->data.sample.param.cluster.cluster;
77 select_instrument(p->gus, v);
78}
79
80static void event_start(struct snd_seq_event *ev, struct snd_gus_port *p,
81 struct snd_gus_voice *v)
82{
83 if (v->sample_ops && v->sample_ops->sample_start)
84 v->sample_ops->sample_start(p->gus, v, ev->data.sample.param.position);
85}
86
87static void event_stop(struct snd_seq_event *ev, struct snd_gus_port *p,
88 struct snd_gus_voice *v)
89{
90 if (v->sample_ops && v->sample_ops->sample_stop)
91 v->sample_ops->sample_stop(p->gus, v, ev->data.sample.param.stop_mode);
92}
93
94static void event_freq(struct snd_seq_event *ev, struct snd_gus_port *p,
95 struct snd_gus_voice *v)
96{
97 if (v->sample_ops && v->sample_ops->sample_freq)
98 v->sample_ops->sample_freq(p->gus, v, ev->data.sample.param.frequency);
99}
100
101static void event_volume(struct snd_seq_event *ev, struct snd_gus_port *p,
102 struct snd_gus_voice *v)
103{
104 if (v->sample_ops && v->sample_ops->sample_volume)
105 v->sample_ops->sample_volume(p->gus, v, &ev->data.sample.param.volume);
106}
107
108static void event_loop(struct snd_seq_event *ev, struct snd_gus_port *p,
109 struct snd_gus_voice *v)
110{
111 if (v->sample_ops && v->sample_ops->sample_loop)
112 v->sample_ops->sample_loop(p->gus, v, &ev->data.sample.param.loop);
113}
114
115static void event_position(struct snd_seq_event *ev, struct snd_gus_port *p,
116 struct snd_gus_voice *v)
117{
118 if (v->sample_ops && v->sample_ops->sample_pos)
119 v->sample_ops->sample_pos(p->gus, v, ev->data.sample.param.position);
120}
121
122static void event_private1(struct snd_seq_event *ev, struct snd_gus_port *p,
123 struct snd_gus_voice *v)
124{
125 if (v->sample_ops && v->sample_ops->sample_private1)
126 v->sample_ops->sample_private1(p->gus, v, (unsigned char *)&ev->data.sample.param.raw8);
127}
128
129typedef void (gus_sample_event_handler_t)(struct snd_seq_event *ev,
130 struct snd_gus_port *p,
131 struct snd_gus_voice *v);
132static gus_sample_event_handler_t *gus_sample_event_handlers[9] = {
133 event_sample,
134 event_cluster,
135 event_start,
136 event_stop,
137 event_freq,
138 event_volume,
139 event_loop,
140 event_position,
141 event_private1
142};
143
144void snd_gus_sample_event(struct snd_seq_event *ev, struct snd_gus_port *p)
145{
146 int idx, voice;
147 struct snd_gus_card *gus = p->gus;
148 struct snd_gus_voice *v;
149 unsigned long flags;
150
151 idx = ev->type - SNDRV_SEQ_EVENT_SAMPLE;
152 if (idx < 0 || idx > 8)
153 return;
154 for (voice = 0; voice < 32; voice++) {
155 v = &gus->gf1.voices[voice];
156 if (v->use && v->client == ev->source.client &&
157 v->port == ev->source.port &&
158 v->index == ev->data.sample.channel) {
159 spin_lock_irqsave(&gus->event_lock, flags);
160 gus_sample_event_handlers[idx](ev, p, v);
161 spin_unlock_irqrestore(&gus->event_lock, flags);
162 return;
163 }
164 }
165}
diff --git a/sound/isa/gus/gus_simple.c b/sound/isa/gus/gus_simple.c
deleted file mode 100644
index 39d121e2c8c4..000000000000
--- a/sound/isa/gus/gus_simple.c
+++ /dev/null
@@ -1,634 +0,0 @@
1/*
2 * Routines for Gravis UltraSound soundcards - Simple instrument handlers
3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#include <sound/driver.h>
23#include <linux/time.h>
24#include <sound/core.h>
25#include <sound/gus.h>
26#include "gus_tables.h"
27
28/*
29 *
30 */
31
32static void interrupt_wave(struct snd_gus_card *gus, struct snd_gus_voice *voice);
33static void interrupt_volume(struct snd_gus_card *gus, struct snd_gus_voice *voice);
34static void interrupt_effect(struct snd_gus_card *gus, struct snd_gus_voice *voice);
35
36static void sample_start(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position);
37static void sample_stop(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode);
38static void sample_freq(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq);
39static void sample_volume(struct snd_gus_card *card, struct snd_gus_voice *voice, struct snd_seq_ev_volume *volume);
40static void sample_loop(struct snd_gus_card *card, struct snd_gus_voice *voice, struct snd_seq_ev_loop *loop);
41static void sample_pos(struct snd_gus_card *card, struct snd_gus_voice *voice, snd_seq_position_t position);
42static void sample_private1(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data);
43
44static struct snd_gus_sample_ops sample_ops = {
45 sample_start,
46 sample_stop,
47 sample_freq,
48 sample_volume,
49 sample_loop,
50 sample_pos,
51 sample_private1
52};
53
54#if 0
55
56static void note_stop(struct snd_gus_card *gus, struct snd_gus_voice *voice, int wait);
57static void note_wait(struct snd_gus_card *gus, struct snd_gus_voice *voice);
58static void note_off(struct snd_gus_card *gus, struct snd_gus_voice *voice);
59static void note_volume(struct snd_gus_card *card, struct snd_gus_voice *voice);
60static void note_pitchbend(struct snd_gus_card *card, struct snd_gus_voice *voice);
61static void note_vibrato(struct snd_gus_card *card, struct snd_gus_voice *voice);
62static void note_tremolo(struct snd_gus_card *card, struct snd_gus_voice *voice);
63
64static struct snd_gus_note_handlers note_commands = {
65 note_stop,
66 note_wait,
67 note_off,
68 note_volume,
69 note_pitchbend,
70 note_vibrato,
71 note_tremolo
72};
73
74static void chn_trigger_down(struct snd_gus_card *card, ultra_channel_t *channel, ultra_instrument_t *instrument, unsigned char note, unsigned char velocity, unsigned char priority );
75static void chn_trigger_up( ultra_card_t *card, ultra_note_t *note );
76static void chn_control( ultra_card_t *card, ultra_channel_t *channel, unsigned short p1, unsigned short p2 );
77
78static struct ULTRA_STRU_INSTRUMENT_CHANNEL_COMMANDS channel_commands = {
79 chn_trigger_down,
80 chn_trigger_up,
81 chn_control
82};
83
84#endif
85
86static void do_volume_envelope(struct snd_gus_card *card, struct snd_gus_voice *voice);
87static void do_pan_envelope(struct snd_gus_card *card, struct snd_gus_voice *voice);
88
89/*
90 *
91 */
92
93static void interrupt_wave(struct snd_gus_card *gus, struct snd_gus_voice *voice)
94{
95 spin_lock(&gus->event_lock);
96 snd_gf1_stop_voice(gus, voice->number);
97 spin_lock(&gus->reg_lock);
98 snd_gf1_select_voice(gus, voice->number);
99 snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, 0);
100 spin_unlock(&gus->reg_lock);
101 voice->flags &= ~SNDRV_GF1_VFLG_RUNNING;
102 spin_unlock(&gus->event_lock);
103}
104
105static void interrupt_volume(struct snd_gus_card *gus, struct snd_gus_voice *voice)
106{
107 spin_lock(&gus->event_lock);
108 if (voice->flags & SNDRV_GF1_VFLG_RUNNING)
109 do_volume_envelope(gus, voice);
110 else
111 snd_gf1_stop_voice(gus, voice->number);
112 spin_unlock(&gus->event_lock);
113}
114
115static void interrupt_effect(struct snd_gus_card *gus, struct snd_gus_voice *voice)
116{
117 spin_lock(&gus->event_lock);
118 if ((voice->flags & (SNDRV_GF1_VFLG_RUNNING|SNDRV_GF1_VFLG_EFFECT_TIMER1)) ==
119 (SNDRV_GF1_VFLG_RUNNING|SNDRV_GF1_VFLG_EFFECT_TIMER1))
120 do_pan_envelope(gus, voice);
121 spin_unlock(&gus->event_lock);
122}
123
124/*
125 *
126 */
127
128static void do_volume_envelope(struct snd_gus_card *gus, struct snd_gus_voice *voice)
129{
130 unsigned short next, rate, old_volume;
131 int program_next_ramp;
132 unsigned long flags;
133
134 if (!gus->gf1.volume_ramp) {
135 spin_lock_irqsave(&gus->reg_lock, flags);
136 snd_gf1_select_voice(gus, voice->number);
137 snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL);
138 snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, voice->gf1_volume);
139 /* printk("gf1_volume = 0x%x\n", voice->gf1_volume); */
140 spin_unlock_irqrestore(&gus->reg_lock, flags);
141 return;
142 }
143 program_next_ramp = 0;
144 rate = next = 0;
145 while (1) {
146 program_next_ramp = 0;
147 rate = next = 0;
148 switch (voice->venv_state) {
149 case VENV_BEFORE:
150 voice->venv_state = VENV_ATTACK;
151 voice->venv_value_next = 0;
152 spin_lock_irqsave(&gus->reg_lock, flags);
153 snd_gf1_select_voice(gus, voice->number);
154 snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL);
155 snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, SNDRV_GF1_MIN_VOLUME);
156 spin_unlock_irqrestore(&gus->reg_lock, flags);
157 break;
158 case VENV_ATTACK:
159 voice->venv_state = VENV_SUSTAIN;
160 program_next_ramp++;
161 next = 255;
162 rate = gus->gf1.volume_ramp;
163 break;
164 case VENV_SUSTAIN:
165 voice->venv_state = VENV_RELEASE;
166 spin_lock_irqsave(&gus->reg_lock, flags);
167 snd_gf1_select_voice(gus, voice->number);
168 snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL);
169 snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, ((int)voice->gf1_volume * (int)voice->venv_value_next) / 255);
170 spin_unlock_irqrestore(&gus->reg_lock, flags);
171 return;
172 case VENV_RELEASE:
173 voice->venv_state = VENV_DONE;
174 program_next_ramp++;
175 next = 0;
176 rate = gus->gf1.volume_ramp;
177 break;
178 case VENV_DONE:
179 snd_gf1_stop_voice(gus, voice->number);
180 voice->flags &= ~SNDRV_GF1_VFLG_RUNNING;
181 return;
182 case VENV_VOLUME:
183 program_next_ramp++;
184 next = voice->venv_value_next;
185 rate = gus->gf1.volume_ramp;
186 voice->venv_state = voice->venv_state_prev;
187 break;
188 }
189 voice->venv_value_next = next;
190 if (!program_next_ramp)
191 continue;
192 spin_lock_irqsave(&gus->reg_lock, flags);
193 snd_gf1_select_voice(gus, voice->number);
194 snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL);
195 old_volume = snd_gf1_read16(gus, SNDRV_GF1_VW_VOLUME) >> 8;
196 if (!rate) {
197 spin_unlock_irqrestore(&gus->reg_lock, flags);
198 continue;
199 }
200 next = (((int)voice->gf1_volume * (int)next) / 255) >> 8;
201 if (old_volume < SNDRV_GF1_MIN_OFFSET)
202 old_volume = SNDRV_GF1_MIN_OFFSET;
203 if (next < SNDRV_GF1_MIN_OFFSET)
204 next = SNDRV_GF1_MIN_OFFSET;
205 if (next > SNDRV_GF1_MAX_OFFSET)
206 next = SNDRV_GF1_MAX_OFFSET;
207 if (old_volume == next) {
208 spin_unlock_irqrestore(&gus->reg_lock, flags);
209 continue;
210 }
211 voice->volume_control &= ~0xc3;
212 voice->volume_control |= 0x20;
213 if (old_volume > next) {
214 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_START, next);
215 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_END, old_volume);
216 voice->volume_control |= 0x40;
217 } else {
218 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_START, old_volume);
219 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_END, next);
220 }
221 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_RATE, rate);
222 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_CONTROL, voice->volume_control);
223 if (!gus->gf1.enh_mode) {
224 snd_gf1_delay(gus);
225 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_CONTROL, voice->volume_control);
226 }
227 spin_unlock_irqrestore(&gus->reg_lock, flags);
228 return;
229 }
230}
231
232static void do_pan_envelope(struct snd_gus_card *gus, struct snd_gus_voice *voice)
233{
234 unsigned long flags;
235 unsigned char old_pan;
236
237#if 0
238 snd_gf1_select_voice(gus, voice->number);
239 printk(" -%i- do_pan_envelope - flags = 0x%x (0x%x -> 0x%x)\n",
240 voice->number,
241 voice->flags,
242 voice->gf1_pan,
243 snd_gf1_i_read8(gus, SNDRV_GF1_VB_PAN) & 0x0f);
244#endif
245 if (gus->gf1.enh_mode) {
246 voice->flags &= ~(SNDRV_GF1_VFLG_EFFECT_TIMER1|SNDRV_GF1_VFLG_PAN);
247 return;
248 }
249 if (!gus->gf1.smooth_pan) {
250 spin_lock_irqsave(&gus->reg_lock, flags);
251 snd_gf1_select_voice(gus, voice->number);
252 snd_gf1_write8(gus, SNDRV_GF1_VB_PAN, voice->gf1_pan);
253 spin_unlock_irqrestore(&gus->reg_lock, flags);
254 return;
255 }
256 if (!(voice->flags & SNDRV_GF1_VFLG_PAN)) /* before */
257 voice->flags |= SNDRV_GF1_VFLG_EFFECT_TIMER1|SNDRV_GF1_VFLG_PAN;
258 spin_lock_irqsave(&gus->reg_lock, flags);
259 snd_gf1_select_voice(gus, voice->number);
260 old_pan = snd_gf1_read8(gus, SNDRV_GF1_VB_PAN) & 0x0f;
261 if (old_pan > voice->gf1_pan )
262 old_pan--;
263 if (old_pan < voice->gf1_pan)
264 old_pan++;
265 snd_gf1_write8(gus, SNDRV_GF1_VB_PAN, old_pan);
266 spin_unlock_irqrestore(&gus->reg_lock, flags);
267 if (old_pan == voice->gf1_pan) /* the goal was reached */
268 voice->flags &= ~(SNDRV_GF1_VFLG_EFFECT_TIMER1|SNDRV_GF1_VFLG_PAN);
269#if 0
270 snd_gf1_select_voice(gus, voice->number);
271 printk(" -%i- (1) do_pan_envelope - flags = 0x%x (0x%x -> 0x%x)\n",
272 voice->number,
273 voice->flags,
274 voice->gf1_pan,
275 snd_gf1_i_read8(gus, GF1_VB_PAN) & 0x0f);
276#endif
277}
278
279static void set_enhanced_pan(struct snd_gus_card *gus, struct snd_gus_voice *voice, unsigned short pan)
280{
281 unsigned long flags;
282 unsigned short vlo, vro;
283
284 vlo = SNDRV_GF1_ATTEN((SNDRV_GF1_ATTEN_TABLE_SIZE-1) - pan);
285 vro = SNDRV_GF1_ATTEN(pan);
286 if (pan != SNDRV_GF1_ATTEN_TABLE_SIZE - 1 && pan != 0) {
287 vlo >>= 1;
288 vro >>= 1;
289 }
290 vlo <<= 4;
291 vro <<= 4;
292#if 0
293 printk("vlo = 0x%x (0x%x), vro = 0x%x (0x%x)\n",
294 vlo, snd_gf1_i_read16(gus, GF1_VW_OFFSET_LEFT),
295 vro, snd_gf1_i_read16(gus, GF1_VW_OFFSET_RIGHT));
296#endif
297 spin_lock_irqsave(&gus->reg_lock, flags);
298 snd_gf1_select_voice(gus, voice->number);
299 snd_gf1_write16(gus, SNDRV_GF1_VW_OFFSET_LEFT_FINAL, vlo);
300 snd_gf1_write16(gus, SNDRV_GF1_VW_OFFSET_RIGHT_FINAL, vro);
301 spin_unlock_irqrestore(&gus->reg_lock, flags);
302 voice->vlo = vlo;
303 voice->vro = vro;
304}
305
306/*
307 *
308 */
309
310static void sample_start(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position)
311{
312 unsigned long flags;
313 unsigned int begin, addr, addr_end, addr_start;
314 int w_16;
315 struct simple_instrument *simple;
316 struct snd_seq_kinstr *instr;
317
318 instr = snd_seq_instr_find(gus->gf1.ilist, &voice->instr, 0, 1);
319 if (instr == NULL)
320 return;
321 voice->instr = instr->instr; /* copy ID to speedup aliases */
322 simple = KINSTR_DATA(instr);
323 begin = simple->address.memory << 4;
324 w_16 = simple->format & SIMPLE_WAVE_16BIT ? 0x04 : 0;
325 addr_start = simple->loop_start;
326 if (simple->format & SIMPLE_WAVE_LOOP) {
327 addr_end = simple->loop_end;
328 } else {
329 addr_end = (simple->size << 4) - (w_16 ? 40 : 24);
330 }
331 if (simple->format & SIMPLE_WAVE_BACKWARD) {
332 addr = simple->loop_end;
333 if (position < simple->loop_end)
334 addr -= position;
335 } else {
336 addr = position;
337 }
338 voice->control = 0x00;
339 voice->mode = 0x20; /* enable offset registers */
340 if (simple->format & SIMPLE_WAVE_16BIT)
341 voice->control |= 0x04;
342 if (simple->format & SIMPLE_WAVE_BACKWARD)
343 voice->control |= 0x40;
344 if (simple->format & SIMPLE_WAVE_LOOP) {
345 voice->control |= 0x08;
346 } else {
347 voice->control |= 0x20;
348 }
349 if (simple->format & SIMPLE_WAVE_BIDIR)
350 voice->control |= 0x10;
351 if (simple->format & SIMPLE_WAVE_ULAW)
352 voice->mode |= 0x40;
353 if (w_16) {
354 addr = ((addr << 1) & ~0x1f) | (addr & 0x0f);
355 addr_start = ((addr_start << 1) & ~0x1f) | (addr_start & 0x0f);
356 addr_end = ((addr_end << 1) & ~0x1f) | (addr_end & 0x0f);
357 }
358 addr += begin;
359 addr_start += begin;
360 addr_end += begin;
361 snd_gf1_stop_voice(gus, voice->number);
362 spin_lock_irqsave(&gus->reg_lock, flags);
363 snd_gf1_select_voice(gus, voice->number);
364 snd_gf1_write16(gus, SNDRV_GF1_VW_FREQUENCY, voice->fc_register + voice->fc_lfo);
365 voice->venv_state = VENV_BEFORE;
366 voice->volume_control = 0x03;
367 snd_gf1_write_addr(gus, SNDRV_GF1_VA_START, addr_start, w_16);
368 snd_gf1_write_addr(gus, SNDRV_GF1_VA_END, addr_end, w_16);
369 snd_gf1_write_addr(gus, SNDRV_GF1_VA_CURRENT, addr, w_16);
370 if (!gus->gf1.enh_mode) {
371 snd_gf1_write8(gus, SNDRV_GF1_VB_PAN, voice->gf1_pan);
372 } else {
373 snd_gf1_write16(gus, SNDRV_GF1_VW_OFFSET_LEFT, voice->vlo);
374 snd_gf1_write16(gus, SNDRV_GF1_VW_OFFSET_LEFT_FINAL, voice->vlo);
375 snd_gf1_write16(gus, SNDRV_GF1_VW_OFFSET_RIGHT, voice->vro);
376 snd_gf1_write16(gus, SNDRV_GF1_VW_OFFSET_RIGHT_FINAL, voice->vro);
377 snd_gf1_write8(gus, SNDRV_GF1_VB_ACCUMULATOR, voice->effect_accumulator);
378 snd_gf1_write16(gus, SNDRV_GF1_VW_EFFECT_VOLUME, voice->gf1_effect_volume);
379 snd_gf1_write16(gus, SNDRV_GF1_VW_EFFECT_VOLUME_FINAL, voice->gf1_effect_volume);
380 }
381 spin_unlock_irqrestore(&gus->reg_lock, flags);
382 do_volume_envelope(gus, voice);
383 spin_lock_irqsave(&gus->reg_lock, flags);
384 snd_gf1_select_voice(gus, voice->number);
385 if (gus->gf1.enh_mode)
386 snd_gf1_write8(gus, SNDRV_GF1_VB_MODE, voice->mode);
387 snd_gf1_write8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL, voice->control);
388 if (!gus->gf1.enh_mode) {
389 snd_gf1_delay(gus);
390 snd_gf1_write8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL, voice->control );
391 }
392 spin_unlock_irqrestore(&gus->reg_lock, flags);
393#if 0
394 snd_gf1_print_voice_registers(gus);
395#endif
396 voice->flags |= SNDRV_GF1_VFLG_RUNNING;
397 snd_seq_instr_free_use(gus->gf1.ilist, instr);
398}
399
400static void sample_stop(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode)
401{
402 unsigned char control;
403 unsigned long flags;
404
405 if (!(voice->flags & SNDRV_GF1_VFLG_RUNNING))
406 return;
407 switch (mode) {
408 default:
409 if (gus->gf1.volume_ramp > 0) {
410 if (voice->venv_state < VENV_RELEASE) {
411 voice->venv_state = VENV_RELEASE;
412 do_volume_envelope(gus, voice);
413 }
414 }
415 if (mode != SAMPLE_STOP_VENVELOPE) {
416 snd_gf1_stop_voice(gus, voice->number);
417 spin_lock_irqsave(&gus->reg_lock, flags);
418 snd_gf1_select_voice(gus, voice->number);
419 snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, SNDRV_GF1_MIN_VOLUME);
420 spin_unlock_irqrestore(&gus->reg_lock, flags);
421 voice->flags &= ~SNDRV_GF1_VFLG_RUNNING;
422 }
423 break;
424 case SAMPLE_STOP_LOOP: /* disable loop only */
425 spin_lock_irqsave(&gus->reg_lock, flags);
426 snd_gf1_select_voice(gus, voice->number);
427 control = snd_gf1_read8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL);
428 control &= ~(0x83 | 0x04);
429 control |= 0x20;
430 snd_gf1_write8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL, control);
431 spin_unlock_irqrestore(&gus->reg_lock, flags);
432 break;
433 }
434}
435
436static void sample_freq(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq)
437{
438 unsigned long flags;
439
440 spin_lock_irqsave(&gus->reg_lock, flags);
441 voice->fc_register = snd_gf1_translate_freq(gus, freq);
442 snd_gf1_select_voice(gus, voice->number);
443 snd_gf1_write16(gus, SNDRV_GF1_VW_FREQUENCY, voice->fc_register + voice->fc_lfo);
444 spin_unlock_irqrestore(&gus->reg_lock, flags);
445}
446
447static void sample_volume(struct snd_gus_card *gus, struct snd_gus_voice *voice, struct snd_seq_ev_volume *volume)
448{
449 if (volume->volume >= 0) {
450 volume->volume &= 0x3fff;
451 voice->gf1_volume = snd_gf1_lvol_to_gvol_raw(volume->volume << 2) << 4;
452 voice->venv_state_prev = VENV_SUSTAIN;
453 voice->venv_state = VENV_VOLUME;
454 do_volume_envelope(gus, voice);
455 }
456 if (volume->lr >= 0) {
457 volume->lr &= 0x3fff;
458 if (!gus->gf1.enh_mode) {
459 voice->gf1_pan = (volume->lr >> 10) & 15;
460 if (!gus->gf1.full_range_pan) {
461 if (voice->gf1_pan == 0)
462 voice->gf1_pan++;
463 if (voice->gf1_pan == 15)
464 voice->gf1_pan--;
465 }
466 voice->flags &= ~SNDRV_GF1_VFLG_PAN; /* before */
467 do_pan_envelope(gus, voice);
468 } else {
469 set_enhanced_pan(gus, voice, volume->lr >> 7);
470 }
471 }
472}
473
474static void sample_loop(struct snd_gus_card *gus, struct snd_gus_voice *voice, struct snd_seq_ev_loop *loop)
475{
476 unsigned long flags;
477 int w_16 = voice->control & 0x04;
478 unsigned int begin, addr_start, addr_end;
479 struct simple_instrument *simple;
480 struct snd_seq_kinstr *instr;
481
482#if 0
483 printk("voice_loop: start = 0x%x, end = 0x%x\n", loop->start, loop->end);
484#endif
485 instr = snd_seq_instr_find(gus->gf1.ilist, &voice->instr, 0, 1);
486 if (instr == NULL)
487 return;
488 voice->instr = instr->instr; /* copy ID to speedup aliases */
489 simple = KINSTR_DATA(instr);
490 begin = simple->address.memory;
491 addr_start = loop->start;
492 addr_end = loop->end;
493 addr_start = (((addr_start << 1) & ~0x1f) | (addr_start & 0x0f)) + begin;
494 addr_end = (((addr_end << 1) & ~0x1f) | (addr_end & 0x0f)) + begin;
495 spin_lock_irqsave(&gus->reg_lock, flags);
496 snd_gf1_select_voice(gus, voice->number);
497 snd_gf1_write_addr(gus, SNDRV_GF1_VA_START, addr_start, w_16);
498 snd_gf1_write_addr(gus, SNDRV_GF1_VA_END, addr_end, w_16);
499 spin_unlock_irqrestore(&gus->reg_lock, flags);
500 snd_seq_instr_free_use(gus->gf1.ilist, instr);
501}
502
503static void sample_pos(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position)
504{
505 unsigned long flags;
506 int w_16 = voice->control & 0x04;
507 unsigned int begin, addr;
508 struct simple_instrument *simple;
509 struct snd_seq_kinstr *instr;
510
511#if 0
512 printk("voice_loop: start = 0x%x, end = 0x%x\n", loop->start, loop->end);
513#endif
514 instr = snd_seq_instr_find(gus->gf1.ilist, &voice->instr, 0, 1);
515 if (instr == NULL)
516 return;
517 voice->instr = instr->instr; /* copy ID to speedup aliases */
518 simple = KINSTR_DATA(instr);
519 begin = simple->address.memory;
520 addr = (((position << 1) & ~0x1f) | (position & 0x0f)) + begin;
521 spin_lock_irqsave(&gus->reg_lock, flags);
522 snd_gf1_select_voice(gus, voice->number);
523 snd_gf1_write_addr(gus, SNDRV_GF1_VA_CURRENT, addr, w_16);
524 spin_unlock_irqrestore(&gus->reg_lock, flags);
525 snd_seq_instr_free_use(gus->gf1.ilist, instr);
526}
527
528#if 0
529
530static unsigned char get_effects_mask( ultra_card_t *card, int value )
531{
532 if ( value > 7 ) return 0;
533 if ( card -> gf1.effects && card -> gf1.effects -> chip_type == ULTRA_EFFECT_CHIP_INTERWAVE )
534 return card -> gf1.effects -> chip.interwave.voice_output[ value ];
535 return 0;
536}
537
538#endif
539
540static void sample_private1(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data)
541{
542#if 0
543 unsigned long flags;
544 unsigned char uc;
545
546 switch ( *data ) {
547 case ULTRA_PRIV1_IW_EFFECT:
548 uc = get_effects_mask( card, ultra_get_byte( data, 4 ) );
549 uc |= get_effects_mask( card, ultra_get_byte( data, 4 ) >> 4 );
550 uc |= get_effects_mask( card, ultra_get_byte( data, 5 ) );
551 uc |= get_effects_mask( card, ultra_get_byte( data, 5 ) >> 4 );
552 voice -> data.simple.effect_accumulator = uc;
553 voice -> data.simple.effect_volume = ultra_translate_voice_volume( card, ultra_get_word( data, 2 ) ) << 4;
554 if ( !card -> gf1.enh_mode ) return;
555 if ( voice -> flags & VFLG_WAIT_FOR_START ) return;
556 if ( voice -> flags & VFLG_RUNNING )
557 {
558 CLI( &flags );
559 gf1_select_voice( card, voice -> number );
560 ultra_write8( card, GF1_VB_ACCUMULATOR, voice -> data.simple.effect_accumulator );
561 ultra_write16( card, GF1_VW_EFFECT_VOLUME_FINAL, voice -> data.simple.effect_volume );
562 STI( &flags );
563 }
564 break;
565 case ULTRA_PRIV1_IW_LFO:
566 ultra_lfo_command( card, voice -> number, data );
567 }
568#endif
569}
570
571#if 0
572
573/*
574 *
575 */
576
577static void note_stop( ultra_card_t *card, ultra_voice_t *voice, int wait )
578{
579}
580
581static void note_wait( ultra_card_t *card, ultra_voice_t *voice )
582{
583}
584
585static void note_off( ultra_card_t *card, ultra_voice_t *voice )
586{
587}
588
589static void note_volume( ultra_card_t *card, ultra_voice_t *voice )
590{
591}
592
593static void note_pitchbend( ultra_card_t *card, ultra_voice_t *voice )
594{
595}
596
597static void note_vibrato( ultra_card_t *card, ultra_voice_t *voice )
598{
599}
600
601static void note_tremolo( ultra_card_t *card, ultra_voice_t *voice )
602{
603}
604
605/*
606 *
607 */
608
609static void chn_trigger_down( ultra_card_t *card, ultra_channel_t *channel, ultra_instrument_t *instrument, unsigned char note, unsigned char velocity, unsigned char priority )
610{
611}
612
613static void chn_trigger_up( ultra_card_t *card, ultra_note_t *note )
614{
615}
616
617static void chn_control( ultra_card_t *card, ultra_channel_t *channel, unsigned short p1, unsigned short p2 )
618{
619}
620
621/*
622 *
623 */
624
625#endif
626
627void snd_gf1_simple_init(struct snd_gus_voice *voice)
628{
629 voice->handler_wave = interrupt_wave;
630 voice->handler_volume = interrupt_volume;
631 voice->handler_effect = interrupt_effect;
632 voice->volume_change = NULL;
633 voice->sample_ops = &sample_ops;
634}
diff --git a/sound/isa/gus/gus_synth.c b/sound/isa/gus/gus_synth.c
deleted file mode 100644
index 2c2051782aa2..000000000000
--- a/sound/isa/gus/gus_synth.c
+++ /dev/null
@@ -1,314 +0,0 @@
1/*
2 * Routines for Gravis UltraSound soundcards - Synthesizer
3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#include <sound/driver.h>
23#include <linux/init.h>
24#include <linux/time.h>
25#include <sound/core.h>
26#include <sound/gus.h>
27#include <sound/seq_device.h>
28
29MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
30MODULE_DESCRIPTION("Routines for Gravis UltraSound soundcards - Synthesizer");
31MODULE_LICENSE("GPL");
32
33/*
34 *
35 */
36
37static void snd_gus_synth_free_voices(struct snd_gus_card * gus, int client, int port)
38{
39 int idx;
40 struct snd_gus_voice * voice;
41
42 for (idx = 0; idx < 32; idx++) {
43 voice = &gus->gf1.voices[idx];
44 if (voice->use && voice->client == client && voice->port == port)
45 snd_gf1_free_voice(gus, voice);
46 }
47}
48
49static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe *info)
50{
51 struct snd_gus_port * port = private_data;
52 struct snd_gus_card * gus = port->gus;
53 struct snd_gus_voice * voice;
54 unsigned int idx;
55
56 if (info->voices > 32)
57 return -EINVAL;
58 mutex_lock(&gus->register_mutex);
59 if (!snd_gus_use_inc(gus)) {
60 mutex_unlock(&gus->register_mutex);
61 return -EFAULT;
62 }
63 for (idx = 0; idx < info->voices; idx++) {
64 voice = snd_gf1_alloc_voice(gus, SNDRV_GF1_VOICE_TYPE_SYNTH, info->sender.client, info->sender.port);
65 if (voice == NULL) {
66 snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port);
67 snd_gus_use_dec(gus);
68 mutex_unlock(&gus->register_mutex);
69 return -EBUSY;
70 }
71 voice->index = idx;
72 }
73 mutex_unlock(&gus->register_mutex);
74 return 0;
75}
76
77static int snd_gus_synth_unuse(void *private_data, struct snd_seq_port_subscribe *info)
78{
79 struct snd_gus_port * port = private_data;
80 struct snd_gus_card * gus = port->gus;
81
82 mutex_lock(&gus->register_mutex);
83 snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port);
84 snd_gus_use_dec(gus);
85 mutex_unlock(&gus->register_mutex);
86 return 0;
87}
88
89/*
90 *
91 */
92
93static void snd_gus_synth_free_private_instruments(struct snd_gus_port *p, int client)
94{
95 struct snd_seq_instr_header ifree;
96
97 memset(&ifree, 0, sizeof(ifree));
98 ifree.cmd = SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE;
99 snd_seq_instr_list_free_cond(p->gus->gf1.ilist, &ifree, client, 0);
100}
101
102static int snd_gus_synth_event_input(struct snd_seq_event *ev, int direct,
103 void *private_data, int atomic, int hop)
104{
105 struct snd_gus_port * p = private_data;
106
107 snd_assert(p != NULL, return -EINVAL);
108 if (ev->type >= SNDRV_SEQ_EVENT_SAMPLE &&
109 ev->type <= SNDRV_SEQ_EVENT_SAMPLE_PRIVATE1) {
110 snd_gus_sample_event(ev, p);
111 return 0;
112 }
113 if (ev->source.client == SNDRV_SEQ_CLIENT_SYSTEM &&
114 ev->source.port == SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE) {
115 if (ev->type == SNDRV_SEQ_EVENT_CLIENT_EXIT) {
116 snd_gus_synth_free_private_instruments(p, ev->data.addr.client);
117 return 0;
118 }
119 }
120 if (direct) {
121 if (ev->type >= SNDRV_SEQ_EVENT_INSTR_BEGIN) {
122 snd_seq_instr_event(&p->gus->gf1.iwffff_ops.kops,
123 p->gus->gf1.ilist,
124 ev,
125 p->gus->gf1.seq_client,
126 atomic, hop);
127 return 0;
128 }
129 }
130 return 0;
131}
132
133static void snd_gus_synth_instr_notify(void *private_data,
134 struct snd_seq_kinstr *instr,
135 int what)
136{
137 unsigned int idx;
138 struct snd_gus_card *gus = private_data;
139 struct snd_gus_voice *pvoice;
140 unsigned long flags;
141
142 spin_lock_irqsave(&gus->event_lock, flags);
143 for (idx = 0; idx < 32; idx++) {
144 pvoice = &gus->gf1.voices[idx];
145 if (pvoice->use && !memcmp(&pvoice->instr, &instr->instr, sizeof(pvoice->instr))) {
146 if (pvoice->sample_ops && pvoice->sample_ops->sample_stop) {
147 pvoice->sample_ops->sample_stop(gus, pvoice, SAMPLE_STOP_IMMEDIATELY);
148 } else {
149 snd_gf1_stop_voice(gus, pvoice->number);
150 pvoice->flags &= ~SNDRV_GF1_VFLG_RUNNING;
151 }
152 }
153 }
154 spin_unlock_irqrestore(&gus->event_lock, flags);
155}
156
157/*
158 *
159 */
160
161static void snd_gus_synth_free_port(void *private_data)
162{
163 struct snd_gus_port * p = private_data;
164
165 if (p)
166 snd_midi_channel_free_set(p->chset);
167}
168
169static int snd_gus_synth_create_port(struct snd_gus_card * gus, int idx)
170{
171 struct snd_gus_port * p;
172 struct snd_seq_port_callback callbacks;
173 char name[32];
174 int result;
175
176 p = &gus->gf1.seq_ports[idx];
177 p->chset = snd_midi_channel_alloc_set(16);
178 if (p->chset == NULL)
179 return -ENOMEM;
180 p->chset->private_data = p;
181 p->gus = gus;
182 p->client = gus->gf1.seq_client;
183
184 memset(&callbacks, 0, sizeof(callbacks));
185 callbacks.owner = THIS_MODULE;
186 callbacks.use = snd_gus_synth_use;
187 callbacks.unuse = snd_gus_synth_unuse;
188 callbacks.event_input = snd_gus_synth_event_input;
189 callbacks.private_free = snd_gus_synth_free_port;
190 callbacks.private_data = p;
191
192 sprintf(name, "%s port %i", gus->interwave ? "AMD InterWave" : "GF1", idx);
193 p->chset->port = snd_seq_event_port_attach(gus->gf1.seq_client,
194 &callbacks,
195 SNDRV_SEQ_PORT_CAP_WRITE | SNDRV_SEQ_PORT_CAP_SUBS_WRITE,
196 SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE |
197 SNDRV_SEQ_PORT_TYPE_SYNTH |
198 SNDRV_SEQ_PORT_TYPE_HARDWARE |
199 SNDRV_SEQ_PORT_TYPE_SYNTHESIZER,
200 16, 0,
201 name);
202 if (p->chset->port < 0) {
203 result = p->chset->port;
204 snd_gus_synth_free_port(p);
205 return result;
206 }
207 p->port = p->chset->port;
208 return 0;
209}
210
211/*
212 *
213 */
214
215static int snd_gus_synth_new_device(struct snd_seq_device *dev)
216{
217 struct snd_gus_card *gus;
218 int client, i;
219 struct snd_seq_port_subscribe sub;
220 struct snd_iwffff_ops *iwops;
221 struct snd_gf1_ops *gf1ops;
222 struct snd_simple_ops *simpleops;
223
224 gus = *(struct snd_gus_card **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
225 if (gus == NULL)
226 return -EINVAL;
227
228 mutex_init(&gus->register_mutex);
229 gus->gf1.seq_client = -1;
230
231 /* allocate new client */
232 client = gus->gf1.seq_client =
233 snd_seq_create_kernel_client(gus->card, 1, gus->interwave ?
234 "AMD InterWave" : "GF1");
235 if (client < 0)
236 return client;
237
238 for (i = 0; i < 4; i++)
239 snd_gus_synth_create_port(gus, i);
240
241 gus->gf1.ilist = snd_seq_instr_list_new();
242 if (gus->gf1.ilist == NULL) {
243 snd_seq_delete_kernel_client(client);
244 gus->gf1.seq_client = -1;
245 return -ENOMEM;
246 }
247 gus->gf1.ilist->flags = SNDRV_SEQ_INSTR_FLG_DIRECT;
248
249 simpleops = &gus->gf1.simple_ops;
250 snd_seq_simple_init(simpleops, gus, NULL);
251 simpleops->put_sample = snd_gus_simple_put_sample;
252 simpleops->get_sample = snd_gus_simple_get_sample;
253 simpleops->remove_sample = snd_gus_simple_remove_sample;
254 simpleops->notify = snd_gus_synth_instr_notify;
255
256 gf1ops = &gus->gf1.gf1_ops;
257 snd_seq_gf1_init(gf1ops, gus, &simpleops->kops);
258 gf1ops->put_sample = snd_gus_gf1_put_sample;
259 gf1ops->get_sample = snd_gus_gf1_get_sample;
260 gf1ops->remove_sample = snd_gus_gf1_remove_sample;
261 gf1ops->notify = snd_gus_synth_instr_notify;
262
263 iwops = &gus->gf1.iwffff_ops;
264 snd_seq_iwffff_init(iwops, gus, &gf1ops->kops);
265 iwops->put_sample = snd_gus_iwffff_put_sample;
266 iwops->get_sample = snd_gus_iwffff_get_sample;
267 iwops->remove_sample = snd_gus_iwffff_remove_sample;
268 iwops->notify = snd_gus_synth_instr_notify;
269
270 memset(&sub, 0, sizeof(sub));
271 sub.sender.client = SNDRV_SEQ_CLIENT_SYSTEM;
272 sub.sender.port = SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE;
273 sub.dest.client = client;
274 sub.dest.port = 0;
275 snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, &sub);
276
277 return 0;
278}
279
280static int snd_gus_synth_delete_device(struct snd_seq_device *dev)
281{
282 struct snd_gus_card *gus;
283
284 gus = *(struct snd_gus_card **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
285 if (gus == NULL)
286 return -EINVAL;
287
288 if (gus->gf1.seq_client >= 0) {
289 snd_seq_delete_kernel_client(gus->gf1.seq_client);
290 gus->gf1.seq_client = -1;
291 }
292 if (gus->gf1.ilist)
293 snd_seq_instr_list_free(&gus->gf1.ilist);
294 return 0;
295}
296
297static int __init alsa_gus_synth_init(void)
298{
299 static struct snd_seq_dev_ops ops = {
300 snd_gus_synth_new_device,
301 snd_gus_synth_delete_device
302 };
303
304 return snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_GUS, &ops,
305 sizeof(struct snd_gus_card *));
306}
307
308static void __exit alsa_gus_synth_exit(void)
309{
310 snd_seq_device_unregister_driver(SNDRV_SEQ_DEV_ID_GUS);
311}
312
313module_init(alsa_gus_synth_init)
314module_exit(alsa_gus_synth_exit)
diff --git a/sound/isa/gus/gus_timer.c b/sound/isa/gus/gus_timer.c
index 99eac573c414..c53727147a1a 100644
--- a/sound/isa/gus/gus_timer.c
+++ b/sound/isa/gus/gus_timer.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include <sound/driver.h>
25#include <linux/time.h> 24#include <linux/time.h>
26#include <sound/core.h> 25#include <sound/core.h>
27#include <sound/gus.h> 26#include <sound/gus.h>
diff --git a/sound/isa/gus/gus_uart.c b/sound/isa/gus/gus_uart.c
index e6fd9b01c492..f0af3f79b08b 100644
--- a/sound/isa/gus/gus_uart.c
+++ b/sound/isa/gus/gus_uart.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/delay.h> 22#include <linux/delay.h>
24#include <linux/interrupt.h> 23#include <linux/interrupt.h>
25#include <linux/time.h> 24#include <linux/time.h>
diff --git a/sound/isa/gus/gus_volume.c b/sound/isa/gus/gus_volume.c
index 71a67744a14b..c3c028a4a46b 100644
--- a/sound/isa/gus/gus_volume.c
+++ b/sound/isa/gus/gus_volume.c
@@ -18,7 +18,6 @@
18 * 18 *
19 */ 19 */
20 20
21#include <sound/driver.h>
22#include <linux/time.h> 21#include <linux/time.h>
23#include <sound/core.h> 22#include <sound/core.h>
24#include <sound/gus.h> 23#include <sound/gus.h>
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c
index 29e422b00b58..8f914b37bf89 100644
--- a/sound/isa/gus/gusclassic.c
+++ b/sound/isa/gus/gusclassic.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/err.h> 23#include <linux/err.h>
25#include <linux/isa.h> 24#include <linux/isa.h>
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index fc59536c918e..da13185eb0a0 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/err.h> 23#include <linux/err.h>
25#include <linux/isa.h> 24#include <linux/isa.h>
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index 4922f5da08f9..f87c6236661c 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/err.h> 23#include <linux/err.h>
25#include <linux/isa.h> 24#include <linux/isa.h>
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 2091c50b2e3e..ca0d7ace0c75 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <sound/driver.h>
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/err.h> 26#include <linux/err.h>
28#include <linux/isa.h> 27#include <linux/isa.h>
@@ -560,50 +559,27 @@ static int __devinit snd_interwave_pnp(int dev, struct snd_interwave *iwcard,
560 const struct pnp_card_device_id *id) 559 const struct pnp_card_device_id *id)
561{ 560{
562 struct pnp_dev *pdev; 561 struct pnp_dev *pdev;
563 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
564 int err; 562 int err;
565 563
566 if (!cfg)
567 return -ENOMEM;
568 iwcard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 564 iwcard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
569 if (iwcard->dev == NULL) { 565 if (iwcard->dev == NULL)
570 kfree(cfg);
571 return -EBUSY; 566 return -EBUSY;
572 } 567
573#ifdef SNDRV_STB 568#ifdef SNDRV_STB
574 iwcard->devtc = pnp_request_card_device(card, id->devs[1].id, NULL); 569 iwcard->devtc = pnp_request_card_device(card, id->devs[1].id, NULL);
575 if (iwcard->devtc == NULL) { 570 if (iwcard->devtc == NULL)
576 kfree(cfg);
577 return -EBUSY; 571 return -EBUSY;
578 }
579#endif 572#endif
580 /* Synth & Codec initialization */ 573 /* Synth & Codec initialization */
581 pdev = iwcard->dev; 574 pdev = iwcard->dev;
582 pnp_init_resource_table(cfg); 575
583 if (port[dev] != SNDRV_AUTO_PORT) {
584 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
585 pnp_resource_change(&cfg->port_resource[1], port[dev] + 0x100, 12);
586 pnp_resource_change(&cfg->port_resource[2], port[dev] + 0x10c, 4);
587 }
588 if (dma1[dev] != SNDRV_AUTO_DMA)
589 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
590 if (dma2[dev] != SNDRV_AUTO_DMA)
591 pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
592 if (dma2[dev] < 0)
593 pnp_resource_change(&cfg->dma_resource[1], 4, 1);
594 if (irq[dev] != SNDRV_AUTO_IRQ)
595 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
596 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
597 snd_printk(KERN_ERR "InterWave - Synth - the requested resources are invalid, using auto config\n");
598 err = pnp_activate_dev(pdev); 576 err = pnp_activate_dev(pdev);
599 if (err < 0) { 577 if (err < 0) {
600 kfree(cfg);
601 snd_printk(KERN_ERR "InterWave PnP configure failure (out of resources?)\n"); 578 snd_printk(KERN_ERR "InterWave PnP configure failure (out of resources?)\n");
602 return err; 579 return err;
603 } 580 }
604 if (pnp_port_start(pdev, 0) + 0x100 != pnp_port_start(pdev, 1) || 581 if (pnp_port_start(pdev, 0) + 0x100 != pnp_port_start(pdev, 1) ||
605 pnp_port_start(pdev, 0) + 0x10c != pnp_port_start(pdev, 2)) { 582 pnp_port_start(pdev, 0) + 0x10c != pnp_port_start(pdev, 2)) {
606 kfree(cfg);
607 snd_printk(KERN_ERR "PnP configure failure (wrong ports)\n"); 583 snd_printk(KERN_ERR "PnP configure failure (wrong ports)\n");
608 return -ENOENT; 584 return -ENOENT;
609 } 585 }
@@ -620,21 +596,15 @@ static int __devinit snd_interwave_pnp(int dev, struct snd_interwave *iwcard,
620#ifdef SNDRV_STB 596#ifdef SNDRV_STB
621 /* Tone Control initialization */ 597 /* Tone Control initialization */
622 pdev = iwcard->devtc; 598 pdev = iwcard->devtc;
623 pnp_init_resource_table(cfg); 599
624 if (port_tc[dev] != SNDRV_AUTO_PORT)
625 pnp_resource_change(&cfg->port_resource[0], port_tc[dev], 1);
626 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
627 snd_printk(KERN_ERR "InterWave - ToneControl - the requested resources are invalid, using auto config\n");
628 err = pnp_activate_dev(pdev); 600 err = pnp_activate_dev(pdev);
629 if (err < 0) { 601 if (err < 0) {
630 kfree(cfg);
631 snd_printk(KERN_ERR "InterWave ToneControl PnP configure failure (out of resources?)\n"); 602 snd_printk(KERN_ERR "InterWave ToneControl PnP configure failure (out of resources?)\n");
632 return err; 603 return err;
633 } 604 }
634 port_tc[dev] = pnp_port_start(pdev, 0); 605 port_tc[dev] = pnp_port_start(pdev, 0);
635 snd_printdd("isapnp IW: tone control port=0x%lx\n", port_tc[dev]); 606 snd_printdd("isapnp IW: tone control port=0x%lx\n", port_tc[dev]);
636#endif 607#endif
637 kfree(cfg);
638 return 0; 608 return 0;
639} 609}
640#endif /* CONFIG_PNP */ 610#endif /* CONFIG_PNP */
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 59af9ab7191f..854a9f74b466 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/err.h> 23#include <linux/err.h>
25#include <linux/isa.h> 24#include <linux/isa.h>
@@ -610,39 +609,8 @@ static int snd_opl3sa2_resume(struct snd_card *card)
610static int __devinit snd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip, 609static int __devinit snd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip,
611 struct pnp_dev *pdev) 610 struct pnp_dev *pdev)
612{ 611{
613 struct pnp_resource_table * cfg; 612 if (pnp_activate_dev(pdev) < 0) {
614 int err; 613 snd_printk(KERN_ERR "PnP configure failure (out of resources?)\n");
615
616 cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
617 if (!cfg) {
618 snd_printk(KERN_ERR PFX "cannot allocate pnp cfg\n");
619 return -ENOMEM;
620 }
621 /* PnP initialization */
622 pnp_init_resource_table(cfg);
623 if (sb_port[dev] != SNDRV_AUTO_PORT)
624 pnp_resource_change(&cfg->port_resource[0], sb_port[dev], 16);
625 if (wss_port[dev] != SNDRV_AUTO_PORT)
626 pnp_resource_change(&cfg->port_resource[1], wss_port[dev], 8);
627 if (fm_port[dev] != SNDRV_AUTO_PORT)
628 pnp_resource_change(&cfg->port_resource[2], fm_port[dev], 4);
629 if (midi_port[dev] != SNDRV_AUTO_PORT)
630 pnp_resource_change(&cfg->port_resource[3], midi_port[dev], 2);
631 if (port[dev] != SNDRV_AUTO_PORT)
632 pnp_resource_change(&cfg->port_resource[4], port[dev], 2);
633 if (dma1[dev] != SNDRV_AUTO_DMA)
634 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
635 if (dma2[dev] != SNDRV_AUTO_DMA)
636 pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
637 if (irq[dev] != SNDRV_AUTO_IRQ)
638 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
639 err = pnp_manual_config_dev(pdev, cfg, 0);
640 if (err < 0)
641 snd_printk(KERN_WARNING "PnP manual resources are invalid, using auto config\n");
642 err = pnp_activate_dev(pdev);
643 if (err < 0) {
644 kfree(cfg);
645 snd_printk(KERN_ERR "PnP configure failure (out of resources?) err = %d\n", err);
646 return -EBUSY; 614 return -EBUSY;
647 } 615 }
648 sb_port[dev] = pnp_port_start(pdev, 0); 616 sb_port[dev] = pnp_port_start(pdev, 0);
@@ -657,7 +625,6 @@ static int __devinit snd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip,
657 pnp_device_is_pnpbios(pdev) ? "BIOS" : "ISA", sb_port[dev], wss_port[dev], fm_port[dev], midi_port[dev]); 625 pnp_device_is_pnpbios(pdev) ? "BIOS" : "ISA", sb_port[dev], wss_port[dev], fm_port[dev], midi_port[dev]);
658 snd_printdd("%sPnP OPL3-SA: control port=0x%lx, dma1=%i, dma2=%i, irq=%i\n", 626 snd_printdd("%sPnP OPL3-SA: control port=0x%lx, dma1=%i, dma2=%i, irq=%i\n",
659 pnp_device_is_pnpbios(pdev) ? "BIOS" : "ISA", port[dev], dma1[dev], dma2[dev], irq[dev]); 627 pnp_device_is_pnpbios(pdev) ? "BIOS" : "ISA", port[dev], dma1[dev], dma2[dev], irq[dev]);
660 kfree(cfg);
661 return 0; 628 return 0;
662} 629}
663#endif /* CONFIG_PNP */ 630#endif /* CONFIG_PNP */
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
index d295936611f8..2a1e2f5d12c2 100644
--- a/sound/isa/opti9xx/miro.c
+++ b/sound/isa/opti9xx/miro.c
@@ -22,7 +22,6 @@
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 23 */
24 24
25#include <sound/driver.h>
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/err.h> 26#include <linux/err.h>
28#include <linux/isa.h> 27#include <linux/isa.h>
@@ -483,6 +482,10 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol,
483 482
484 /* equalizer elements */ 483 /* equalizer elements */
485 484
485 if (left < -0x7f || left > 0x7f ||
486 right < -0x7f || right > 0x7f)
487 return -EINVAL;
488
486 if (left_old > 0x80) 489 if (left_old > 0x80)
487 left_old = 0x80 - left_old; 490 left_old = 0x80 - left_old;
488 if (right_old > 0x80) 491 if (right_old > 0x80)
@@ -520,6 +523,10 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol,
520 523
521 /* non-equalizer elements */ 524 /* non-equalizer elements */
522 525
526 if (left < 0 || left > 0x20 ||
527 right < 0 || right > 0x20)
528 return -EINVAL;
529
523 left_old = 0x20 - left_old; 530 left_old = 0x20 - left_old;
524 right_old = 0x20 - right_old; 531 right_old = 0x20 - right_old;
525 532
@@ -662,7 +669,7 @@ static int __devinit snd_set_aci_init_values(struct snd_miro *miro)
662 return 0; 669 return 0;
663} 670}
664 671
665static int snd_miro_mixer(struct snd_miro *miro) 672static int __devinit snd_miro_mixer(struct snd_miro *miro)
666{ 673{
667 struct snd_card *card; 674 struct snd_card *card;
668 unsigned int idx; 675 unsigned int idx;
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index ee1a824d8fc0..fe1afc13a01d 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -23,7 +23,6 @@
23*/ 23*/
24 24
25 25
26#include <sound/driver.h>
27#include <linux/init.h> 26#include <linux/init.h>
28#include <linux/err.h> 27#include <linux/err.h>
29#include <linux/isa.h> 28#include <linux/isa.h>
@@ -1595,7 +1594,7 @@ OPTi93X_DOUBLE("Capture Volume", 0, OPTi93X_MIXOUT_LEFT, OPTi93X_MIXOUT_RIGHT, 0
1595} 1594}
1596}; 1595};
1597 1596
1598static int snd_opti93x_mixer(struct snd_opti93x *chip) 1597static int __devinit snd_opti93x_mixer(struct snd_opti93x *chip)
1599{ 1598{
1600 struct snd_card *card; 1599 struct snd_card *card;
1601 struct snd_kcontrol_new knew; 1600 struct snd_kcontrol_new knew;
@@ -1690,53 +1689,19 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
1690 const struct pnp_card_device_id *pid) 1689 const struct pnp_card_device_id *pid)
1691{ 1690{
1692 struct pnp_dev *pdev; 1691 struct pnp_dev *pdev;
1693 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
1694 int err; 1692 int err;
1695 1693
1696 if (!cfg)
1697 return -ENOMEM;
1698 chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); 1694 chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL);
1699 if (chip->dev == NULL) { 1695 if (chip->dev == NULL)
1700 kfree(cfg);
1701 return -EBUSY; 1696 return -EBUSY;
1702 } 1697
1703 chip->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); 1698 chip->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL);
1704 1699
1705 pdev = chip->dev; 1700 pdev = chip->dev;
1706 pnp_init_resource_table(cfg);
1707 1701
1708#ifdef OPTi93X
1709 if (port != SNDRV_AUTO_PORT)
1710 pnp_resource_change(&cfg->port_resource[0], port + 4, 4);
1711#else
1712 if (pid->driver_data != 0x0924 && port != SNDRV_AUTO_PORT)
1713 pnp_resource_change(&cfg->port_resource[1], port, 4);
1714#endif /* OPTi93X */
1715 if (irq != SNDRV_AUTO_IRQ)
1716 pnp_resource_change(&cfg->irq_resource[0], irq, 1);
1717 if (dma1 != SNDRV_AUTO_DMA)
1718 pnp_resource_change(&cfg->dma_resource[0], dma1, 1);
1719#if defined(CS4231) || defined(OPTi93X)
1720 if (dma2 != SNDRV_AUTO_DMA)
1721 pnp_resource_change(&cfg->dma_resource[1], dma2, 1);
1722#else
1723#ifdef snd_opti9xx_fixup_dma2
1724 snd_opti9xx_fixup_dma2(pdev);
1725#endif
1726#endif /* CS4231 || OPTi93X */
1727#ifdef OPTi93X
1728 if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT)
1729 pnp_resource_change(&cfg->port_resource[1], fm_port, 4);
1730#else
1731 if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT)
1732 pnp_resource_change(&cfg->port_resource[2], fm_port, 4);
1733#endif
1734 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
1735 snd_printk(KERN_ERR "AUDIO the requested resources are invalid, using auto config\n");
1736 err = pnp_activate_dev(pdev); 1702 err = pnp_activate_dev(pdev);
1737 if (err < 0) { 1703 if (err < 0) {
1738 snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); 1704 snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err);
1739 kfree(cfg);
1740 return err; 1705 return err;
1741 } 1706 }
1742 1707
@@ -1756,15 +1721,6 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
1756 1721
1757 pdev = chip->devmpu; 1722 pdev = chip->devmpu;
1758 if (pdev && mpu_port > 0) { 1723 if (pdev && mpu_port > 0) {
1759 pnp_init_resource_table(cfg);
1760
1761 if (mpu_port != SNDRV_AUTO_PORT)
1762 pnp_resource_change(&cfg->port_resource[0], mpu_port, 2);
1763 if (mpu_irq != SNDRV_AUTO_IRQ)
1764 pnp_resource_change(&cfg->irq_resource[0], mpu_irq, 1);
1765
1766 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
1767 snd_printk(KERN_ERR "AUDIO the requested resources are invalid, using auto config\n");
1768 err = pnp_activate_dev(pdev); 1724 err = pnp_activate_dev(pdev);
1769 if (err < 0) { 1725 if (err < 0) {
1770 snd_printk(KERN_ERR "AUDIO pnp configure failure\n"); 1726 snd_printk(KERN_ERR "AUDIO pnp configure failure\n");
@@ -1775,7 +1731,6 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
1775 mpu_irq = pnp_irq(pdev, 0); 1731 mpu_irq = pnp_irq(pdev, 0);
1776 } 1732 }
1777 } 1733 }
1778 kfree(cfg);
1779 return pid->driver_data; 1734 return pid->driver_data;
1780} 1735}
1781#endif /* CONFIG_PNP */ 1736#endif /* CONFIG_PNP */
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 4eea84cfd4f4..b35be7d9a9fa 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -20,7 +20,6 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23#include <sound/driver.h>
24#include <linux/wait.h> 23#include <linux/wait.h>
25#include <linux/sched.h> 24#include <linux/sched.h>
26#include <linux/slab.h> 25#include <linux/slab.h>
diff --git a/sound/isa/sb/emu8000_local.h b/sound/isa/sb/emu8000_local.h
index 2ac77f10bb4e..7e87c349272f 100644
--- a/sound/isa/sb/emu8000_local.h
+++ b/sound/isa/sb/emu8000_local.h
@@ -21,7 +21,6 @@
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 22 */
23 23
24#include <sound/driver.h>
25#include <linux/wait.h> 24#include <linux/wait.h>
26#include <linux/sched.h> 25#include <linux/sched.h>
27#include <linux/slab.h> 26#include <linux/slab.h>
diff --git a/sound/isa/sb/es968.c b/sound/isa/sb/es968.c
index d4b218726ce7..c8c8e214c843 100644
--- a/sound/isa/sb/es968.c
+++ b/sound/isa/sb/es968.c
@@ -20,7 +20,6 @@
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/ 21*/
22 22
23#include <sound/driver.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/time.h> 24#include <linux/time.h>
26#include <linux/pnp.h> 25#include <linux/pnp.h>
@@ -49,12 +48,6 @@ module_param_array(id, charp, NULL, 0444);
49MODULE_PARM_DESC(id, "ID string for es968 based soundcard."); 48MODULE_PARM_DESC(id, "ID string for es968 based soundcard.");
50module_param_array(enable, bool, NULL, 0444); 49module_param_array(enable, bool, NULL, 0444);
51MODULE_PARM_DESC(enable, "Enable es968 based soundcard."); 50MODULE_PARM_DESC(enable, "Enable es968 based soundcard.");
52module_param_array(port, long, NULL, 0444);
53MODULE_PARM_DESC(port, "Port # for es968 driver.");
54module_param_array(irq, int, NULL, 0444);
55MODULE_PARM_DESC(irq, "IRQ # for es968 driver.");
56module_param_array(dma8, int, NULL, 0444);
57MODULE_PARM_DESC(dma8, "8-bit DMA # for es968 driver.");
58 51
59struct snd_card_es968 { 52struct snd_card_es968 {
60 struct pnp_dev *dev; 53 struct pnp_dev *dev;
@@ -86,40 +79,23 @@ static int __devinit snd_card_es968_pnp(int dev, struct snd_card_es968 *acard,
86 const struct pnp_card_device_id *id) 79 const struct pnp_card_device_id *id)
87{ 80{
88 struct pnp_dev *pdev; 81 struct pnp_dev *pdev;
89 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
90 int err; 82 int err;
91 if (!cfg) 83
92 return -ENOMEM;
93 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 84 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
94 if (acard->dev == NULL) { 85 if (acard->dev == NULL)
95 kfree(cfg);
96 return -ENODEV; 86 return -ENODEV;
97 }
98 87
99 pdev = acard->dev; 88 pdev = acard->dev;
100 89
101 pnp_init_resource_table(cfg);
102
103 /* override resources */
104 if (port[dev] != SNDRV_AUTO_PORT)
105 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
106 if (dma8[dev] != SNDRV_AUTO_DMA)
107 pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 1);
108 if (irq[dev] != SNDRV_AUTO_IRQ)
109 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
110 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
111 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
112 err = pnp_activate_dev(pdev); 90 err = pnp_activate_dev(pdev);
113 if (err < 0) { 91 if (err < 0) {
114 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n"); 92 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n");
115 kfree(cfg);
116 return err; 93 return err;
117 } 94 }
118 port[dev] = pnp_port_start(pdev, 0); 95 port[dev] = pnp_port_start(pdev, 0);
119 dma8[dev] = pnp_dma(pdev, 1); 96 dma8[dev] = pnp_dma(pdev, 1);
120 irq[dev] = pnp_irq(pdev, 0); 97 irq[dev] = pnp_irq(pdev, 0);
121 98
122 kfree(cfg);
123 return 0; 99 return 0;
124} 100}
125 101
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index e7f9edd92626..2c201f78ce50 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <asm/dma.h> 22#include <asm/dma.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/slab.h> 24#include <linux/slab.h>
@@ -257,44 +256,21 @@ static int __devinit snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard,
257 const struct pnp_card_device_id *id) 256 const struct pnp_card_device_id *id)
258{ 257{
259 struct pnp_dev *pdev; 258 struct pnp_dev *pdev;
260 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
261 int err; 259 int err;
262 260
263 if (!cfg)
264 return -ENOMEM;
265 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 261 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
266 if (acard->dev == NULL) { 262 if (acard->dev == NULL)
267 kfree(cfg);
268 return -ENODEV; 263 return -ENODEV;
269 } 264
270#ifdef SNDRV_SBAWE_EMU8000 265#ifdef SNDRV_SBAWE_EMU8000
271 acard->devwt = pnp_request_card_device(card, id->devs[1].id, acard->dev); 266 acard->devwt = pnp_request_card_device(card, id->devs[1].id, acard->dev);
272#endif 267#endif
273 /* Audio initialization */ 268 /* Audio initialization */
274 pdev = acard->dev; 269 pdev = acard->dev;
275 270
276 pnp_init_resource_table(cfg);
277
278 /* override resources */
279
280 if (port[dev] != SNDRV_AUTO_PORT)
281 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
282 if (mpu_port[dev] != SNDRV_AUTO_PORT)
283 pnp_resource_change(&cfg->port_resource[1], mpu_port[dev], 2);
284 if (fm_port[dev] != SNDRV_AUTO_PORT)
285 pnp_resource_change(&cfg->port_resource[2], fm_port[dev], 4);
286 if (dma8[dev] != SNDRV_AUTO_DMA)
287 pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 1);
288 if (dma16[dev] != SNDRV_AUTO_DMA)
289 pnp_resource_change(&cfg->dma_resource[1], dma16[dev], 1);
290 if (irq[dev] != SNDRV_AUTO_IRQ)
291 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
292 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
293 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
294 err = pnp_activate_dev(pdev); 271 err = pnp_activate_dev(pdev);
295 if (err < 0) { 272 if (err < 0) {
296 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n"); 273 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n");
297 kfree(cfg);
298 return err; 274 return err;
299 } 275 }
300 port[dev] = pnp_port_start(pdev, 0); 276 port[dev] = pnp_port_start(pdev, 0);
@@ -311,17 +287,6 @@ static int __devinit snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard,
311 /* WaveTable initialization */ 287 /* WaveTable initialization */
312 pdev = acard->devwt; 288 pdev = acard->devwt;
313 if (pdev != NULL) { 289 if (pdev != NULL) {
314 pnp_init_resource_table(cfg);
315
316 /* override resources */
317
318 if (awe_port[dev] != SNDRV_AUTO_PORT) {
319 pnp_resource_change(&cfg->port_resource[0], awe_port[dev], 4);
320 pnp_resource_change(&cfg->port_resource[1], awe_port[dev] + 0x400, 4);
321 pnp_resource_change(&cfg->port_resource[2], awe_port[dev] + 0x800, 4);
322 }
323 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
324 snd_printk(KERN_ERR PFX "WaveTable the requested resources are invalid, using auto config\n");
325 err = pnp_activate_dev(pdev); 290 err = pnp_activate_dev(pdev);
326 if (err < 0) { 291 if (err < 0) {
327 goto __wt_error; 292 goto __wt_error;
@@ -339,7 +304,6 @@ __wt_error:
339 awe_port[dev] = -1; 304 awe_port[dev] = -1;
340 } 305 }
341#endif 306#endif
342 kfree(cfg);
343 return 0; 307 return 0;
344} 308}
345 309
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
index 3682059787ab..bed29ca22239 100644
--- a/sound/isa/sb/sb16_csp.c
+++ b/sound/isa/sb/sb16_csp.c
@@ -23,7 +23,6 @@
23 * 23 *
24 */ 24 */
25 25
26#include <sound/driver.h>
27#include <linux/delay.h> 26#include <linux/delay.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/slab.h> 28#include <linux/slab.h>
@@ -118,7 +117,8 @@ static void info_read(struct snd_info_entry *entry, struct snd_info_buffer *buff
118int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep) 117int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep)
119{ 118{
120 struct snd_sb_csp *p; 119 struct snd_sb_csp *p;
121 int version, err; 120 int uninitialized_var(version);
121 int err;
122 struct snd_hwdep *hw; 122 struct snd_hwdep *hw;
123 123
124 if (rhwdep) 124 if (rhwdep)
diff --git a/sound/isa/sb/sb16_main.c b/sound/isa/sb/sb16_main.c
index c06754f7ee5d..f7e8192270ae 100644
--- a/sound/isa/sb/sb16_main.c
+++ b/sound/isa/sb/sb16_main.c
@@ -33,7 +33,6 @@
33 * 33 *
34 */ 34 */
35 35
36#include <sound/driver.h>
37#include <asm/io.h> 36#include <asm/io.h>
38#include <asm/dma.h> 37#include <asm/dma.h>
39#include <linux/init.h> 38#include <linux/init.h>
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index f933aef7d8a9..336a34277907 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/err.h> 23#include <linux/err.h>
25#include <linux/isa.h> 24#include <linux/isa.h>
diff --git a/sound/isa/sb/sb8_main.c b/sound/isa/sb/sb8_main.c
index bee894b3f5c7..6304c3a89ba0 100644
--- a/sound/isa/sb/sb8_main.c
+++ b/sound/isa/sb/sb8_main.c
@@ -30,7 +30,6 @@
30 * Cleaned up and rewrote lowlevel routines. 30 * Cleaned up and rewrote lowlevel routines.
31 */ 31 */
32 32
33#include <sound/driver.h>
34#include <asm/io.h> 33#include <asm/io.h>
35#include <asm/dma.h> 34#include <asm/dma.h>
36#include <linux/init.h> 35#include <linux/init.h>
diff --git a/sound/isa/sb/sb8_midi.c b/sound/isa/sb/sb8_midi.c
index e56e5633411c..988a8b73475f 100644
--- a/sound/isa/sb/sb8_midi.c
+++ b/sound/isa/sb/sb8_midi.c
@@ -26,7 +26,6 @@
26 * Added full duplex UART mode for DSP version 2.0 and later. 26 * Added full duplex UART mode for DSP version 2.0 and later.
27 */ 27 */
28 28
29#include <sound/driver.h>
30#include <asm/io.h> 29#include <asm/io.h>
31#include <linux/time.h> 30#include <linux/time.h>
32#include <sound/core.h> 31#include <sound/core.h>
diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c
index 176193c05101..d63c1af550de 100644
--- a/sound/isa/sb/sb_common.c
+++ b/sound/isa/sb/sb_common.c
@@ -20,7 +20,6 @@
20 * 20 *
21 */ 21 */
22 22
23#include <sound/driver.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c
index 03241cd5aaef..91d14224f6b3 100644
--- a/sound/isa/sb/sb_mixer.c
+++ b/sound/isa/sb/sb_mixer.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <asm/io.h> 22#include <asm/io.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <linux/time.h> 24#include <linux/time.h>
diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c
index 94daf8399994..da3d152bcad4 100644
--- a/sound/isa/sc6000.c
+++ b/sound/isa/sc6000.c
@@ -23,7 +23,6 @@
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */ 24 */
25 25
26#include <sound/driver.h>
27#include <linux/module.h> 26#include <linux/module.h>
28#include <linux/delay.h> 27#include <linux/delay.h>
29#include <linux/isa.h> 28#include <linux/isa.h>
@@ -390,7 +389,7 @@ static int __devinit sc6000_init_board(char __iomem *vport, int irq, int dma,
390 389
391 err = sc6000_init_mss(vport, config, vmss_port, mss_config); 390 err = sc6000_init_mss(vport, config, vmss_port, mss_config);
392 if (err < 0) { 391 if (err < 0) {
393 snd_printk(KERN_ERR "Can not initialize" 392 snd_printk(KERN_ERR "Can not initialize "
394 "Microsoft Sound System mode.\n"); 393 "Microsoft Sound System mode.\n");
395 return -ENODEV; 394 return -ENODEV;
396 } 395 }
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c
index 922519def099..a07274ecb149 100644
--- a/sound/isa/sgalaxy.c
+++ b/sound/isa/sgalaxy.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include <sound/driver.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/err.h> 25#include <linux/err.h>
27#include <linux/isa.h> 26#include <linux/isa.h>
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 1cb921d6137e..06ad7863dff5 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -21,7 +21,6 @@
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 22 */
23 23
24#include <sound/driver.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/err.h> 25#include <linux/err.h>
27#include <linux/isa.h> 26#include <linux/isa.h>
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 83c2fc4cfc64..3a6c6fe1ec4d 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -19,7 +19,6 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/interrupt.h> 23#include <linux/interrupt.h>
25#include <linux/slab.h> 24#include <linux/slab.h>
@@ -104,21 +103,15 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
104 const struct pnp_card_device_id *id) 103 const struct pnp_card_device_id *id)
105{ 104{
106 struct pnp_dev *pdev; 105 struct pnp_dev *pdev;
107 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
108 int err; 106 int err;
109 107
110 if (!cfg)
111 return -ENOMEM;
112
113 /* Check for each logical device. */ 108 /* Check for each logical device. */
114 109
115 /* CS4232 chip (aka "windows sound system") is logical device 0 */ 110 /* CS4232 chip (aka "windows sound system") is logical device 0 */
116 111
117 acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL); 112 acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL);
118 if (acard->wss == NULL) { 113 if (acard->wss == NULL)
119 kfree(cfg);
120 return -EBUSY; 114 return -EBUSY;
121 }
122 115
123 /* there is a game port at logical device 1, but we ignore it completely */ 116 /* there is a game port at logical device 1, but we ignore it completely */
124 117
@@ -133,26 +126,20 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
133 126
134 if (use_cs4232_midi[dev]) { 127 if (use_cs4232_midi[dev]) {
135 acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL); 128 acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL);
136 if (acard->mpu == NULL) { 129 if (acard->mpu == NULL)
137 kfree(cfg);
138 return -EBUSY; 130 return -EBUSY;
139 }
140 } 131 }
141 132
142 /* The ICS2115 synth is logical device 4 */ 133 /* The ICS2115 synth is logical device 4 */
143 134
144 acard->synth = pnp_request_card_device(card, id->devs[3].id, NULL); 135 acard->synth = pnp_request_card_device(card, id->devs[3].id, NULL);
145 if (acard->synth == NULL) { 136 if (acard->synth == NULL)
146 kfree(cfg);
147 return -EBUSY; 137 return -EBUSY;
148 }
149 138
150 /* PCM/FM initialization */ 139 /* PCM/FM initialization */
151 140
152 pdev = acard->wss; 141 pdev = acard->wss;
153 142
154 pnp_init_resource_table(cfg);
155
156 /* An interesting note from the Tropez+ FAQ: 143 /* An interesting note from the Tropez+ FAQ:
157 144
158 Q. [Ports] Why is the base address of the WSS I/O ports off by 4? 145 Q. [Ports] Why is the base address of the WSS I/O ports off by 4?
@@ -165,23 +152,9 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
165 152
166 */ 153 */
167 154
168 if (cs4232_pcm_port[dev] != SNDRV_AUTO_PORT)
169 pnp_resource_change(&cfg->port_resource[0], cs4232_pcm_port[dev], 4);
170 if (fm_port[dev] != SNDRV_AUTO_PORT)
171 pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
172 if (dma1[dev] != SNDRV_AUTO_DMA)
173 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
174 if (dma2[dev] != SNDRV_AUTO_DMA)
175 pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
176 if (cs4232_pcm_irq[dev] != SNDRV_AUTO_IRQ)
177 pnp_resource_change(&cfg->irq_resource[0], cs4232_pcm_irq[dev], 1);
178
179 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
180 snd_printk(KERN_ERR "PnP WSS the requested resources are invalid, using auto config\n");
181 err = pnp_activate_dev(pdev); 155 err = pnp_activate_dev(pdev);
182 if (err < 0) { 156 if (err < 0) {
183 snd_printk(KERN_ERR "PnP WSS pnp configure failure\n"); 157 snd_printk(KERN_ERR "PnP WSS pnp configure failure\n");
184 kfree(cfg);
185 return err; 158 return err;
186 } 159 }
187 160
@@ -195,22 +168,9 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
195 168
196 pdev = acard->synth; 169 pdev = acard->synth;
197 170
198 pnp_init_resource_table(cfg);
199
200 if (ics2115_port[dev] != SNDRV_AUTO_PORT) {
201 pnp_resource_change(&cfg->port_resource[0], ics2115_port[dev], 16);
202 }
203
204 if (ics2115_port[dev] != SNDRV_AUTO_IRQ) {
205 pnp_resource_change(&cfg->irq_resource[0], ics2115_irq[dev], 1);
206 }
207
208 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
209 snd_printk(KERN_ERR "PnP ICS2115 the requested resources are invalid, using auto config\n");
210 err = pnp_activate_dev(pdev); 171 err = pnp_activate_dev(pdev);
211 if (err < 0) { 172 if (err < 0) {
212 snd_printk(KERN_ERR "PnP ICS2115 pnp configure failure\n"); 173 snd_printk(KERN_ERR "PnP ICS2115 pnp configure failure\n");
213 kfree(cfg);
214 return err; 174 return err;
215 } 175 }
216 176
@@ -226,15 +186,6 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
226 186
227 pdev = acard->mpu; 187 pdev = acard->mpu;
228 188
229 pnp_init_resource_table(cfg);
230
231 if (cs4232_mpu_port[dev] != SNDRV_AUTO_PORT)
232 pnp_resource_change(&cfg->port_resource[0], cs4232_mpu_port[dev], 2);
233 if (cs4232_mpu_irq[dev] != SNDRV_AUTO_IRQ)
234 pnp_resource_change(&cfg->port_resource[0], cs4232_mpu_irq[dev], 1);
235
236 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
237 snd_printk(KERN_ERR "PnP MPU401 the requested resources are invalid, using auto config\n");
238 err = pnp_activate_dev(pdev); 189 err = pnp_activate_dev(pdev);
239 if (err < 0) { 190 if (err < 0) {
240 snd_printk(KERN_ERR "PnP MPU401 pnp configure failure\n"); 191 snd_printk(KERN_ERR "PnP MPU401 pnp configure failure\n");
@@ -258,7 +209,6 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
258 ics2115_port[dev], 209 ics2115_port[dev],
259 ics2115_irq[dev]); 210 ics2115_irq[dev]);
260 211
261 kfree(cfg);
262 return 0; 212 return 0;
263} 213}
264 214
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c
index fc95a870f690..2efaa7f205aa 100644
--- a/sound/isa/wavefront/wavefront_fx.c
+++ b/sound/isa/wavefront/wavefront_fx.c
@@ -16,7 +16,6 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18 18
19#include <sound/driver.h>
20#include <asm/io.h> 19#include <asm/io.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/time.h> 21#include <linux/time.h>
diff --git a/sound/isa/wavefront/wavefront_midi.c b/sound/isa/wavefront/wavefront_midi.c
index cb3460094324..a33384a55b0f 100644
--- a/sound/isa/wavefront/wavefront_midi.c
+++ b/sound/isa/wavefront/wavefront_midi.c
@@ -47,7 +47,6 @@
47 * 47 *
48 */ 48 */
49 49
50#include <sound/driver.h>
51#include <asm/io.h> 50#include <asm/io.h>
52#include <linux/init.h> 51#include <linux/init.h>
53#include <linux/time.h> 52#include <linux/time.h>
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
index a1ebb7c5c684..95eeca163354 100644
--- a/sound/isa/wavefront/wavefront_synth.c
+++ b/sound/isa/wavefront/wavefront_synth.c
@@ -20,7 +20,6 @@
20 * 20 *
21 */ 21 */
22 22
23#include <sound/driver.h>
24#include <asm/io.h> 23#include <asm/io.h>
25#include <linux/interrupt.h> 24#include <linux/interrupt.h>
26#include <linux/init.h> 25#include <linux/init.h>