aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/Kconfig16
-rw-r--r--sound/isa/cmi8330.c1
-rw-r--r--sound/isa/cs423x/cs4236.c1
-rw-r--r--sound/isa/es1688/es1688.c225
-rw-r--r--sound/isa/es1688/es1688_lib.c47
-rw-r--r--sound/isa/es18xx.c1
-rw-r--r--sound/isa/gus/gus_mem_proc.c48
-rw-r--r--sound/isa/gus/gusextreme.c26
-rw-r--r--sound/isa/gus/interwave.c1
-rw-r--r--sound/isa/msnd/msnd_midi.c1
-rw-r--r--sound/isa/opl3sa2.c1
-rw-r--r--sound/isa/opti9xx/miro.c1
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c1
-rw-r--r--sound/isa/sb/Makefile2
-rw-r--r--sound/isa/sb/emu8000_pcm.c1
-rw-r--r--sound/isa/sb/es968.c248
-rw-r--r--sound/isa/sb/sb16.c1
-rw-r--r--sound/isa/sb/sb8.c1
-rw-r--r--sound/isa/wavefront/wavefront.c1
-rw-r--r--sound/isa/wavefront/wavefront_fx.c1
-rw-r--r--sound/isa/wavefront/wavefront_synth.c1
21 files changed, 234 insertions, 392 deletions
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index 755a0a5f0e3f..c6990c680796 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -128,26 +128,14 @@ config SND_CS4236
128 To compile this driver as a module, choose M here: the module 128 To compile this driver as a module, choose M here: the module
129 will be called snd-cs4236. 129 will be called snd-cs4236.
130 130
131config SND_ES968
132 tristate "Generic ESS ES968 driver"
133 depends on PNP
134 select ISAPNP
135 select SND_MPU401_UART
136 select SND_SB8_DSP
137 help
138 Say Y here to include support for ESS AudioDrive ES968 chips.
139
140 To compile this driver as a module, choose M here: the module
141 will be called snd-es968.
142
143config SND_ES1688 131config SND_ES1688
144 tristate "Generic ESS ES688/ES1688 driver" 132 tristate "Generic ESS ES688/ES1688 and ES968 PnP driver"
145 select SND_OPL3_LIB 133 select SND_OPL3_LIB
146 select SND_MPU401_UART 134 select SND_MPU401_UART
147 select SND_PCM 135 select SND_PCM
148 help 136 help
149 Say Y here to include support for ESS AudioDrive ES688 or 137 Say Y here to include support for ESS AudioDrive ES688 or
150 ES1688 chips. 138 ES1688 chips. Also, this module support cards with ES968 PnP chip.
151 139
152 To compile this driver as a module, choose M here: the module 140 To compile this driver as a module, choose M here: the module
153 will be called snd-es1688. 141 will be called snd-es1688.
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index 8246aae32ab4..fe79a169acb5 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -46,7 +46,6 @@
46#include <linux/init.h> 46#include <linux/init.h>
47#include <linux/err.h> 47#include <linux/err.h>
48#include <linux/isa.h> 48#include <linux/isa.h>
49#include <linux/slab.h>
50#include <linux/pnp.h> 49#include <linux/pnp.h>
51#include <linux/moduleparam.h> 50#include <linux/moduleparam.h>
52#include <sound/core.h> 51#include <sound/core.h>
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index cc15d1d65a22..999dc1e0fdbd 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -22,7 +22,6 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/isa.h> 24#include <linux/isa.h>
25#include <linux/slab.h>
26#include <linux/pnp.h> 25#include <linux/pnp.h>
27#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
28#include <sound/core.h> 27#include <sound/core.h>
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index 07df201ed8fa..0cde8131a575 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -22,6 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/isa.h> 24#include <linux/isa.h>
25#include <linux/isapnp.h>
25#include <linux/time.h> 26#include <linux/time.h>
26#include <linux/wait.h> 27#include <linux/wait.h>
27#include <linux/moduleparam.h> 28#include <linux/moduleparam.h>
@@ -45,8 +46,13 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES688 PnP AudioDrive,pnp:ESS0100},"
45 "{ESS,ES688 AudioDrive,pnp:ESS6881}," 46 "{ESS,ES688 AudioDrive,pnp:ESS6881},"
46 "{ESS,ES1688 AudioDrive,pnp:ESS1681}}"); 47 "{ESS,ES1688 AudioDrive,pnp:ESS1681}}");
47 48
49MODULE_ALIAS("snd_es968");
50
48static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
49static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
53#ifdef CONFIG_PNP
54static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP;
55#endif
50static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 56static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
51static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ 57static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */
52static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* Usually 0x388 */ 58static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* Usually 0x388 */
@@ -60,6 +66,10 @@ MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard.");
60module_param_array(id, charp, NULL, 0444); 66module_param_array(id, charp, NULL, 0444);
61MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard."); 67MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard.");
62module_param_array(enable, bool, NULL, 0444); 68module_param_array(enable, bool, NULL, 0444);
69#ifdef CONFIG_PNP
70module_param_array(isapnp, bool, NULL, 0444);
71MODULE_PARM_DESC(isapnp, "PnP detection for specified soundcard.");
72#endif
63MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); 73MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard.");
64module_param_array(port, long, NULL, 0444); 74module_param_array(port, long, NULL, 0444);
65MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); 75MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver.");
@@ -74,14 +84,21 @@ MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver.");
74module_param_array(dma8, int, NULL, 0444); 84module_param_array(dma8, int, NULL, 0444);
75MODULE_PARM_DESC(dma8, "8-bit DMA # for " CRD_NAME " driver."); 85MODULE_PARM_DESC(dma8, "8-bit DMA # for " CRD_NAME " driver.");
76 86
87#ifdef CONFIG_PNP
88#define is_isapnp_selected(dev) isapnp[dev]
89#else
90#define is_isapnp_selected(dev) 0
91#endif
92
77static int __devinit snd_es1688_match(struct device *dev, unsigned int n) 93static int __devinit snd_es1688_match(struct device *dev, unsigned int n)
78{ 94{
79 return enable[n]; 95 return enable[n] && !is_isapnp_selected(n);
80} 96}
81 97
82static int __devinit snd_es1688_legacy_create(struct snd_card *card, 98static int __devinit snd_es1688_legacy_create(struct snd_card *card,
83 struct device *dev, unsigned int n, struct snd_es1688 **rchip) 99 struct device *dev, unsigned int n)
84{ 100{
101 struct snd_es1688 *chip = card->private_data;
85 static long possible_ports[] = {0x220, 0x240, 0x260}; 102 static long possible_ports[] = {0x220, 0x240, 0x260};
86 static int possible_irqs[] = {5, 9, 10, 7, -1}; 103 static int possible_irqs[] = {5, 9, 10, 7, -1};
87 static int possible_dmas[] = {1, 3, 0, -1}; 104 static int possible_dmas[] = {1, 3, 0, -1};
@@ -104,47 +121,39 @@ static int __devinit snd_es1688_legacy_create(struct snd_card *card,
104 } 121 }
105 122
106 if (port[n] != SNDRV_AUTO_PORT) 123 if (port[n] != SNDRV_AUTO_PORT)
107 return snd_es1688_create(card, port[n], mpu_port[n], irq[n], 124 return snd_es1688_create(card, chip, port[n], mpu_port[n],
108 mpu_irq[n], dma8[n], ES1688_HW_AUTO, rchip); 125 irq[n], mpu_irq[n], dma8[n], ES1688_HW_AUTO);
109 126
110 i = 0; 127 i = 0;
111 do { 128 do {
112 port[n] = possible_ports[i]; 129 port[n] = possible_ports[i];
113 error = snd_es1688_create(card, port[n], mpu_port[n], irq[n], 130 error = snd_es1688_create(card, chip, port[n], mpu_port[n],
114 mpu_irq[n], dma8[n], ES1688_HW_AUTO, rchip); 131 irq[n], mpu_irq[n], dma8[n], ES1688_HW_AUTO);
115 } while (error < 0 && ++i < ARRAY_SIZE(possible_ports)); 132 } while (error < 0 && ++i < ARRAY_SIZE(possible_ports));
116 133
117 return error; 134 return error;
118} 135}
119 136
120static int __devinit snd_es1688_probe(struct device *dev, unsigned int n) 137static int __devinit snd_es1688_probe(struct snd_card *card, unsigned int n)
121{ 138{
122 struct snd_card *card; 139 struct snd_es1688 *chip = card->private_data;
123 struct snd_es1688 *chip;
124 struct snd_opl3 *opl3; 140 struct snd_opl3 *opl3;
125 struct snd_pcm *pcm; 141 struct snd_pcm *pcm;
126 int error; 142 int error;
127 143
128 error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card); 144 error = snd_es1688_pcm(card, chip, 0, &pcm);
129 if (error < 0) 145 if (error < 0)
130 return error; 146 return error;
131 147
132 error = snd_es1688_legacy_create(card, dev, n, &chip); 148 error = snd_es1688_mixer(card, chip);
133 if (error < 0)
134 goto out;
135
136 error = snd_es1688_pcm(chip, 0, &pcm);
137 if (error < 0) 149 if (error < 0)
138 goto out; 150 return error;
139
140 error = snd_es1688_mixer(chip);
141 if (error < 0)
142 goto out;
143 151
144 strcpy(card->driver, "ES1688"); 152 strlcpy(card->driver, "ES1688", sizeof(card->driver));
145 strcpy(card->shortname, pcm->name); 153 strlcpy(card->shortname, pcm->name, sizeof(card->shortname));
146 sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, 154 snprintf(card->longname, sizeof(card->longname),
147 chip->port, chip->irq, chip->dma8); 155 "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port,
156 chip->irq, chip->dma8);
148 157
149 if (fm_port[n] == SNDRV_AUTO_PORT) 158 if (fm_port[n] == SNDRV_AUTO_PORT)
150 fm_port[n] = port[n]; /* share the same port */ 159 fm_port[n] = port[n]; /* share the same port */
@@ -152,12 +161,12 @@ static int __devinit snd_es1688_probe(struct device *dev, unsigned int n)
152 if (fm_port[n] > 0) { 161 if (fm_port[n] > 0) {
153 if (snd_opl3_create(card, fm_port[n], fm_port[n] + 2, 162 if (snd_opl3_create(card, fm_port[n], fm_port[n] + 2,
154 OPL3_HW_OPL3, 0, &opl3) < 0) 163 OPL3_HW_OPL3, 0, &opl3) < 0)
155 dev_warn(dev, 164 dev_warn(card->dev,
156 "opl3 not detected at 0x%lx\n", fm_port[n]); 165 "opl3 not detected at 0x%lx\n", fm_port[n]);
157 else { 166 else {
158 error = snd_opl3_hwdep_new(opl3, 0, 1, NULL); 167 error = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
159 if (error < 0) 168 if (error < 0)
160 goto out; 169 return error;
161 } 170 }
162 } 171 }
163 172
@@ -167,23 +176,41 @@ static int __devinit snd_es1688_probe(struct device *dev, unsigned int n)
167 chip->mpu_port, 0, 176 chip->mpu_port, 0,
168 mpu_irq[n], IRQF_DISABLED, NULL); 177 mpu_irq[n], IRQF_DISABLED, NULL);
169 if (error < 0) 178 if (error < 0)
170 goto out; 179 return error;
171 } 180 }
172 181
182 return snd_card_register(card);
183}
184
185static int __devinit snd_es1688_isa_probe(struct device *dev, unsigned int n)
186{
187 struct snd_card *card;
188 int error;
189
190 error = snd_card_create(index[n], id[n], THIS_MODULE,
191 sizeof(struct snd_es1688), &card);
192 if (error < 0)
193 return error;
194
195 error = snd_es1688_legacy_create(card, dev, n);
196 if (error < 0)
197 goto out;
198
173 snd_card_set_dev(card, dev); 199 snd_card_set_dev(card, dev);
174 200
175 error = snd_card_register(card); 201 error = snd_es1688_probe(card, n);
176 if (error < 0) 202 if (error < 0)
177 goto out; 203 goto out;
178 204
179 dev_set_drvdata(dev, card); 205 dev_set_drvdata(dev, card);
180 return 0;
181 206
182out: snd_card_free(card); 207 return 0;
208out:
209 snd_card_free(card);
183 return error; 210 return error;
184} 211}
185 212
186static int __devexit snd_es1688_remove(struct device *dev, unsigned int n) 213static int __devexit snd_es1688_isa_remove(struct device *dev, unsigned int n)
187{ 214{
188 snd_card_free(dev_get_drvdata(dev)); 215 snd_card_free(dev_get_drvdata(dev));
189 dev_set_drvdata(dev, NULL); 216 dev_set_drvdata(dev, NULL);
@@ -192,8 +219,8 @@ static int __devexit snd_es1688_remove(struct device *dev, unsigned int n)
192 219
193static struct isa_driver snd_es1688_driver = { 220static struct isa_driver snd_es1688_driver = {
194 .match = snd_es1688_match, 221 .match = snd_es1688_match,
195 .probe = snd_es1688_probe, 222 .probe = snd_es1688_isa_probe,
196 .remove = __devexit_p(snd_es1688_remove), 223 .remove = __devexit_p(snd_es1688_isa_remove),
197#if 0 /* FIXME */ 224#if 0 /* FIXME */
198 .suspend = snd_es1688_suspend, 225 .suspend = snd_es1688_suspend,
199 .resume = snd_es1688_resume, 226 .resume = snd_es1688_resume,
@@ -203,14 +230,142 @@ static struct isa_driver snd_es1688_driver = {
203 } 230 }
204}; 231};
205 232
233static int snd_es968_pnp_is_probed;
234
235#ifdef CONFIG_PNP
236static int __devinit snd_card_es968_pnp(struct snd_card *card, unsigned int n,
237 struct pnp_card_link *pcard,
238 const struct pnp_card_device_id *pid)
239{
240 struct snd_es1688 *chip = card->private_data;
241 struct pnp_dev *pdev;
242 int error;
243
244 pdev = pnp_request_card_device(pcard, pid->devs[0].id, NULL);
245 if (pdev == NULL)
246 return -ENODEV;
247
248 error = pnp_activate_dev(pdev);
249 if (error < 0) {
250 snd_printk(KERN_ERR "ES968 pnp configure failure\n");
251 return error;
252 }
253 port[n] = pnp_port_start(pdev, 0);
254 dma8[n] = pnp_dma(pdev, 0);
255 irq[n] = pnp_irq(pdev, 0);
256
257 return snd_es1688_create(card, chip, port[n], mpu_port[n], irq[n],
258 mpu_irq[n], dma8[n], ES1688_HW_AUTO);
259}
260
261static int __devinit snd_es968_pnp_detect(struct pnp_card_link *pcard,
262 const struct pnp_card_device_id *pid)
263{
264 struct snd_card *card;
265 static unsigned int dev;
266 int error;
267 struct snd_es1688 *chip;
268
269 if (snd_es968_pnp_is_probed)
270 return -EBUSY;
271 for ( ; dev < SNDRV_CARDS; dev++) {
272 if (enable[dev] && isapnp[dev])
273 break;
274 }
275 if (dev == SNDRV_CARDS)
276 return -ENODEV;
277
278 error = snd_card_create(index[dev], id[dev], THIS_MODULE,
279 sizeof(struct snd_es1688), &card);
280 if (error < 0)
281 return error;
282 chip = card->private_data;
283
284 error = snd_card_es968_pnp(card, dev, pcard, pid);
285 if (error < 0) {
286 snd_card_free(card);
287 return error;
288 }
289 snd_card_set_dev(card, &pcard->card->dev);
290 error = snd_es1688_probe(card, dev);
291 if (error < 0)
292 return error;
293 pnp_set_card_drvdata(pcard, card);
294 snd_es968_pnp_is_probed = 1;
295 return 0;
296}
297
298static void __devexit snd_es968_pnp_remove(struct pnp_card_link * pcard)
299{
300 snd_card_free(pnp_get_card_drvdata(pcard));
301 pnp_set_card_drvdata(pcard, NULL);
302 snd_es968_pnp_is_probed = 0;
303}
304
305#ifdef CONFIG_PM
306static int snd_es968_pnp_suspend(struct pnp_card_link *pcard,
307 pm_message_t state)
308{
309 struct snd_card *card = pnp_get_card_drvdata(pcard);
310 struct snd_es1688 *chip = card->private_data;
311
312 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
313 snd_pcm_suspend_all(chip->pcm);
314 return 0;
315}
316
317static int snd_es968_pnp_resume(struct pnp_card_link *pcard)
318{
319 struct snd_card *card = pnp_get_card_drvdata(pcard);
320 struct snd_es1688 *chip = card->private_data;
321
322 snd_es1688_reset(chip);
323 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
324 return 0;
325}
326#endif
327
328static struct pnp_card_device_id snd_es968_pnpids[] = {
329 { .id = "ESS0968", .devs = { { "@@@0968" }, } },
330 { .id = "ESS0968", .devs = { { "ESS0968" }, } },
331 { .id = "", } /* end */
332};
333
334MODULE_DEVICE_TABLE(pnp_card, snd_es968_pnpids);
335
336static struct pnp_card_driver es968_pnpc_driver = {
337 .flags = PNP_DRIVER_RES_DISABLE,
338 .name = DEV_NAME " PnP",
339 .id_table = snd_es968_pnpids,
340 .probe = snd_es968_pnp_detect,
341 .remove = __devexit_p(snd_es968_pnp_remove),
342#ifdef CONFIG_PM
343 .suspend = snd_es968_pnp_suspend,
344 .resume = snd_es968_pnp_resume,
345#endif
346};
347#endif
348
206static int __init alsa_card_es1688_init(void) 349static int __init alsa_card_es1688_init(void)
207{ 350{
351#ifdef CONFIG_PNP
352 pnp_register_card_driver(&es968_pnpc_driver);
353 if (snd_es968_pnp_is_probed)
354 return 0;
355 pnp_unregister_card_driver(&es968_pnpc_driver);
356#endif
208 return isa_register_driver(&snd_es1688_driver, SNDRV_CARDS); 357 return isa_register_driver(&snd_es1688_driver, SNDRV_CARDS);
209} 358}
210 359
211static void __exit alsa_card_es1688_exit(void) 360static void __exit alsa_card_es1688_exit(void)
212{ 361{
213 isa_unregister_driver(&snd_es1688_driver); 362 if (!snd_es968_pnp_is_probed) {
363 isa_unregister_driver(&snd_es1688_driver);
364 return;
365 }
366#ifdef CONFIG_PNP
367 pnp_unregister_card_driver(&es968_pnpc_driver);
368#endif
214} 369}
215 370
216module_init(alsa_card_es1688_init); 371module_init(alsa_card_es1688_init);
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c
index c76bb00c9d15..07676200496a 100644
--- a/sound/isa/es1688/es1688_lib.c
+++ b/sound/isa/es1688/es1688_lib.c
@@ -99,7 +99,7 @@ static unsigned char snd_es1688_mixer_read(struct snd_es1688 *chip, unsigned cha
99 return result; 99 return result;
100} 100}
101 101
102static int snd_es1688_reset(struct snd_es1688 *chip) 102int snd_es1688_reset(struct snd_es1688 *chip)
103{ 103{
104 int i; 104 int i;
105 105
@@ -115,6 +115,7 @@ static int snd_es1688_reset(struct snd_es1688 *chip)
115 snd_es1688_dsp_command(chip, 0xc6); /* enable extended mode */ 115 snd_es1688_dsp_command(chip, 0xc6); /* enable extended mode */
116 return 0; 116 return 0;
117} 117}
118EXPORT_SYMBOL(snd_es1688_reset);
118 119
119static int snd_es1688_probe(struct snd_es1688 *chip) 120static int snd_es1688_probe(struct snd_es1688 *chip)
120{ 121{
@@ -620,7 +621,6 @@ static int snd_es1688_free(struct snd_es1688 *chip)
620 disable_dma(chip->dma8); 621 disable_dma(chip->dma8);
621 free_dma(chip->dma8); 622 free_dma(chip->dma8);
622 } 623 }
623 kfree(chip);
624 return 0; 624 return 0;
625} 625}
626 626
@@ -638,23 +638,20 @@ static const char *snd_es1688_chip_id(struct snd_es1688 *chip)
638} 638}
639 639
640int snd_es1688_create(struct snd_card *card, 640int snd_es1688_create(struct snd_card *card,
641 struct snd_es1688 *chip,
641 unsigned long port, 642 unsigned long port,
642 unsigned long mpu_port, 643 unsigned long mpu_port,
643 int irq, 644 int irq,
644 int mpu_irq, 645 int mpu_irq,
645 int dma8, 646 int dma8,
646 unsigned short hardware, 647 unsigned short hardware)
647 struct snd_es1688 **rchip)
648{ 648{
649 static struct snd_device_ops ops = { 649 static struct snd_device_ops ops = {
650 .dev_free = snd_es1688_dev_free, 650 .dev_free = snd_es1688_dev_free,
651 }; 651 };
652 652
653 struct snd_es1688 *chip;
654 int err; 653 int err;
655 654
656 *rchip = NULL;
657 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
658 if (chip == NULL) 655 if (chip == NULL)
659 return -ENOMEM; 656 return -ENOMEM;
660 chip->irq = -1; 657 chip->irq = -1;
@@ -662,25 +659,21 @@ int snd_es1688_create(struct snd_card *card,
662 659
663 if ((chip->res_port = request_region(port + 4, 12, "ES1688")) == NULL) { 660 if ((chip->res_port = request_region(port + 4, 12, "ES1688")) == NULL) {
664 snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4); 661 snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4);
665 snd_es1688_free(chip);
666 return -EBUSY; 662 return -EBUSY;
667 } 663 }
668 if (request_irq(irq, snd_es1688_interrupt, IRQF_DISABLED, "ES1688", (void *) chip)) { 664 if (request_irq(irq, snd_es1688_interrupt, IRQF_DISABLED, "ES1688", (void *) chip)) {
669 snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq); 665 snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq);
670 snd_es1688_free(chip);
671 return -EBUSY; 666 return -EBUSY;
672 } 667 }
673 chip->irq = irq; 668 chip->irq = irq;
674 if (request_dma(dma8, "ES1688")) { 669 if (request_dma(dma8, "ES1688")) {
675 snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8); 670 snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8);
676 snd_es1688_free(chip);
677 return -EBUSY; 671 return -EBUSY;
678 } 672 }
679 chip->dma8 = dma8; 673 chip->dma8 = dma8;
680 674
681 spin_lock_init(&chip->reg_lock); 675 spin_lock_init(&chip->reg_lock);
682 spin_lock_init(&chip->mixer_lock); 676 spin_lock_init(&chip->mixer_lock);
683 chip->card = card;
684 chip->port = port; 677 chip->port = port;
685 mpu_port &= ~0x000f; 678 mpu_port &= ~0x000f;
686 if (mpu_port < 0x300 || mpu_port > 0x330) 679 if (mpu_port < 0x300 || mpu_port > 0x330)
@@ -689,23 +682,16 @@ int snd_es1688_create(struct snd_card *card,
689 chip->mpu_irq = mpu_irq; 682 chip->mpu_irq = mpu_irq;
690 chip->hardware = hardware; 683 chip->hardware = hardware;
691 684
692 if ((err = snd_es1688_probe(chip)) < 0) { 685 err = snd_es1688_probe(chip);
693 snd_es1688_free(chip); 686 if (err < 0)
694 return err; 687 return err;
695 }
696 if ((err = snd_es1688_init(chip, 1)) < 0) {
697 snd_es1688_free(chip);
698 return err;
699 }
700 688
701 /* Register device */ 689 err = snd_es1688_init(chip, 1);
702 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { 690 if (err < 0)
703 snd_es1688_free(chip);
704 return err; 691 return err;
705 }
706 692
707 *rchip = chip; 693 /* Register device */
708 return 0; 694 return snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
709} 695}
710 696
711static struct snd_pcm_ops snd_es1688_playback_ops = { 697static struct snd_pcm_ops snd_es1688_playback_ops = {
@@ -730,12 +716,14 @@ static struct snd_pcm_ops snd_es1688_capture_ops = {
730 .pointer = snd_es1688_capture_pointer, 716 .pointer = snd_es1688_capture_pointer,
731}; 717};
732 718
733int snd_es1688_pcm(struct snd_es1688 * chip, int device, struct snd_pcm ** rpcm) 719int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip,
720 int device, struct snd_pcm **rpcm)
734{ 721{
735 struct snd_pcm *pcm; 722 struct snd_pcm *pcm;
736 int err; 723 int err;
737 724
738 if ((err = snd_pcm_new(chip->card, "ESx688", device, 1, 1, &pcm)) < 0) 725 err = snd_pcm_new(card, "ESx688", device, 1, 1, &pcm);
726 if (err < 0)
739 return err; 727 return err;
740 728
741 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_es1688_playback_ops); 729 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_es1688_playback_ops);
@@ -1009,18 +997,15 @@ static unsigned char snd_es1688_init_table[][2] = {
1009 { ES1688_REC_DEV, 0x17 } 997 { ES1688_REC_DEV, 0x17 }
1010}; 998};
1011 999
1012int snd_es1688_mixer(struct snd_es1688 *chip) 1000int snd_es1688_mixer(struct snd_card *card, struct snd_es1688 *chip)
1013{ 1001{
1014 struct snd_card *card;
1015 unsigned int idx; 1002 unsigned int idx;
1016 int err; 1003 int err;
1017 unsigned char reg, val; 1004 unsigned char reg, val;
1018 1005
1019 if (snd_BUG_ON(!chip || !chip->card)) 1006 if (snd_BUG_ON(!chip || !card))
1020 return -EINVAL; 1007 return -EINVAL;
1021 1008
1022 card = chip->card;
1023
1024 strcpy(card->mixername, snd_es1688_chip_id(chip)); 1009 strcpy(card->mixername, snd_es1688_chip_id(chip));
1025 1010
1026 for (idx = 0; idx < ARRAY_SIZE(snd_es1688_controls); idx++) { 1011 for (idx = 0; idx < ARRAY_SIZE(snd_es1688_controls); idx++) {
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 9a43baae7250..fb4d6b34bbca 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -80,7 +80,6 @@
80#include <linux/init.h> 80#include <linux/init.h>
81#include <linux/err.h> 81#include <linux/err.h>
82#include <linux/isa.h> 82#include <linux/isa.h>
83#include <linux/slab.h>
84#include <linux/pnp.h> 83#include <linux/pnp.h>
85#include <linux/isapnp.h> 84#include <linux/isapnp.h>
86#include <linux/moduleparam.h> 85#include <linux/moduleparam.h>
diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c
index 2803e227aec9..2ccb3fadd7be 100644
--- a/sound/isa/gus/gus_mem_proc.c
+++ b/sound/isa/gus/gus_mem_proc.c
@@ -31,52 +31,21 @@ struct gus_proc_private {
31 struct snd_gus_card * gus; 31 struct snd_gus_card * gus;
32}; 32};
33 33
34static long snd_gf1_mem_proc_dump(struct snd_info_entry *entry, void *file_private_data, 34static ssize_t snd_gf1_mem_proc_dump(struct snd_info_entry *entry,
35 struct file *file, char __user *buf, 35 void *file_private_data,
36 unsigned long count, unsigned long pos) 36 struct file *file, char __user *buf,
37 size_t count, loff_t pos)
37{ 38{
38 long size;
39 struct gus_proc_private *priv = entry->private_data; 39 struct gus_proc_private *priv = entry->private_data;
40 struct snd_gus_card *gus = priv->gus; 40 struct snd_gus_card *gus = priv->gus;
41 int err; 41 int err;
42 42
43 size = count; 43 err = snd_gus_dram_read(gus, buf, pos, count, priv->rom);
44 if (pos + size > priv->size) 44 if (err < 0)
45 size = (long)priv->size - pos; 45 return err;
46 if (size > 0) { 46 return count;
47 if ((err = snd_gus_dram_read(gus, buf, pos, size, priv->rom)) < 0)
48 return err;
49 return size;
50 }
51 return 0;
52} 47}
53 48
54static long long snd_gf1_mem_proc_llseek(struct snd_info_entry *entry,
55 void *private_file_data,
56 struct file *file,
57 long long offset,
58 int orig)
59{
60 struct gus_proc_private *priv = entry->private_data;
61
62 switch (orig) {
63 case SEEK_SET:
64 file->f_pos = offset;
65 break;
66 case SEEK_CUR:
67 file->f_pos += offset;
68 break;
69 case SEEK_END: /* offset is negative */
70 file->f_pos = priv->size + offset;
71 break;
72 default:
73 return -EINVAL;
74 }
75 if (file->f_pos > priv->size)
76 file->f_pos = priv->size;
77 return file->f_pos;
78}
79
80static void snd_gf1_mem_proc_free(struct snd_info_entry *entry) 49static void snd_gf1_mem_proc_free(struct snd_info_entry *entry)
81{ 50{
82 struct gus_proc_private *priv = entry->private_data; 51 struct gus_proc_private *priv = entry->private_data;
@@ -85,7 +54,6 @@ static void snd_gf1_mem_proc_free(struct snd_info_entry *entry)
85 54
86static struct snd_info_entry_ops snd_gf1_mem_proc_ops = { 55static struct snd_info_entry_ops snd_gf1_mem_proc_ops = {
87 .read = snd_gf1_mem_proc_dump, 56 .read = snd_gf1_mem_proc_dump,
88 .llseek = snd_gf1_mem_proc_llseek,
89}; 57};
90 58
91int snd_gf1_mem_proc_init(struct snd_gus_card * gus) 59int snd_gf1_mem_proc_init(struct snd_gus_card * gus)
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index 65e4b18581a6..008e8e5bfa37 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -95,7 +95,7 @@ static int __devinit snd_gusextreme_match(struct device *dev, unsigned int n)
95} 95}
96 96
97static int __devinit snd_gusextreme_es1688_create(struct snd_card *card, 97static int __devinit snd_gusextreme_es1688_create(struct snd_card *card,
98 struct device *dev, unsigned int n, struct snd_es1688 **rchip) 98 struct snd_es1688 *chip, struct device *dev, unsigned int n)
99{ 99{
100 static long possible_ports[] = {0x220, 0x240, 0x260}; 100 static long possible_ports[] = {0x220, 0x240, 0x260};
101 static int possible_irqs[] = {5, 9, 10, 7, -1}; 101 static int possible_irqs[] = {5, 9, 10, 7, -1};
@@ -119,14 +119,14 @@ static int __devinit snd_gusextreme_es1688_create(struct snd_card *card,
119 } 119 }
120 120
121 if (port[n] != SNDRV_AUTO_PORT) 121 if (port[n] != SNDRV_AUTO_PORT)
122 return snd_es1688_create(card, port[n], mpu_port[n], irq[n], 122 return snd_es1688_create(card, chip, port[n], mpu_port[n],
123 mpu_irq[n], dma8[n], ES1688_HW_1688, rchip); 123 irq[n], mpu_irq[n], dma8[n], ES1688_HW_1688);
124 124
125 i = 0; 125 i = 0;
126 do { 126 do {
127 port[n] = possible_ports[i]; 127 port[n] = possible_ports[i];
128 error = snd_es1688_create(card, port[n], mpu_port[n], irq[n], 128 error = snd_es1688_create(card, chip, port[n], mpu_port[n],
129 mpu_irq[n], dma8[n], ES1688_HW_1688, rchip); 129 irq[n], mpu_irq[n], dma8[n], ES1688_HW_1688);
130 } while (error < 0 && ++i < ARRAY_SIZE(possible_ports)); 130 } while (error < 0 && ++i < ARRAY_SIZE(possible_ports));
131 131
132 return error; 132 return error;
@@ -206,9 +206,8 @@ static int __devinit snd_gusextreme_detect(struct snd_gus_card *gus,
206 return 0; 206 return 0;
207} 207}
208 208
209static int __devinit snd_gusextreme_mixer(struct snd_es1688 *chip) 209static int __devinit snd_gusextreme_mixer(struct snd_card *card)
210{ 210{
211 struct snd_card *card = chip->card;
212 struct snd_ctl_elem_id id1, id2; 211 struct snd_ctl_elem_id id1, id2;
213 int error; 212 int error;
214 213
@@ -241,17 +240,20 @@ static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n)
241 struct snd_opl3 *opl3; 240 struct snd_opl3 *opl3;
242 int error; 241 int error;
243 242
244 error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card); 243 error = snd_card_create(index[n], id[n], THIS_MODULE,
244 sizeof(struct snd_es1688), &card);
245 if (error < 0) 245 if (error < 0)
246 return error; 246 return error;
247 247
248 es1688 = card->private_data;
249
248 if (mpu_port[n] == SNDRV_AUTO_PORT) 250 if (mpu_port[n] == SNDRV_AUTO_PORT)
249 mpu_port[n] = 0; 251 mpu_port[n] = 0;
250 252
251 if (mpu_irq[n] > 15) 253 if (mpu_irq[n] > 15)
252 mpu_irq[n] = -1; 254 mpu_irq[n] = -1;
253 255
254 error = snd_gusextreme_es1688_create(card, dev, n, &es1688); 256 error = snd_gusextreme_es1688_create(card, es1688, dev, n);
255 if (error < 0) 257 if (error < 0)
256 goto out; 258 goto out;
257 259
@@ -280,11 +282,11 @@ static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n)
280 } 282 }
281 gus->codec_flag = 1; 283 gus->codec_flag = 1;
282 284
283 error = snd_es1688_pcm(es1688, 0, NULL); 285 error = snd_es1688_pcm(card, es1688, 0, NULL);
284 if (error < 0) 286 if (error < 0)
285 goto out; 287 goto out;
286 288
287 error = snd_es1688_mixer(es1688); 289 error = snd_es1688_mixer(card, es1688);
288 if (error < 0) 290 if (error < 0)
289 goto out; 291 goto out;
290 292
@@ -300,7 +302,7 @@ static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n)
300 if (error < 0) 302 if (error < 0)
301 goto out; 303 goto out;
302 304
303 error = snd_gusextreme_mixer(es1688); 305 error = snd_gusextreme_mixer(card);
304 if (error < 0) 306 if (error < 0)
305 goto out; 307 goto out;
306 308
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 534a6eced2b8..c7b80e4730fc 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -26,7 +26,6 @@
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/isa.h> 27#include <linux/isa.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/slab.h>
30#include <linux/pnp.h> 29#include <linux/pnp.h>
31#include <linux/moduleparam.h> 30#include <linux/moduleparam.h>
32#include <asm/dma.h> 31#include <asm/dma.h>
diff --git a/sound/isa/msnd/msnd_midi.c b/sound/isa/msnd/msnd_midi.c
index 4be562b2cf21..787495674235 100644
--- a/sound/isa/msnd/msnd_midi.c
+++ b/sound/isa/msnd/msnd_midi.c
@@ -25,6 +25,7 @@
25 */ 25 */
26 26
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/slab.h>
28#include <linux/delay.h> 29#include <linux/delay.h>
29#include <linux/ioport.h> 30#include <linux/ioport.h>
30#include <linux/errno.h> 31#include <linux/errno.h>
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 0481a55334b9..265abcce9dba 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -24,7 +24,6 @@
24#include <linux/isa.h> 24#include <linux/isa.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/pm.h> 26#include <linux/pm.h>
27#include <linux/slab.h>
28#include <linux/pnp.h> 27#include <linux/pnp.h>
29#include <linux/moduleparam.h> 28#include <linux/moduleparam.h>
30#include <sound/core.h> 29#include <sound/core.h>
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
index 5913717c1be6..8c24102d0d93 100644
--- a/sound/isa/opti9xx/miro.c
+++ b/sound/isa/opti9xx/miro.c
@@ -27,7 +27,6 @@
27#include <linux/isa.h> 27#include <linux/isa.h>
28#include <linux/pnp.h> 28#include <linux/pnp.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/slab.h>
31#include <linux/ioport.h> 30#include <linux/ioport.h>
32#include <linux/moduleparam.h> 31#include <linux/moduleparam.h>
33#include <asm/io.h> 32#include <asm/io.h>
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 4d2d0405bdc7..c35dc68930dc 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -27,7 +27,6 @@
27#include <linux/err.h> 27#include <linux/err.h>
28#include <linux/isa.h> 28#include <linux/isa.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/slab.h>
31#include <linux/pnp.h> 30#include <linux/pnp.h>
32#include <linux/moduleparam.h> 31#include <linux/moduleparam.h>
33#include <asm/io.h> 32#include <asm/io.h>
diff --git a/sound/isa/sb/Makefile b/sound/isa/sb/Makefile
index af3669681788..08b9fb974658 100644
--- a/sound/isa/sb/Makefile
+++ b/sound/isa/sb/Makefile
@@ -11,7 +11,6 @@ snd-sb8-objs := sb8.o
11snd-sb16-objs := sb16.o 11snd-sb16-objs := sb16.o
12snd-sbawe-objs := sbawe.o emu8000.o 12snd-sbawe-objs := sbawe.o emu8000.o
13snd-emu8000-synth-objs := emu8000_synth.o emu8000_callback.o emu8000_patch.o emu8000_pcm.o 13snd-emu8000-synth-objs := emu8000_synth.o emu8000_callback.o emu8000_patch.o emu8000_pcm.o
14snd-es968-objs := es968.o
15snd-jazz16-objs := jazz16.o 14snd-jazz16-objs := jazz16.o
16 15
17# Toplevel Module Dependency 16# Toplevel Module Dependency
@@ -21,7 +20,6 @@ obj-$(CONFIG_SND_SB8_DSP) += snd-sb8-dsp.o
21obj-$(CONFIG_SND_SB8) += snd-sb8.o 20obj-$(CONFIG_SND_SB8) += snd-sb8.o
22obj-$(CONFIG_SND_SB16) += snd-sb16.o 21obj-$(CONFIG_SND_SB16) += snd-sb16.o
23obj-$(CONFIG_SND_SBAWE) += snd-sbawe.o 22obj-$(CONFIG_SND_SBAWE) += snd-sbawe.o
24obj-$(CONFIG_SND_ES968) += snd-es968.o
25obj-$(CONFIG_SND_JAZZ16) += snd-jazz16.o 23obj-$(CONFIG_SND_JAZZ16) += snd-jazz16.o
26ifeq ($(CONFIG_SND_SB16_CSP),y) 24ifeq ($(CONFIG_SND_SB16_CSP),y)
27 obj-$(CONFIG_SND_SB16) += snd-sb16-csp.o 25 obj-$(CONFIG_SND_SB16) += snd-sb16-csp.o
diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c
index 91dc3d83e2cf..ccedbfed061a 100644
--- a/sound/isa/sb/emu8000_pcm.c
+++ b/sound/isa/sb/emu8000_pcm.c
@@ -20,6 +20,7 @@
20 20
21#include "emu8000_local.h" 21#include "emu8000_local.h"
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/slab.h>
23#include <sound/initval.h> 24#include <sound/initval.h>
24#include <sound/pcm.h> 25#include <sound/pcm.h>
25 26
diff --git a/sound/isa/sb/es968.c b/sound/isa/sb/es968.c
deleted file mode 100644
index cafc3a7316a8..000000000000
--- a/sound/isa/sb/es968.c
+++ /dev/null
@@ -1,248 +0,0 @@
1
2/*
3 card-es968.c - driver for ESS AudioDrive ES968 based soundcards.
4 Copyright (C) 1999 by Massimo Piccioni <dafastidio@libero.it>
5
6 Thanks to Pierfrancesco 'qM2' Passerini.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <linux/init.h>
24#include <linux/time.h>
25#include <linux/pnp.h>
26#include <linux/moduleparam.h>
27#include <sound/core.h>
28#include <sound/initval.h>
29#include <sound/sb.h>
30
31#define PFX "es968: "
32
33MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>");
34MODULE_DESCRIPTION("ESS AudioDrive ES968");
35MODULE_LICENSE("GPL");
36MODULE_SUPPORTED_DEVICE("{{ESS,AudioDrive ES968}}");
37
38static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
39static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
40static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
41static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
42static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* Pnp setup */
43static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* PnP setup */
44
45module_param_array(index, int, NULL, 0444);
46MODULE_PARM_DESC(index, "Index value for es968 based soundcard.");
47module_param_array(id, charp, NULL, 0444);
48MODULE_PARM_DESC(id, "ID string for es968 based soundcard.");
49module_param_array(enable, bool, NULL, 0444);
50MODULE_PARM_DESC(enable, "Enable es968 based soundcard.");
51
52struct snd_card_es968 {
53 struct pnp_dev *dev;
54 struct snd_sb *chip;
55};
56
57static struct pnp_card_device_id snd_es968_pnpids[] = {
58 { .id = "ESS0968", .devs = { { "@@@0968" }, } },
59 { .id = "", } /* end */
60};
61
62MODULE_DEVICE_TABLE(pnp_card, snd_es968_pnpids);
63
64#define DRIVER_NAME "snd-card-es968"
65
66static irqreturn_t snd_card_es968_interrupt(int irq, void *dev_id)
67{
68 struct snd_sb *chip = dev_id;
69
70 if (chip->open & SB_OPEN_PCM) {
71 return snd_sb8dsp_interrupt(chip);
72 } else {
73 return snd_sb8dsp_midi_interrupt(chip);
74 }
75}
76
77static int __devinit snd_card_es968_pnp(int dev, struct snd_card_es968 *acard,
78 struct pnp_card_link *card,
79 const struct pnp_card_device_id *id)
80{
81 struct pnp_dev *pdev;
82 int err;
83
84 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
85 if (acard->dev == NULL)
86 return -ENODEV;
87
88 pdev = acard->dev;
89
90 err = pnp_activate_dev(pdev);
91 if (err < 0) {
92 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n");
93 return err;
94 }
95 port[dev] = pnp_port_start(pdev, 0);
96 dma8[dev] = pnp_dma(pdev, 1);
97 irq[dev] = pnp_irq(pdev, 0);
98
99 return 0;
100}
101
102static int __devinit snd_card_es968_probe(int dev,
103 struct pnp_card_link *pcard,
104 const struct pnp_card_device_id *pid)
105{
106 int error;
107 struct snd_sb *chip;
108 struct snd_card *card;
109 struct snd_card_es968 *acard;
110
111 error = snd_card_create(index[dev], id[dev], THIS_MODULE,
112 sizeof(struct snd_card_es968), &card);
113 if (error < 0)
114 return error;
115 acard = card->private_data;
116 if ((error = snd_card_es968_pnp(dev, acard, pcard, pid))) {
117 snd_card_free(card);
118 return error;
119 }
120 snd_card_set_dev(card, &pcard->card->dev);
121
122 if ((error = snd_sbdsp_create(card, port[dev],
123 irq[dev],
124 snd_card_es968_interrupt,
125 dma8[dev],
126 -1,
127 SB_HW_AUTO, &chip)) < 0) {
128 snd_card_free(card);
129 return error;
130 }
131 acard->chip = chip;
132
133 if ((error = snd_sb8dsp_pcm(chip, 0, NULL)) < 0) {
134 snd_card_free(card);
135 return error;
136 }
137
138 if ((error = snd_sbmixer_new(chip)) < 0) {
139 snd_card_free(card);
140 return error;
141 }
142
143 if ((error = snd_sb8dsp_midi(chip, 0, NULL)) < 0) {
144 snd_card_free(card);
145 return error;
146 }
147
148 strcpy(card->driver, "ES968");
149 strcpy(card->shortname, "ESS ES968");
150 sprintf(card->longname, "%s soundcard, %s at 0x%lx, irq %d, dma %d",
151 card->shortname, chip->name, chip->port, irq[dev], dma8[dev]);
152
153 if ((error = snd_card_register(card)) < 0) {
154 snd_card_free(card);
155 return error;
156 }
157 pnp_set_card_drvdata(pcard, card);
158 return 0;
159}
160
161static unsigned int __devinitdata es968_devices;
162
163static int __devinit snd_es968_pnp_detect(struct pnp_card_link *card,
164 const struct pnp_card_device_id *id)
165{
166 static int dev;
167 int res;
168
169 for ( ; dev < SNDRV_CARDS; dev++) {
170 if (!enable[dev])
171 continue;
172 res = snd_card_es968_probe(dev, card, id);
173 if (res < 0)
174 return res;
175 dev++;
176 es968_devices++;
177 return 0;
178 }
179 return -ENODEV;
180}
181
182static void __devexit snd_es968_pnp_remove(struct pnp_card_link * pcard)
183{
184 snd_card_free(pnp_get_card_drvdata(pcard));
185 pnp_set_card_drvdata(pcard, NULL);
186}
187
188#ifdef CONFIG_PM
189static int snd_es968_pnp_suspend(struct pnp_card_link *pcard, pm_message_t state)
190{
191 struct snd_card *card = pnp_get_card_drvdata(pcard);
192 struct snd_card_es968 *acard = card->private_data;
193 struct snd_sb *chip = acard->chip;
194
195 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
196 snd_pcm_suspend_all(chip->pcm);
197 snd_sbmixer_suspend(chip);
198 return 0;
199}
200
201static int snd_es968_pnp_resume(struct pnp_card_link *pcard)
202{
203 struct snd_card *card = pnp_get_card_drvdata(pcard);
204 struct snd_card_es968 *acard = card->private_data;
205 struct snd_sb *chip = acard->chip;
206
207 snd_sbdsp_reset(chip);
208 snd_sbmixer_resume(chip);
209 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
210 return 0;
211}
212#endif
213
214static struct pnp_card_driver es968_pnpc_driver = {
215 .flags = PNP_DRIVER_RES_DISABLE,
216 .name = "es968",
217 .id_table = snd_es968_pnpids,
218 .probe = snd_es968_pnp_detect,
219 .remove = __devexit_p(snd_es968_pnp_remove),
220#ifdef CONFIG_PM
221 .suspend = snd_es968_pnp_suspend,
222 .resume = snd_es968_pnp_resume,
223#endif
224};
225
226static int __init alsa_card_es968_init(void)
227{
228 int err = pnp_register_card_driver(&es968_pnpc_driver);
229 if (err)
230 return err;
231
232 if (!es968_devices) {
233 pnp_unregister_card_driver(&es968_pnpc_driver);
234#ifdef MODULE
235 snd_printk(KERN_ERR "no ES968 based soundcards found\n");
236#endif
237 return -ENODEV;
238 }
239 return 0;
240}
241
242static void __exit alsa_card_es968_exit(void)
243{
244 pnp_unregister_card_driver(&es968_pnpc_driver);
245}
246
247module_init(alsa_card_es968_init)
248module_exit(alsa_card_es968_exit)
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 519c36346dec..4d1c5a300ff8 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -21,7 +21,6 @@
21 21
22#include <asm/dma.h> 22#include <asm/dma.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/slab.h>
25#include <linux/pnp.h> 24#include <linux/pnp.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/sb/sb8.c b/sound/isa/sb/sb8.c
index 3cd57ee54660..81284a8fa0ce 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -22,7 +22,6 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/isa.h> 24#include <linux/isa.h>
25#include <linux/slab.h>
26#include <linux/ioport.h> 25#include <linux/ioport.h>
27#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
28#include <sound/core.h> 27#include <sound/core.h>
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index a34ae7b1f7d0..711670e4a425 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -21,7 +21,6 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/slab.h>
25#include <linux/err.h> 24#include <linux/err.h>
26#include <linux/isa.h> 25#include <linux/isa.h>
27#include <linux/pnp.h> 26#include <linux/pnp.h>
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c
index 2bb1cee09255..657e2d6c01ac 100644
--- a/sound/isa/wavefront/wavefront_fx.c
+++ b/sound/isa/wavefront/wavefront_fx.c
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/time.h> 21#include <linux/time.h>
22#include <linux/wait.h> 22#include <linux/wait.h>
23#include <linux/slab.h>
23#include <linux/firmware.h> 24#include <linux/firmware.h>
24#include <sound/core.h> 25#include <sound/core.h>
25#include <sound/snd_wavefront.h> 26#include <sound/snd_wavefront.h>
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
index 5d4ff48c4345..4fb7b19ff393 100644
--- a/sound/isa/wavefront/wavefront_synth.c
+++ b/sound/isa/wavefront/wavefront_synth.c
@@ -28,6 +28,7 @@
28#include <linux/wait.h> 28#include <linux/wait.h>
29#include <linux/firmware.h> 29#include <linux/firmware.h>
30#include <linux/moduleparam.h> 30#include <linux/moduleparam.h>
31#include <linux/slab.h>
31#include <sound/core.h> 32#include <sound/core.h>
32#include <sound/snd_wavefront.h> 33#include <sound/snd_wavefront.h>
33#include <sound/initval.h> 34#include <sound/initval.h>