diff options
Diffstat (limited to 'sound/isa')
-rw-r--r-- | sound/isa/Kconfig | 22 | ||||
-rw-r--r-- | sound/isa/ad1816a/ad1816a.c | 8 | ||||
-rw-r--r-- | sound/isa/ad1848/ad1848.c | 167 | ||||
-rw-r--r-- | sound/isa/adlib.c | 122 | ||||
-rw-r--r-- | sound/isa/cmi8330.c | 115 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4231.c | 213 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4231_lib.c | 4 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4236.c | 131 | ||||
-rw-r--r-- | sound/isa/es1688/es1688.c | 251 | ||||
-rw-r--r-- | sound/isa/es18xx.c | 110 | ||||
-rw-r--r-- | sound/isa/gus/gusclassic.c | 292 | ||||
-rw-r--r-- | sound/isa/gus/gusextreme.c | 379 | ||||
-rw-r--r-- | sound/isa/gus/gusmax.c | 71 | ||||
-rw-r--r-- | sound/isa/gus/interwave.c | 101 | ||||
-rw-r--r-- | sound/isa/opl3sa2.c | 127 | ||||
-rw-r--r-- | sound/isa/opti9xx/miro.c | 80 | ||||
-rw-r--r-- | sound/isa/opti9xx/opti92x-ad1848.c | 108 | ||||
-rw-r--r-- | sound/isa/sb/sb16.c | 113 | ||||
-rw-r--r-- | sound/isa/sb/sb16_csp.c | 30 | ||||
-rw-r--r-- | sound/isa/sb/sb8.c | 90 | ||||
-rw-r--r-- | sound/isa/sgalaxy.c | 107 | ||||
-rw-r--r-- | sound/isa/sscape.c | 120 | ||||
-rw-r--r-- | sound/isa/wavefront/wavefront.c | 113 | ||||
-rw-r--r-- | sound/isa/wavefront/wavefront_fx.c | 23 |
24 files changed, 1199 insertions, 1698 deletions
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index 4e3a9729f56..cf3803cd579 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig | |||
@@ -358,12 +358,21 @@ config SND_SBAWE | |||
358 | config SND_SB16_CSP | 358 | config SND_SB16_CSP |
359 | bool "Sound Blaster 16/AWE CSP support" | 359 | bool "Sound Blaster 16/AWE CSP support" |
360 | depends on (SND_SB16 || SND_SBAWE) && (BROKEN || !PPC) | 360 | depends on (SND_SB16 || SND_SBAWE) && (BROKEN || !PPC) |
361 | select FW_LOADER | 361 | select FW_LOADER if !SND_SB16_CSP_FIRMWARE_IN_KERNEL |
362 | help | 362 | help |
363 | Say Y here to include support for the CSP core. This special | 363 | Say Y here to include support for the CSP core. This special |
364 | coprocessor can do variable tasks like various compression and | 364 | coprocessor can do variable tasks like various compression and |
365 | decompression algorithms. | 365 | decompression algorithms. |
366 | 366 | ||
367 | config SND_SB16_CSP_FIRMWARE_IN_KERNEL | ||
368 | bool "In-kernel firmware for SB16 CSP" | ||
369 | depends on SND_SB16_CSP | ||
370 | default y | ||
371 | help | ||
372 | Say Y here to include the static firmware built in the kernel | ||
373 | for the SB16 CSP controller. If you choose N here, you need | ||
374 | to install the firmware files from the alsa-firmware package. | ||
375 | |||
367 | config SND_SGALAXY | 376 | config SND_SGALAXY |
368 | tristate "Aztech Sound Galaxy" | 377 | tristate "Aztech Sound Galaxy" |
369 | depends on SND | 378 | depends on SND |
@@ -391,7 +400,7 @@ config SND_SSCAPE | |||
391 | config SND_WAVEFRONT | 400 | config SND_WAVEFRONT |
392 | tristate "Turtle Beach Maui,Tropez,Tropez+ (Wavefront)" | 401 | tristate "Turtle Beach Maui,Tropez,Tropez+ (Wavefront)" |
393 | depends on SND | 402 | depends on SND |
394 | select FW_LOADER | 403 | select FW_LOADER if !SND_WAVEFRONT_FIRMWARE_IN_KERNEL |
395 | select SND_OPL3_LIB | 404 | select SND_OPL3_LIB |
396 | select SND_MPU401_UART | 405 | select SND_MPU401_UART |
397 | select SND_CS4231_LIB | 406 | select SND_CS4231_LIB |
@@ -402,4 +411,13 @@ config SND_WAVEFRONT | |||
402 | To compile this driver as a module, choose M here: the module | 411 | To compile this driver as a module, choose M here: the module |
403 | will be called snd-wavefront. | 412 | will be called snd-wavefront. |
404 | 413 | ||
414 | config SND_WAVEFRONT_FIRMWARE_IN_KERNEL | ||
415 | bool "In-kernel firmware for Wavefront" | ||
416 | depends on SND_WAVEFRONT | ||
417 | default y | ||
418 | help | ||
419 | Say Y here to include the static firmware built in the kernel | ||
420 | for the Wavefront driver. If you choose N here, you need to | ||
421 | install the firmware files from the alsa-firmware package. | ||
422 | |||
405 | endmenu | 423 | endmenu |
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index 59034507175..fc88a31da6f 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c | |||
@@ -129,8 +129,8 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar | |||
129 | } | 129 | } |
130 | acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL); | 130 | acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL); |
131 | if (acard->devmpu == NULL) { | 131 | if (acard->devmpu == NULL) { |
132 | kfree(cfg); | 132 | mpu_port[dev] = -1; |
133 | return -EBUSY; | 133 | snd_printk(KERN_WARNING PFX "MPU401 device busy, skipping.\n"); |
134 | } | 134 | } |
135 | 135 | ||
136 | pdev = acard->dev; | 136 | pdev = acard->dev; |
@@ -162,6 +162,10 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar | |||
162 | dma2[dev] = pnp_dma(pdev, 1); | 162 | dma2[dev] = pnp_dma(pdev, 1); |
163 | irq[dev] = pnp_irq(pdev, 0); | 163 | irq[dev] = pnp_irq(pdev, 0); |
164 | 164 | ||
165 | if (acard->devmpu == NULL) { | ||
166 | kfree(cfg); | ||
167 | return 0; | ||
168 | } | ||
165 | pdev = acard->devmpu; | 169 | pdev = acard->devmpu; |
166 | pnp_init_resource_table(cfg); | 170 | pnp_init_resource_table(cfg); |
167 | 171 | ||
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c index 74e501dea8b..d09a7fa8654 100644 --- a/sound/isa/ad1848/ad1848.c +++ b/sound/isa/ad1848/ad1848.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <sound/driver.h> | 24 | #include <sound/driver.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/isa.h> |
28 | #include <linux/time.h> | 28 | #include <linux/time.h> |
29 | #include <linux/wait.h> | 29 | #include <linux/wait.h> |
30 | #include <linux/moduleparam.h> | 30 | #include <linux/moduleparam.h> |
@@ -32,8 +32,11 @@ | |||
32 | #include <sound/ad1848.h> | 32 | #include <sound/ad1848.h> |
33 | #include <sound/initval.h> | 33 | #include <sound/initval.h> |
34 | 34 | ||
35 | #define CRD_NAME "Generic AD1848/AD1847/CS4248" | ||
36 | #define DEV_NAME "ad1848" | ||
37 | |||
38 | MODULE_DESCRIPTION(CRD_NAME); | ||
35 | MODULE_AUTHOR("Tugrul Galatali <galatalt@stuy.edu>, Jaroslav Kysela <perex@suse.cz>"); | 39 | MODULE_AUTHOR("Tugrul Galatali <galatalt@stuy.edu>, Jaroslav Kysela <perex@suse.cz>"); |
36 | MODULE_DESCRIPTION("AD1848/AD1847/CS4248"); | ||
37 | MODULE_LICENSE("GPL"); | 40 | MODULE_LICENSE("GPL"); |
38 | MODULE_SUPPORTED_DEVICE("{{Analog Devices,AD1848}," | 41 | MODULE_SUPPORTED_DEVICE("{{Analog Devices,AD1848}," |
39 | "{Analog Devices,AD1847}," | 42 | "{Analog Devices,AD1847}," |
@@ -48,95 +51,98 @@ static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ | |||
48 | static int thinkpad[SNDRV_CARDS]; /* Thinkpad special case */ | 51 | static int thinkpad[SNDRV_CARDS]; /* Thinkpad special case */ |
49 | 52 | ||
50 | module_param_array(index, int, NULL, 0444); | 53 | module_param_array(index, int, NULL, 0444); |
51 | MODULE_PARM_DESC(index, "Index value for AD1848 soundcard."); | 54 | MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard."); |
52 | module_param_array(id, charp, NULL, 0444); | 55 | module_param_array(id, charp, NULL, 0444); |
53 | MODULE_PARM_DESC(id, "ID string for AD1848 soundcard."); | 56 | MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard."); |
54 | module_param_array(enable, bool, NULL, 0444); | 57 | module_param_array(enable, bool, NULL, 0444); |
55 | MODULE_PARM_DESC(enable, "Enable AD1848 soundcard."); | 58 | MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); |
56 | module_param_array(port, long, NULL, 0444); | 59 | module_param_array(port, long, NULL, 0444); |
57 | MODULE_PARM_DESC(port, "Port # for AD1848 driver."); | 60 | MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); |
58 | module_param_array(irq, int, NULL, 0444); | 61 | module_param_array(irq, int, NULL, 0444); |
59 | MODULE_PARM_DESC(irq, "IRQ # for AD1848 driver."); | 62 | MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); |
60 | module_param_array(dma1, int, NULL, 0444); | 63 | module_param_array(dma1, int, NULL, 0444); |
61 | MODULE_PARM_DESC(dma1, "DMA1 # for AD1848 driver."); | 64 | MODULE_PARM_DESC(dma1, "DMA1 # for " CRD_NAME " driver."); |
62 | module_param_array(thinkpad, bool, NULL, 0444); | 65 | module_param_array(thinkpad, bool, NULL, 0444); |
63 | MODULE_PARM_DESC(thinkpad, "Enable only for the onboard CS4248 of IBM Thinkpad 360/750/755 series."); | 66 | MODULE_PARM_DESC(thinkpad, "Enable only for the onboard CS4248 of IBM Thinkpad 360/750/755 series."); |
64 | 67 | ||
65 | static struct platform_device *devices[SNDRV_CARDS]; | 68 | static int __devinit snd_ad1848_match(struct device *dev, unsigned int n) |
69 | { | ||
70 | if (!enable[n]) | ||
71 | return 0; | ||
66 | 72 | ||
73 | if (port[n] == SNDRV_AUTO_PORT) { | ||
74 | snd_printk(KERN_ERR "%s: please specify port\n", dev->bus_id); | ||
75 | return 0; | ||
76 | } | ||
77 | if (irq[n] == SNDRV_AUTO_IRQ) { | ||
78 | snd_printk(KERN_ERR "%s: please specify irq\n", dev->bus_id); | ||
79 | return 0; | ||
80 | } | ||
81 | if (dma1[n] == SNDRV_AUTO_DMA) { | ||
82 | snd_printk(KERN_ERR "%s: please specify dma1\n", dev->bus_id); | ||
83 | return 0; | ||
84 | } | ||
85 | return 1; | ||
86 | } | ||
67 | 87 | ||
68 | static int __devinit snd_ad1848_probe(struct platform_device *pdev) | 88 | static int __devinit snd_ad1848_probe(struct device *dev, unsigned int n) |
69 | { | 89 | { |
70 | int dev = pdev->id; | ||
71 | struct snd_card *card; | 90 | struct snd_card *card; |
72 | struct snd_ad1848 *chip; | 91 | struct snd_ad1848 *chip; |
73 | struct snd_pcm *pcm; | 92 | struct snd_pcm *pcm; |
74 | int err; | 93 | int error; |
75 | 94 | ||
76 | if (port[dev] == SNDRV_AUTO_PORT) { | 95 | card = snd_card_new(index[n], id[n], THIS_MODULE, 0); |
77 | snd_printk(KERN_ERR "ad1848: specify port\n"); | 96 | if (!card) |
78 | return -EINVAL; | 97 | return -EINVAL; |
79 | } | ||
80 | if (irq[dev] == SNDRV_AUTO_IRQ) { | ||
81 | snd_printk(KERN_ERR "ad1848: specify irq\n"); | ||
82 | return -EINVAL; | ||
83 | } | ||
84 | if (dma1[dev] == SNDRV_AUTO_DMA) { | ||
85 | snd_printk(KERN_ERR "ad1848: specify dma1\n"); | ||
86 | return -EINVAL; | ||
87 | } | ||
88 | 98 | ||
89 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 99 | error = snd_ad1848_create(card, port[n], irq[n], dma1[n], |
90 | if (card == NULL) | 100 | thinkpad[n] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT, &chip); |
91 | return -ENOMEM; | 101 | if (error < 0) |
102 | goto out; | ||
92 | 103 | ||
93 | if ((err = snd_ad1848_create(card, port[dev], | ||
94 | irq[dev], | ||
95 | dma1[dev], | ||
96 | thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT, | ||
97 | &chip)) < 0) | ||
98 | goto _err; | ||
99 | card->private_data = chip; | 104 | card->private_data = chip; |
100 | 105 | ||
101 | if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0) | 106 | error = snd_ad1848_pcm(chip, 0, &pcm); |
102 | goto _err; | 107 | if (error < 0) |
108 | goto out; | ||
103 | 109 | ||
104 | if ((err = snd_ad1848_mixer(chip)) < 0) | 110 | error = snd_ad1848_mixer(chip); |
105 | goto _err; | 111 | if (error < 0) |
112 | goto out; | ||
106 | 113 | ||
107 | strcpy(card->driver, "AD1848"); | 114 | strcpy(card->driver, "AD1848"); |
108 | strcpy(card->shortname, pcm->name); | 115 | strcpy(card->shortname, pcm->name); |
109 | 116 | ||
110 | sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", | 117 | sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", |
111 | pcm->name, chip->port, irq[dev], dma1[dev]); | 118 | pcm->name, chip->port, irq[n], dma1[n]); |
112 | 119 | if (thinkpad[n]) | |
113 | if (thinkpad[dev]) | ||
114 | strcat(card->longname, " [Thinkpad]"); | 120 | strcat(card->longname, " [Thinkpad]"); |
115 | 121 | ||
116 | snd_card_set_dev(card, &pdev->dev); | 122 | snd_card_set_dev(card, dev); |
117 | 123 | ||
118 | if ((err = snd_card_register(card)) < 0) | 124 | error = snd_card_register(card); |
119 | goto _err; | 125 | if (error < 0) |
126 | goto out; | ||
120 | 127 | ||
121 | platform_set_drvdata(pdev, card); | 128 | dev_set_drvdata(dev, card); |
122 | return 0; | 129 | return 0; |
123 | 130 | ||
124 | _err: | 131 | out: snd_card_free(card); |
125 | snd_card_free(card); | 132 | return error; |
126 | return err; | ||
127 | } | 133 | } |
128 | 134 | ||
129 | static int __devexit snd_ad1848_remove(struct platform_device *devptr) | 135 | static int __devexit snd_ad1848_remove(struct device *dev, unsigned int n) |
130 | { | 136 | { |
131 | snd_card_free(platform_get_drvdata(devptr)); | 137 | snd_card_free(dev_get_drvdata(dev)); |
132 | platform_set_drvdata(devptr, NULL); | 138 | dev_set_drvdata(dev, NULL); |
133 | return 0; | 139 | return 0; |
134 | } | 140 | } |
135 | 141 | ||
136 | #ifdef CONFIG_PM | 142 | #ifdef CONFIG_PM |
137 | static int snd_ad1848_suspend(struct platform_device *pdev, pm_message_t state) | 143 | static int snd_ad1848_suspend(struct device *dev, unsigned int n, pm_message_t state) |
138 | { | 144 | { |
139 | struct snd_card *card = platform_get_drvdata(pdev); | 145 | struct snd_card *card = dev_get_drvdata(dev); |
140 | struct snd_ad1848 *chip = card->private_data; | 146 | struct snd_ad1848 *chip = card->private_data; |
141 | 147 | ||
142 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 148 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
@@ -144,9 +150,9 @@ static int snd_ad1848_suspend(struct platform_device *pdev, pm_message_t state) | |||
144 | return 0; | 150 | return 0; |
145 | } | 151 | } |
146 | 152 | ||
147 | static int snd_ad1848_resume(struct platform_device *pdev) | 153 | static int snd_ad1848_resume(struct device *dev, unsigned int n) |
148 | { | 154 | { |
149 | struct snd_card *card = platform_get_drvdata(pdev); | 155 | struct snd_card *card = dev_get_drvdata(dev); |
150 | struct snd_ad1848 *chip = card->private_data; | 156 | struct snd_ad1848 *chip = card->private_data; |
151 | 157 | ||
152 | chip->resume(chip); | 158 | chip->resume(chip); |
@@ -155,9 +161,8 @@ static int snd_ad1848_resume(struct platform_device *pdev) | |||
155 | } | 161 | } |
156 | #endif | 162 | #endif |
157 | 163 | ||
158 | #define SND_AD1848_DRIVER "snd_ad1848" | 164 | static struct isa_driver snd_ad1848_driver = { |
159 | 165 | .match = snd_ad1848_match, | |
160 | static struct platform_driver snd_ad1848_driver = { | ||
161 | .probe = snd_ad1848_probe, | 166 | .probe = snd_ad1848_probe, |
162 | .remove = __devexit_p(snd_ad1848_remove), | 167 | .remove = __devexit_p(snd_ad1848_remove), |
163 | #ifdef CONFIG_PM | 168 | #ifdef CONFIG_PM |
@@ -165,57 +170,19 @@ static struct platform_driver snd_ad1848_driver = { | |||
165 | .resume = snd_ad1848_resume, | 170 | .resume = snd_ad1848_resume, |
166 | #endif | 171 | #endif |
167 | .driver = { | 172 | .driver = { |
168 | .name = SND_AD1848_DRIVER | 173 | .name = DEV_NAME |
169 | }, | 174 | } |
170 | }; | 175 | }; |
171 | 176 | ||
172 | static void __init_or_module snd_ad1848_unregister_all(void) | ||
173 | { | ||
174 | int i; | ||
175 | |||
176 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
177 | platform_device_unregister(devices[i]); | ||
178 | platform_driver_unregister(&snd_ad1848_driver); | ||
179 | } | ||
180 | |||
181 | static int __init alsa_card_ad1848_init(void) | 177 | static int __init alsa_card_ad1848_init(void) |
182 | { | 178 | { |
183 | int i, cards, err; | 179 | return isa_register_driver(&snd_ad1848_driver, SNDRV_CARDS); |
184 | |||
185 | err = platform_driver_register(&snd_ad1848_driver); | ||
186 | if (err < 0) | ||
187 | return err; | ||
188 | |||
189 | cards = 0; | ||
190 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
191 | struct platform_device *device; | ||
192 | if (! enable[i]) | ||
193 | continue; | ||
194 | device = platform_device_register_simple(SND_AD1848_DRIVER, | ||
195 | i, NULL, 0); | ||
196 | if (IS_ERR(device)) | ||
197 | continue; | ||
198 | if (!platform_get_drvdata(device)) { | ||
199 | platform_device_unregister(device); | ||
200 | continue; | ||
201 | } | ||
202 | devices[i] = device; | ||
203 | cards++; | ||
204 | } | ||
205 | if (!cards) { | ||
206 | #ifdef MODULE | ||
207 | printk(KERN_ERR "AD1848 soundcard not found or device busy\n"); | ||
208 | #endif | ||
209 | snd_ad1848_unregister_all(); | ||
210 | return -ENODEV; | ||
211 | } | ||
212 | return 0; | ||
213 | } | 180 | } |
214 | 181 | ||
215 | static void __exit alsa_card_ad1848_exit(void) | 182 | static void __exit alsa_card_ad1848_exit(void) |
216 | { | 183 | { |
217 | snd_ad1848_unregister_all(); | 184 | isa_unregister_driver(&snd_ad1848_driver); |
218 | } | 185 | } |
219 | 186 | ||
220 | module_init(alsa_card_ad1848_init) | 187 | module_init(alsa_card_ad1848_init); |
221 | module_exit(alsa_card_ad1848_exit) | 188 | module_exit(alsa_card_ad1848_exit); |
diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c index 1124344ed94..d68720724c9 100644 --- a/sound/isa/adlib.c +++ b/sound/isa/adlib.c | |||
@@ -5,13 +5,13 @@ | |||
5 | #include <sound/driver.h> | 5 | #include <sound/driver.h> |
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/platform_device.h> | 8 | #include <linux/isa.h> |
9 | #include <sound/core.h> | 9 | #include <sound/core.h> |
10 | #include <sound/initval.h> | 10 | #include <sound/initval.h> |
11 | #include <sound/opl3.h> | 11 | #include <sound/opl3.h> |
12 | 12 | ||
13 | #define CRD_NAME "AdLib FM" | 13 | #define CRD_NAME "AdLib FM" |
14 | #define DRV_NAME "snd_adlib" | 14 | #define DEV_NAME "adlib" |
15 | 15 | ||
16 | MODULE_DESCRIPTION(CRD_NAME); | 16 | MODULE_DESCRIPTION(CRD_NAME); |
17 | MODULE_AUTHOR("Rene Herman"); | 17 | MODULE_AUTHOR("Rene Herman"); |
@@ -31,133 +31,99 @@ MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); | |||
31 | module_param_array(port, long, NULL, 0444); | 31 | module_param_array(port, long, NULL, 0444); |
32 | MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); | 32 | MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); |
33 | 33 | ||
34 | static struct platform_device *devices[SNDRV_CARDS]; | 34 | static int __devinit snd_adlib_match(struct device *dev, unsigned int n) |
35 | { | ||
36 | if (!enable[n]) | ||
37 | return 0; | ||
38 | |||
39 | if (port[n] == SNDRV_AUTO_PORT) { | ||
40 | snd_printk(KERN_ERR "%s: please specify port\n", dev->bus_id); | ||
41 | return 0; | ||
42 | } | ||
43 | return 1; | ||
44 | } | ||
35 | 45 | ||
36 | static void snd_adlib_free(struct snd_card *card) | 46 | static void snd_adlib_free(struct snd_card *card) |
37 | { | 47 | { |
38 | release_and_free_resource(card->private_data); | 48 | release_and_free_resource(card->private_data); |
39 | } | 49 | } |
40 | 50 | ||
41 | static int __devinit snd_adlib_probe(struct platform_device *device) | 51 | static int __devinit snd_adlib_probe(struct device *dev, unsigned int n) |
42 | { | 52 | { |
43 | struct snd_card *card; | 53 | struct snd_card *card; |
44 | struct snd_opl3 *opl3; | 54 | struct snd_opl3 *opl3; |
55 | int error; | ||
45 | 56 | ||
46 | int error, i = device->id; | 57 | card = snd_card_new(index[n], id[n], THIS_MODULE, 0); |
47 | |||
48 | if (port[i] == SNDRV_AUTO_PORT) { | ||
49 | snd_printk(KERN_ERR DRV_NAME ": please specify port\n"); | ||
50 | error = -EINVAL; | ||
51 | goto out0; | ||
52 | } | ||
53 | |||
54 | card = snd_card_new(index[i], id[i], THIS_MODULE, 0); | ||
55 | if (!card) { | 58 | if (!card) { |
56 | snd_printk(KERN_ERR DRV_NAME ": could not create card\n"); | 59 | snd_printk(KERN_ERR "%s: could not create card\n", dev->bus_id); |
57 | error = -EINVAL; | 60 | return -EINVAL; |
58 | goto out0; | ||
59 | } | 61 | } |
60 | 62 | ||
61 | card->private_data = request_region(port[i], 4, CRD_NAME); | 63 | card->private_data = request_region(port[n], 4, CRD_NAME); |
62 | if (!card->private_data) { | 64 | if (!card->private_data) { |
63 | snd_printk(KERN_ERR DRV_NAME ": could not grab ports\n"); | 65 | snd_printk(KERN_ERR "%s: could not grab ports\n", dev->bus_id); |
64 | error = -EBUSY; | 66 | error = -EBUSY; |
65 | goto out1; | 67 | goto out; |
66 | } | 68 | } |
67 | card->private_free = snd_adlib_free; | 69 | card->private_free = snd_adlib_free; |
68 | 70 | ||
69 | error = snd_opl3_create(card, port[i], port[i] + 2, OPL3_HW_AUTO, 1, &opl3); | 71 | strcpy(card->driver, DEV_NAME); |
72 | strcpy(card->shortname, CRD_NAME); | ||
73 | sprintf(card->longname, CRD_NAME " at %#lx", port[n]); | ||
74 | |||
75 | error = snd_opl3_create(card, port[n], port[n] + 2, OPL3_HW_AUTO, 1, &opl3); | ||
70 | if (error < 0) { | 76 | if (error < 0) { |
71 | snd_printk(KERN_ERR DRV_NAME ": could not create OPL\n"); | 77 | snd_printk(KERN_ERR "%s: could not create OPL\n", dev->bus_id); |
72 | goto out1; | 78 | goto out; |
73 | } | 79 | } |
74 | 80 | ||
75 | error = snd_opl3_hwdep_new(opl3, 0, 0, NULL); | 81 | error = snd_opl3_hwdep_new(opl3, 0, 0, NULL); |
76 | if (error < 0) { | 82 | if (error < 0) { |
77 | snd_printk(KERN_ERR DRV_NAME ": could not create FM\n"); | 83 | snd_printk(KERN_ERR "%s: could not create FM\n", dev->bus_id); |
78 | goto out1; | 84 | goto out; |
79 | } | 85 | } |
80 | 86 | ||
81 | strcpy(card->driver, DRV_NAME); | 87 | snd_card_set_dev(card, dev); |
82 | strcpy(card->shortname, CRD_NAME); | ||
83 | sprintf(card->longname, CRD_NAME " at %#lx", port[i]); | ||
84 | |||
85 | snd_card_set_dev(card, &device->dev); | ||
86 | 88 | ||
87 | error = snd_card_register(card); | 89 | error = snd_card_register(card); |
88 | if (error < 0) { | 90 | if (error < 0) { |
89 | snd_printk(KERN_ERR DRV_NAME ": could not register card\n"); | 91 | snd_printk(KERN_ERR "%s: could not register card\n", dev->bus_id); |
90 | goto out1; | 92 | goto out; |
91 | } | 93 | } |
92 | 94 | ||
93 | platform_set_drvdata(device, card); | 95 | dev_set_drvdata(dev, card); |
94 | return 0; | 96 | return 0; |
95 | 97 | ||
96 | out1: snd_card_free(card); | 98 | out: snd_card_free(card); |
97 | out0: return error; | 99 | return error; |
98 | } | 100 | } |
99 | 101 | ||
100 | static int __devexit snd_adlib_remove(struct platform_device *device) | 102 | static int __devexit snd_adlib_remove(struct device *dev, unsigned int n) |
101 | { | 103 | { |
102 | snd_card_free(platform_get_drvdata(device)); | 104 | snd_card_free(dev_get_drvdata(dev)); |
103 | platform_set_drvdata(device, NULL); | 105 | dev_set_drvdata(dev, NULL); |
104 | return 0; | 106 | return 0; |
105 | } | 107 | } |
106 | 108 | ||
107 | static struct platform_driver snd_adlib_driver = { | 109 | static struct isa_driver snd_adlib_driver = { |
110 | .match = snd_adlib_match, | ||
108 | .probe = snd_adlib_probe, | 111 | .probe = snd_adlib_probe, |
109 | .remove = __devexit_p(snd_adlib_remove), | 112 | .remove = __devexit_p(snd_adlib_remove), |
110 | 113 | ||
111 | .driver = { | 114 | .driver = { |
112 | .name = DRV_NAME | 115 | .name = DEV_NAME |
113 | } | 116 | } |
114 | }; | 117 | }; |
115 | 118 | ||
116 | static int __init alsa_card_adlib_init(void) | 119 | static int __init alsa_card_adlib_init(void) |
117 | { | 120 | { |
118 | int i, cards; | 121 | return isa_register_driver(&snd_adlib_driver, SNDRV_CARDS); |
119 | |||
120 | if (platform_driver_register(&snd_adlib_driver) < 0) { | ||
121 | snd_printk(KERN_ERR DRV_NAME ": could not register driver\n"); | ||
122 | return -ENODEV; | ||
123 | } | ||
124 | |||
125 | for (cards = 0, i = 0; i < SNDRV_CARDS; i++) { | ||
126 | struct platform_device *device; | ||
127 | |||
128 | if (!enable[i]) | ||
129 | continue; | ||
130 | |||
131 | device = platform_device_register_simple(DRV_NAME, i, NULL, 0); | ||
132 | if (IS_ERR(device)) | ||
133 | continue; | ||
134 | |||
135 | if (!platform_get_drvdata(device)) { | ||
136 | platform_device_unregister(device); | ||
137 | continue; | ||
138 | } | ||
139 | |||
140 | devices[i] = device; | ||
141 | cards++; | ||
142 | } | ||
143 | |||
144 | if (!cards) { | ||
145 | #ifdef MODULE | ||
146 | printk(KERN_ERR CRD_NAME " soundcard not found or device busy\n"); | ||
147 | #endif | ||
148 | platform_driver_unregister(&snd_adlib_driver); | ||
149 | return -ENODEV; | ||
150 | } | ||
151 | return 0; | ||
152 | } | 122 | } |
153 | 123 | ||
154 | static void __exit alsa_card_adlib_exit(void) | 124 | static void __exit alsa_card_adlib_exit(void) |
155 | { | 125 | { |
156 | int i; | 126 | isa_unregister_driver(&snd_adlib_driver); |
157 | |||
158 | for (i = 0; i < SNDRV_CARDS; i++) | ||
159 | platform_device_unregister(devices[i]); | ||
160 | platform_driver_unregister(&snd_adlib_driver); | ||
161 | } | 127 | } |
162 | 128 | ||
163 | module_init(alsa_card_adlib_init); | 129 | module_init(alsa_card_adlib_init); |
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index c09a8009d2f..214d65d94c4 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <sound/driver.h> | 46 | #include <sound/driver.h> |
47 | #include <linux/init.h> | 47 | #include <linux/init.h> |
48 | #include <linux/err.h> | 48 | #include <linux/err.h> |
49 | #include <linux/platform_device.h> | 49 | #include <linux/isa.h> |
50 | #include <linux/slab.h> | 50 | #include <linux/slab.h> |
51 | #include <linux/pnp.h> | 51 | #include <linux/pnp.h> |
52 | #include <linux/moduleparam.h> | 52 | #include <linux/moduleparam.h> |
@@ -108,7 +108,6 @@ MODULE_PARM_DESC(wssirq, "IRQ # for CMI8330 WSS driver."); | |||
108 | module_param_array(wssdma, int, NULL, 0444); | 108 | module_param_array(wssdma, int, NULL, 0444); |
109 | MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver."); | 109 | MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver."); |
110 | 110 | ||
111 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
112 | #ifdef CONFIG_PNP | 111 | #ifdef CONFIG_PNP |
113 | static int pnp_registered; | 112 | static int pnp_registered; |
114 | #endif | 113 | #endif |
@@ -547,70 +546,78 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) | |||
547 | return snd_card_register(card); | 546 | return snd_card_register(card); |
548 | } | 547 | } |
549 | 548 | ||
550 | static int __devinit snd_cmi8330_nonpnp_probe(struct platform_device *pdev) | 549 | static int __devinit snd_cmi8330_isa_match(struct device *pdev, |
550 | unsigned int dev) | ||
551 | { | 551 | { |
552 | struct snd_card *card; | 552 | if (!enable[dev] || is_isapnp_selected(dev)) |
553 | int err; | 553 | return 0; |
554 | int dev = pdev->id; | ||
555 | |||
556 | if (wssport[dev] == SNDRV_AUTO_PORT) { | 554 | if (wssport[dev] == SNDRV_AUTO_PORT) { |
557 | snd_printk(KERN_ERR PFX "specify wssport\n"); | 555 | snd_printk(KERN_ERR PFX "specify wssport\n"); |
558 | return -EINVAL; | 556 | return 0; |
559 | } | 557 | } |
560 | if (sbport[dev] == SNDRV_AUTO_PORT) { | 558 | if (sbport[dev] == SNDRV_AUTO_PORT) { |
561 | snd_printk(KERN_ERR PFX "specify sbport\n"); | 559 | snd_printk(KERN_ERR PFX "specify sbport\n"); |
562 | return -EINVAL; | 560 | return 0; |
563 | } | 561 | } |
562 | return 1; | ||
563 | } | ||
564 | |||
565 | static int __devinit snd_cmi8330_isa_probe(struct device *pdev, | ||
566 | unsigned int dev) | ||
567 | { | ||
568 | struct snd_card *card; | ||
569 | int err; | ||
564 | 570 | ||
565 | card = snd_cmi8330_card_new(dev); | 571 | card = snd_cmi8330_card_new(dev); |
566 | if (! card) | 572 | if (! card) |
567 | return -ENOMEM; | 573 | return -ENOMEM; |
568 | snd_card_set_dev(card, &pdev->dev); | 574 | snd_card_set_dev(card, pdev); |
569 | if ((err = snd_cmi8330_probe(card, dev)) < 0) { | 575 | if ((err = snd_cmi8330_probe(card, dev)) < 0) { |
570 | snd_card_free(card); | 576 | snd_card_free(card); |
571 | return err; | 577 | return err; |
572 | } | 578 | } |
573 | platform_set_drvdata(pdev, card); | 579 | dev_set_drvdata(pdev, card); |
574 | return 0; | 580 | return 0; |
575 | } | 581 | } |
576 | 582 | ||
577 | static int __devexit snd_cmi8330_nonpnp_remove(struct platform_device *devptr) | 583 | static int __devexit snd_cmi8330_isa_remove(struct device *devptr, |
584 | unsigned int dev) | ||
578 | { | 585 | { |
579 | snd_card_free(platform_get_drvdata(devptr)); | 586 | snd_card_free(dev_get_drvdata(devptr)); |
580 | platform_set_drvdata(devptr, NULL); | 587 | dev_set_drvdata(devptr, NULL); |
581 | return 0; | 588 | return 0; |
582 | } | 589 | } |
583 | 590 | ||
584 | #ifdef CONFIG_PM | 591 | #ifdef CONFIG_PM |
585 | static int snd_cmi8330_nonpnp_suspend(struct platform_device *dev, pm_message_t state) | 592 | static int snd_cmi8330_isa_suspend(struct device *dev, unsigned int n, |
593 | pm_message_t state) | ||
586 | { | 594 | { |
587 | return snd_cmi8330_suspend(platform_get_drvdata(dev)); | 595 | return snd_cmi8330_suspend(dev_get_drvdata(dev)); |
588 | } | 596 | } |
589 | 597 | ||
590 | static int snd_cmi8330_nonpnp_resume(struct platform_device *dev) | 598 | static int snd_cmi8330_isa_resume(struct device *dev, unsigned int n) |
591 | { | 599 | { |
592 | return snd_cmi8330_resume(platform_get_drvdata(dev)); | 600 | return snd_cmi8330_resume(dev_get_drvdata(dev)); |
593 | } | 601 | } |
594 | #endif | 602 | #endif |
595 | 603 | ||
596 | #define CMI8330_DRIVER "snd_cmi8330" | 604 | #define DEV_NAME "cmi8330" |
597 | 605 | ||
598 | static struct platform_driver snd_cmi8330_driver = { | 606 | static struct isa_driver snd_cmi8330_driver = { |
599 | .probe = snd_cmi8330_nonpnp_probe, | 607 | .match = snd_cmi8330_isa_match, |
600 | .remove = __devexit_p(snd_cmi8330_nonpnp_remove), | 608 | .probe = snd_cmi8330_isa_probe, |
609 | .remove = __devexit_p(snd_cmi8330_isa_remove), | ||
601 | #ifdef CONFIG_PM | 610 | #ifdef CONFIG_PM |
602 | .suspend = snd_cmi8330_nonpnp_suspend, | 611 | .suspend = snd_cmi8330_isa_suspend, |
603 | .resume = snd_cmi8330_nonpnp_resume, | 612 | .resume = snd_cmi8330_isa_resume, |
604 | #endif | 613 | #endif |
605 | .driver = { | 614 | .driver = { |
606 | .name = CMI8330_DRIVER | 615 | .name = DEV_NAME |
607 | }, | 616 | }, |
608 | }; | 617 | }; |
609 | 618 | ||
610 | 619 | ||
611 | #ifdef CONFIG_PNP | 620 | #ifdef CONFIG_PNP |
612 | static unsigned int __devinitdata cmi8330_pnp_devices; | ||
613 | |||
614 | static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, | 621 | static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, |
615 | const struct pnp_card_device_id *pid) | 622 | const struct pnp_card_device_id *pid) |
616 | { | 623 | { |
@@ -640,7 +647,6 @@ static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, | |||
640 | } | 647 | } |
641 | pnp_set_card_drvdata(pcard, card); | 648 | pnp_set_card_drvdata(pcard, card); |
642 | dev++; | 649 | dev++; |
643 | cmi8330_pnp_devices++; | ||
644 | return 0; | 650 | return 0; |
645 | } | 651 | } |
646 | 652 | ||
@@ -675,63 +681,28 @@ static struct pnp_card_driver cmi8330_pnpc_driver = { | |||
675 | }; | 681 | }; |
676 | #endif /* CONFIG_PNP */ | 682 | #endif /* CONFIG_PNP */ |
677 | 683 | ||
678 | static void __init_or_module snd_cmi8330_unregister_all(void) | ||
679 | { | ||
680 | int i; | ||
681 | |||
682 | #ifdef CONFIG_PNP | ||
683 | if (pnp_registered) | ||
684 | pnp_unregister_card_driver(&cmi8330_pnpc_driver); | ||
685 | #endif | ||
686 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
687 | platform_device_unregister(platform_devices[i]); | ||
688 | platform_driver_unregister(&snd_cmi8330_driver); | ||
689 | } | ||
690 | |||
691 | static int __init alsa_card_cmi8330_init(void) | 684 | static int __init alsa_card_cmi8330_init(void) |
692 | { | 685 | { |
693 | int i, err, cards = 0; | 686 | int err; |
694 | 687 | ||
695 | if ((err = platform_driver_register(&snd_cmi8330_driver)) < 0) | 688 | err = isa_register_driver(&snd_cmi8330_driver, SNDRV_CARDS); |
689 | if (err < 0) | ||
696 | return err; | 690 | return err; |
697 | |||
698 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
699 | struct platform_device *device; | ||
700 | if (! enable[i] || is_isapnp_selected(i)) | ||
701 | continue; | ||
702 | device = platform_device_register_simple(CMI8330_DRIVER, | ||
703 | i, NULL, 0); | ||
704 | if (IS_ERR(device)) | ||
705 | continue; | ||
706 | if (!platform_get_drvdata(device)) { | ||
707 | platform_device_unregister(device); | ||
708 | continue; | ||
709 | } | ||
710 | platform_devices[i] = device; | ||
711 | cards++; | ||
712 | } | ||
713 | |||
714 | #ifdef CONFIG_PNP | 691 | #ifdef CONFIG_PNP |
715 | err = pnp_register_card_driver(&cmi8330_pnpc_driver); | 692 | err = pnp_register_card_driver(&cmi8330_pnpc_driver); |
716 | if (!err) { | 693 | if (!err) |
717 | pnp_registered = 1; | 694 | pnp_registered = 1; |
718 | cards += cmi8330_pnp_devices; | ||
719 | } | ||
720 | #endif | 695 | #endif |
721 | |||
722 | if (!cards) { | ||
723 | #ifdef MODULE | ||
724 | snd_printk(KERN_ERR "CMI8330 not found or device busy\n"); | ||
725 | #endif | ||
726 | snd_cmi8330_unregister_all(); | ||
727 | return -ENODEV; | ||
728 | } | ||
729 | return 0; | 696 | return 0; |
730 | } | 697 | } |
731 | 698 | ||
732 | static void __exit alsa_card_cmi8330_exit(void) | 699 | static void __exit alsa_card_cmi8330_exit(void) |
733 | { | 700 | { |
734 | snd_cmi8330_unregister_all(); | 701 | #ifdef CONFIG_PNP |
702 | if (pnp_registered) | ||
703 | pnp_unregister_card_driver(&cmi8330_pnpc_driver); | ||
704 | #endif | ||
705 | isa_unregister_driver(&snd_cmi8330_driver); | ||
735 | } | 706 | } |
736 | 707 | ||
737 | module_init(alsa_card_cmi8330_init) | 708 | module_init(alsa_card_cmi8330_init) |
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c index 696a5c86bcf..ac404113415 100644 --- a/sound/isa/cs423x/cs4231.c +++ b/sound/isa/cs423x/cs4231.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <sound/driver.h> | 23 | #include <sound/driver.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/isa.h> |
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/wait.h> | 28 | #include <linux/wait.h> |
29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
@@ -32,8 +32,11 @@ | |||
32 | #include <sound/mpu401.h> | 32 | #include <sound/mpu401.h> |
33 | #include <sound/initval.h> | 33 | #include <sound/initval.h> |
34 | 34 | ||
35 | #define CRD_NAME "Generic CS4231" | ||
36 | #define DEV_NAME "cs4231" | ||
37 | |||
38 | MODULE_DESCRIPTION(CRD_NAME); | ||
35 | MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); | 39 | MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); |
36 | MODULE_DESCRIPTION("Generic CS4231"); | ||
37 | MODULE_LICENSE("GPL"); | 40 | MODULE_LICENSE("GPL"); |
38 | MODULE_SUPPORTED_DEVICE("{{Crystal Semiconductors,CS4231}}"); | 41 | MODULE_SUPPORTED_DEVICE("{{Crystal Semiconductors,CS4231}}"); |
39 | 42 | ||
@@ -48,132 +51,136 @@ static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ | |||
48 | static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ | 51 | static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ |
49 | 52 | ||
50 | module_param_array(index, int, NULL, 0444); | 53 | module_param_array(index, int, NULL, 0444); |
51 | MODULE_PARM_DESC(index, "Index value for CS4231 soundcard."); | 54 | MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard."); |
52 | module_param_array(id, charp, NULL, 0444); | 55 | module_param_array(id, charp, NULL, 0444); |
53 | MODULE_PARM_DESC(id, "ID string for CS4231 soundcard."); | 56 | MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard."); |
54 | module_param_array(enable, bool, NULL, 0444); | 57 | module_param_array(enable, bool, NULL, 0444); |
55 | MODULE_PARM_DESC(enable, "Enable CS4231 soundcard."); | 58 | MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); |
56 | module_param_array(port, long, NULL, 0444); | 59 | module_param_array(port, long, NULL, 0444); |
57 | MODULE_PARM_DESC(port, "Port # for CS4231 driver."); | 60 | MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); |
58 | module_param_array(mpu_port, long, NULL, 0444); | 61 | module_param_array(mpu_port, long, NULL, 0444); |
59 | MODULE_PARM_DESC(mpu_port, "MPU-401 port # for CS4231 driver."); | 62 | MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " CRD_NAME " driver."); |
60 | module_param_array(irq, int, NULL, 0444); | 63 | module_param_array(irq, int, NULL, 0444); |
61 | MODULE_PARM_DESC(irq, "IRQ # for CS4231 driver."); | 64 | MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); |
62 | module_param_array(mpu_irq, int, NULL, 0444); | 65 | module_param_array(mpu_irq, int, NULL, 0444); |
63 | MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for CS4231 driver."); | 66 | MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver."); |
64 | module_param_array(dma1, int, NULL, 0444); | 67 | module_param_array(dma1, int, NULL, 0444); |
65 | MODULE_PARM_DESC(dma1, "DMA1 # for CS4231 driver."); | 68 | MODULE_PARM_DESC(dma1, "DMA1 # for " CRD_NAME " driver."); |
66 | module_param_array(dma2, int, NULL, 0444); | 69 | module_param_array(dma2, int, NULL, 0444); |
67 | MODULE_PARM_DESC(dma2, "DMA2 # for CS4231 driver."); | 70 | MODULE_PARM_DESC(dma2, "DMA2 # for " CRD_NAME " driver."); |
68 | 71 | ||
69 | static struct platform_device *devices[SNDRV_CARDS]; | 72 | static int __devinit snd_cs4231_match(struct device *dev, unsigned int n) |
73 | { | ||
74 | if (!enable[n]) | ||
75 | return 0; | ||
70 | 76 | ||
77 | if (port[n] == SNDRV_AUTO_PORT) { | ||
78 | snd_printk(KERN_ERR "%s: please specify port\n", dev->bus_id); | ||
79 | return 0; | ||
80 | } | ||
81 | if (irq[n] == SNDRV_AUTO_IRQ) { | ||
82 | snd_printk(KERN_ERR "%s: please specify irq\n", dev->bus_id); | ||
83 | return 0; | ||
84 | } | ||
85 | if (dma1[n] == SNDRV_AUTO_DMA) { | ||
86 | snd_printk(KERN_ERR "%s: please specify dma1\n", dev->bus_id); | ||
87 | return 0; | ||
88 | } | ||
89 | return 1; | ||
90 | } | ||
71 | 91 | ||
72 | static int __init snd_cs4231_probe(struct platform_device *pdev) | 92 | static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n) |
73 | { | 93 | { |
74 | int dev = pdev->id; | ||
75 | struct snd_card *card; | 94 | struct snd_card *card; |
76 | struct snd_pcm *pcm; | ||
77 | struct snd_cs4231 *chip; | 95 | struct snd_cs4231 *chip; |
78 | int err; | 96 | struct snd_pcm *pcm; |
97 | int error; | ||
79 | 98 | ||
80 | if (port[dev] == SNDRV_AUTO_PORT) { | 99 | card = snd_card_new(index[n], id[n], THIS_MODULE, 0); |
81 | snd_printk(KERN_ERR "specify port\n"); | 100 | if (!card) |
82 | return -EINVAL; | ||
83 | } | ||
84 | if (irq[dev] == SNDRV_AUTO_IRQ) { | ||
85 | snd_printk(KERN_ERR "specify irq\n"); | ||
86 | return -EINVAL; | ||
87 | } | ||
88 | if (dma1[dev] == SNDRV_AUTO_DMA) { | ||
89 | snd_printk(KERN_ERR "specify dma1\n"); | ||
90 | return -EINVAL; | 101 | return -EINVAL; |
91 | } | 102 | |
92 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 103 | error = snd_cs4231_create(card, port[n], -1, irq[n], dma1[n], dma2[n], |
93 | if (card == NULL) | 104 | CS4231_HW_DETECT, 0, &chip); |
94 | return -ENOMEM; | 105 | if (error < 0) |
95 | if ((err = snd_cs4231_create(card, port[dev], -1, | 106 | goto out; |
96 | irq[dev], | 107 | |
97 | dma1[dev], | ||
98 | dma2[dev], | ||
99 | CS4231_HW_DETECT, | ||
100 | 0, &chip)) < 0) | ||
101 | goto _err; | ||
102 | card->private_data = chip; | 108 | card->private_data = chip; |
103 | 109 | ||
104 | if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) | 110 | error = snd_cs4231_pcm(chip, 0, &pcm); |
105 | goto _err; | 111 | if (error < 0) |
112 | goto out; | ||
106 | 113 | ||
107 | strcpy(card->driver, "CS4231"); | 114 | strcpy(card->driver, "CS4231"); |
108 | strcpy(card->shortname, pcm->name); | 115 | strcpy(card->shortname, pcm->name); |
116 | |||
109 | sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", | 117 | sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", |
110 | pcm->name, chip->port, irq[dev], dma1[dev]); | 118 | pcm->name, chip->port, irq[n], dma1[n]); |
111 | if (dma2[dev] >= 0) | 119 | if (dma2[n] >= 0) |
112 | sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); | 120 | sprintf(card->longname + strlen(card->longname), "&%d", dma2[n]); |
113 | 121 | ||
114 | if ((err = snd_cs4231_mixer(chip)) < 0) | 122 | error = snd_cs4231_mixer(chip); |
115 | goto _err; | 123 | if (error < 0) |
116 | if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) | 124 | goto out; |
117 | goto _err; | 125 | |
118 | 126 | error = snd_cs4231_timer(chip, 0, NULL); | |
119 | if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { | 127 | if (error < 0) |
120 | if (mpu_irq[dev] == SNDRV_AUTO_IRQ) | 128 | goto out; |
121 | mpu_irq[dev] = -1; | 129 | |
130 | if (mpu_port[n] > 0 && mpu_port[n] != SNDRV_AUTO_PORT) { | ||
131 | if (mpu_irq[n] == SNDRV_AUTO_IRQ) | ||
132 | mpu_irq[n] = -1; | ||
122 | if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232, | 133 | if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232, |
123 | mpu_port[dev], 0, | 134 | mpu_port[n], 0, mpu_irq[n], |
124 | mpu_irq[dev], | 135 | mpu_irq[n] >= 0 ? IRQF_DISABLED : 0, |
125 | mpu_irq[dev] >= 0 ? IRQF_DISABLED : 0, | ||
126 | NULL) < 0) | 136 | NULL) < 0) |
127 | printk(KERN_WARNING "cs4231: MPU401 not detected\n"); | 137 | printk(KERN_WARNING "%s: MPU401 not detected\n", dev->bus_id); |
128 | } | 138 | } |
129 | 139 | ||
130 | snd_card_set_dev(card, &pdev->dev); | 140 | snd_card_set_dev(card, dev); |
131 | 141 | ||
132 | if ((err = snd_card_register(card)) < 0) | 142 | error = snd_card_register(card); |
133 | goto _err; | 143 | if (error < 0) |
144 | goto out; | ||
134 | 145 | ||
135 | platform_set_drvdata(pdev, card); | 146 | dev_set_drvdata(dev, card); |
136 | return 0; | 147 | return 0; |
137 | 148 | ||
138 | _err: | 149 | out: snd_card_free(card); |
139 | snd_card_free(card); | 150 | return error; |
140 | return err; | ||
141 | } | 151 | } |
142 | 152 | ||
143 | static int __devexit snd_cs4231_remove(struct platform_device *devptr) | 153 | static int __devexit snd_cs4231_remove(struct device *dev, unsigned int n) |
144 | { | 154 | { |
145 | snd_card_free(platform_get_drvdata(devptr)); | 155 | snd_card_free(dev_get_drvdata(dev)); |
146 | platform_set_drvdata(devptr, NULL); | 156 | dev_set_drvdata(dev, NULL); |
147 | return 0; | 157 | return 0; |
148 | } | 158 | } |
149 | 159 | ||
150 | #ifdef CONFIG_PM | 160 | #ifdef CONFIG_PM |
151 | static int snd_cs4231_suspend(struct platform_device *dev, pm_message_t state) | 161 | static int snd_cs4231_suspend(struct device *dev, unsigned int n, pm_message_t state) |
152 | { | 162 | { |
153 | struct snd_card *card; | 163 | struct snd_card *card = dev_get_drvdata(dev); |
154 | struct snd_cs4231 *chip; | 164 | struct snd_cs4231 *chip = card->private_data; |
155 | card = platform_get_drvdata(dev); | 165 | |
156 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 166 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
157 | chip = card->private_data; | ||
158 | chip->suspend(chip); | 167 | chip->suspend(chip); |
159 | return 0; | 168 | return 0; |
160 | } | 169 | } |
161 | 170 | ||
162 | static int snd_cs4231_resume(struct platform_device *dev) | 171 | static int snd_cs4231_resume(struct device *dev, unsigned int n) |
163 | { | 172 | { |
164 | struct snd_card *card; | 173 | struct snd_card *card = dev_get_drvdata(dev); |
165 | struct snd_cs4231 *chip; | 174 | struct snd_cs4231 *chip = card->private_data; |
166 | card = platform_get_drvdata(dev); | 175 | |
167 | chip = card->private_data; | ||
168 | chip->resume(chip); | 176 | chip->resume(chip); |
169 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 177 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
170 | return 0; | 178 | return 0; |
171 | } | 179 | } |
172 | #endif | 180 | #endif |
173 | 181 | ||
174 | #define SND_CS4231_DRIVER "snd_cs4231" | 182 | static struct isa_driver snd_cs4231_driver = { |
175 | 183 | .match = snd_cs4231_match, | |
176 | static struct platform_driver snd_cs4231_driver = { | ||
177 | .probe = snd_cs4231_probe, | 184 | .probe = snd_cs4231_probe, |
178 | .remove = __devexit_p(snd_cs4231_remove), | 185 | .remove = __devexit_p(snd_cs4231_remove), |
179 | #ifdef CONFIG_PM | 186 | #ifdef CONFIG_PM |
@@ -181,57 +188,19 @@ static struct platform_driver snd_cs4231_driver = { | |||
181 | .resume = snd_cs4231_resume, | 188 | .resume = snd_cs4231_resume, |
182 | #endif | 189 | #endif |
183 | .driver = { | 190 | .driver = { |
184 | .name = SND_CS4231_DRIVER | 191 | .name = DEV_NAME |
185 | }, | 192 | } |
186 | }; | 193 | }; |
187 | 194 | ||
188 | static void __init_or_module snd_cs4231_unregister_all(void) | ||
189 | { | ||
190 | int i; | ||
191 | |||
192 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
193 | platform_device_unregister(devices[i]); | ||
194 | platform_driver_unregister(&snd_cs4231_driver); | ||
195 | } | ||
196 | |||
197 | static int __init alsa_card_cs4231_init(void) | 195 | static int __init alsa_card_cs4231_init(void) |
198 | { | 196 | { |
199 | int i, cards, err; | 197 | return isa_register_driver(&snd_cs4231_driver, SNDRV_CARDS); |
200 | |||
201 | err = platform_driver_register(&snd_cs4231_driver); | ||
202 | if (err < 0) | ||
203 | return err; | ||
204 | |||
205 | cards = 0; | ||
206 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
207 | struct platform_device *device; | ||
208 | if (! enable[i]) | ||
209 | continue; | ||
210 | device = platform_device_register_simple(SND_CS4231_DRIVER, | ||
211 | i, NULL, 0); | ||
212 | if (IS_ERR(device)) | ||
213 | continue; | ||
214 | if (!platform_get_drvdata(device)) { | ||
215 | platform_device_unregister(device); | ||
216 | continue; | ||
217 | } | ||
218 | devices[i] = device; | ||
219 | cards++; | ||
220 | } | ||
221 | if (!cards) { | ||
222 | #ifdef MODULE | ||
223 | printk(KERN_ERR "CS4231 soundcard not found or device busy\n"); | ||
224 | #endif | ||
225 | snd_cs4231_unregister_all(); | ||
226 | return -ENODEV; | ||
227 | } | ||
228 | return 0; | ||
229 | } | 198 | } |
230 | 199 | ||
231 | static void __exit alsa_card_cs4231_exit(void) | 200 | static void __exit alsa_card_cs4231_exit(void) |
232 | { | 201 | { |
233 | snd_cs4231_unregister_all(); | 202 | isa_unregister_driver(&snd_cs4231_driver); |
234 | } | 203 | } |
235 | 204 | ||
236 | module_init(alsa_card_cs4231_init) | 205 | module_init(alsa_card_cs4231_init); |
237 | module_exit(alsa_card_cs4231_exit) | 206 | module_exit(alsa_card_cs4231_exit); |
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c index 75c7c5f0198..914d77b61b0 100644 --- a/sound/isa/cs423x/cs4231_lib.c +++ b/sound/isa/cs423x/cs4231_lib.c | |||
@@ -405,7 +405,6 @@ static int snd_cs4231_trigger(struct snd_pcm_substream *substream, | |||
405 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 405 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); |
406 | int result = 0; | 406 | int result = 0; |
407 | unsigned int what; | 407 | unsigned int what; |
408 | struct list_head *pos; | ||
409 | struct snd_pcm_substream *s; | 408 | struct snd_pcm_substream *s; |
410 | int do_start; | 409 | int do_start; |
411 | 410 | ||
@@ -425,8 +424,7 @@ static int snd_cs4231_trigger(struct snd_pcm_substream *substream, | |||
425 | } | 424 | } |
426 | 425 | ||
427 | what = 0; | 426 | what = 0; |
428 | snd_pcm_group_for_each(pos, substream) { | 427 | snd_pcm_group_for_each_entry(s, substream) { |
429 | s = snd_pcm_group_substream_entry(pos); | ||
430 | if (s == chip->playback_substream) { | 428 | if (s == chip->playback_substream) { |
431 | what |= CS4231_PLAYBACK_ENABLE; | 429 | what |= CS4231_PLAYBACK_ENABLE; |
432 | snd_pcm_trigger_done(s, substream); | 430 | snd_pcm_trigger_done(s, substream); |
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 07ffd5c22e8..87f1392a2fa 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/isa.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/pnp.h> | 27 | #include <linux/pnp.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
@@ -75,10 +75,10 @@ MODULE_SUPPORTED_DEVICE("{{Crystal Semiconductors,CS4235}," | |||
75 | 75 | ||
76 | #ifdef CS4232 | 76 | #ifdef CS4232 |
77 | #define IDENT "CS4232" | 77 | #define IDENT "CS4232" |
78 | #define CS423X_DRIVER "snd_cs4232" | 78 | #define DEV_NAME "cs4232" |
79 | #else | 79 | #else |
80 | #define IDENT "CS4236+" | 80 | #define IDENT "CS4236+" |
81 | #define CS423X_DRIVER "snd_cs4236" | 81 | #define DEV_NAME "cs4236" |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 84 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
@@ -126,14 +126,12 @@ MODULE_PARM_DESC(dma1, "DMA1 # for " IDENT " driver."); | |||
126 | module_param_array(dma2, int, NULL, 0444); | 126 | module_param_array(dma2, int, NULL, 0444); |
127 | MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver."); | 127 | MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver."); |
128 | 128 | ||
129 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
130 | #ifdef CONFIG_PNP | 129 | #ifdef CONFIG_PNP |
131 | static int pnpc_registered; | 130 | static int pnpc_registered; |
132 | #ifdef CS4232 | 131 | #ifdef CS4232 |
133 | static int pnp_registered; | 132 | static int pnp_registered; |
134 | #endif | 133 | #endif |
135 | #endif /* CONFIG_PNP */ | 134 | #endif /* CONFIG_PNP */ |
136 | static unsigned int snd_cs423x_devices; | ||
137 | 135 | ||
138 | struct snd_card_cs4236 { | 136 | struct snd_card_cs4236 { |
139 | struct snd_cs4231 *chip; | 137 | struct snd_cs4231 *chip; |
@@ -542,38 +540,55 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) | |||
542 | return snd_card_register(card); | 540 | return snd_card_register(card); |
543 | } | 541 | } |
544 | 542 | ||
545 | static int __init snd_cs423x_nonpnp_probe(struct platform_device *pdev) | 543 | static int __devinit snd_cs423x_isa_match(struct device *pdev, |
544 | unsigned int dev) | ||
546 | { | 545 | { |
547 | int dev = pdev->id; | 546 | if (!enable[dev] || is_isapnp_selected(dev)) |
548 | struct snd_card *card; | 547 | return 0; |
549 | int err; | ||
550 | 548 | ||
551 | if (port[dev] == SNDRV_AUTO_PORT) { | 549 | if (port[dev] == SNDRV_AUTO_PORT) { |
552 | snd_printk(KERN_ERR "specify port\n"); | 550 | snd_printk(KERN_ERR "%s: please specify port\n", pdev->bus_id); |
553 | return -EINVAL; | 551 | return 0; |
554 | } | 552 | } |
555 | if (cport[dev] == SNDRV_AUTO_PORT) { | 553 | if (cport[dev] == SNDRV_AUTO_PORT) { |
556 | snd_printk(KERN_ERR "specify cport\n"); | 554 | snd_printk(KERN_ERR "%s: please specify cport\n", pdev->bus_id); |
557 | return -EINVAL; | 555 | return 0; |
556 | } | ||
557 | if (irq[dev] == SNDRV_AUTO_IRQ) { | ||
558 | snd_printk(KERN_ERR "%s: please specify irq\n", pdev->bus_id); | ||
559 | return 0; | ||
558 | } | 560 | } |
561 | if (dma1[dev] == SNDRV_AUTO_DMA) { | ||
562 | snd_printk(KERN_ERR "%s: please specify dma1\n", pdev->bus_id); | ||
563 | return 0; | ||
564 | } | ||
565 | return 1; | ||
566 | } | ||
567 | |||
568 | static int __devinit snd_cs423x_isa_probe(struct device *pdev, | ||
569 | unsigned int dev) | ||
570 | { | ||
571 | struct snd_card *card; | ||
572 | int err; | ||
559 | 573 | ||
560 | card = snd_cs423x_card_new(dev); | 574 | card = snd_cs423x_card_new(dev); |
561 | if (! card) | 575 | if (! card) |
562 | return -ENOMEM; | 576 | return -ENOMEM; |
563 | snd_card_set_dev(card, &pdev->dev); | 577 | snd_card_set_dev(card, pdev); |
564 | if ((err = snd_cs423x_probe(card, dev)) < 0) { | 578 | if ((err = snd_cs423x_probe(card, dev)) < 0) { |
565 | snd_card_free(card); | 579 | snd_card_free(card); |
566 | return err; | 580 | return err; |
567 | } | 581 | } |
568 | 582 | ||
569 | platform_set_drvdata(pdev, card); | 583 | dev_set_drvdata(pdev, card); |
570 | return 0; | 584 | return 0; |
571 | } | 585 | } |
572 | 586 | ||
573 | static int __devexit snd_cs423x_nonpnp_remove(struct platform_device *devptr) | 587 | static int __devexit snd_cs423x_isa_remove(struct device *pdev, |
588 | unsigned int dev) | ||
574 | { | 589 | { |
575 | snd_card_free(platform_get_drvdata(devptr)); | 590 | snd_card_free(dev_get_drvdata(pdev)); |
576 | platform_set_drvdata(devptr, NULL); | 591 | dev_set_drvdata(pdev, NULL); |
577 | return 0; | 592 | return 0; |
578 | } | 593 | } |
579 | 594 | ||
@@ -594,26 +609,28 @@ static int snd_cs423x_resume(struct snd_card *card) | |||
594 | return 0; | 609 | return 0; |
595 | } | 610 | } |
596 | 611 | ||
597 | static int snd_cs423x_nonpnp_suspend(struct platform_device *dev, pm_message_t state) | 612 | static int snd_cs423x_isa_suspend(struct device *dev, unsigned int n, |
613 | pm_message_t state) | ||
598 | { | 614 | { |
599 | return snd_cs423x_suspend(platform_get_drvdata(dev)); | 615 | return snd_cs423x_suspend(dev_get_drvdata(dev)); |
600 | } | 616 | } |
601 | 617 | ||
602 | static int snd_cs423x_nonpnp_resume(struct platform_device *dev) | 618 | static int snd_cs423x_isa_resume(struct device *dev, unsigned int n) |
603 | { | 619 | { |
604 | return snd_cs423x_resume(platform_get_drvdata(dev)); | 620 | return snd_cs423x_resume(dev_get_drvdata(dev)); |
605 | } | 621 | } |
606 | #endif | 622 | #endif |
607 | 623 | ||
608 | static struct platform_driver cs423x_nonpnp_driver = { | 624 | static struct isa_driver cs423x_isa_driver = { |
609 | .probe = snd_cs423x_nonpnp_probe, | 625 | .match = snd_cs423x_isa_match, |
610 | .remove = __devexit_p(snd_cs423x_nonpnp_remove), | 626 | .probe = snd_cs423x_isa_probe, |
627 | .remove = __devexit_p(snd_cs423x_isa_remove), | ||
611 | #ifdef CONFIG_PM | 628 | #ifdef CONFIG_PM |
612 | .suspend = snd_cs423x_nonpnp_suspend, | 629 | .suspend = snd_cs423x_isa_suspend, |
613 | .resume = snd_cs423x_nonpnp_resume, | 630 | .resume = snd_cs423x_isa_resume, |
614 | #endif | 631 | #endif |
615 | .driver = { | 632 | .driver = { |
616 | .name = CS423X_DRIVER | 633 | .name = DEV_NAME |
617 | }, | 634 | }, |
618 | }; | 635 | }; |
619 | 636 | ||
@@ -651,7 +668,6 @@ static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev, | |||
651 | } | 668 | } |
652 | pnp_set_drvdata(pdev, card); | 669 | pnp_set_drvdata(pdev, card); |
653 | dev++; | 670 | dev++; |
654 | snd_cs423x_devices++; | ||
655 | return 0; | 671 | return 0; |
656 | } | 672 | } |
657 | 673 | ||
@@ -715,7 +731,6 @@ static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard, | |||
715 | } | 731 | } |
716 | pnp_set_card_drvdata(pcard, card); | 732 | pnp_set_card_drvdata(pcard, card); |
717 | dev++; | 733 | dev++; |
718 | snd_cs423x_devices++; | ||
719 | return 0; | 734 | return 0; |
720 | } | 735 | } |
721 | 736 | ||
@@ -750,45 +765,13 @@ static struct pnp_card_driver cs423x_pnpc_driver = { | |||
750 | }; | 765 | }; |
751 | #endif /* CONFIG_PNP */ | 766 | #endif /* CONFIG_PNP */ |
752 | 767 | ||
753 | static void __init_or_module snd_cs423x_unregister_all(void) | ||
754 | { | ||
755 | int i; | ||
756 | |||
757 | #ifdef CONFIG_PNP | ||
758 | if (pnpc_registered) | ||
759 | pnp_unregister_card_driver(&cs423x_pnpc_driver); | ||
760 | #ifdef CS4232 | ||
761 | if (pnp_registered) | ||
762 | pnp_unregister_driver(&cs4232_pnp_driver); | ||
763 | #endif | ||
764 | #endif /* CONFIG_PNP */ | ||
765 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
766 | platform_device_unregister(platform_devices[i]); | ||
767 | platform_driver_unregister(&cs423x_nonpnp_driver); | ||
768 | } | ||
769 | |||
770 | static int __init alsa_card_cs423x_init(void) | 768 | static int __init alsa_card_cs423x_init(void) |
771 | { | 769 | { |
772 | int i, err; | 770 | int err; |
773 | 771 | ||
774 | if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0) | 772 | err = isa_register_driver(&cs423x_isa_driver, SNDRV_CARDS); |
773 | if (err < 0) | ||
775 | return err; | 774 | return err; |
776 | |||
777 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
778 | struct platform_device *device; | ||
779 | if (! enable[i] || is_isapnp_selected(i)) | ||
780 | continue; | ||
781 | device = platform_device_register_simple(CS423X_DRIVER, | ||
782 | i, NULL, 0); | ||
783 | if (IS_ERR(device)) | ||
784 | continue; | ||
785 | if (!platform_get_drvdata(device)) { | ||
786 | platform_device_unregister(device); | ||
787 | continue; | ||
788 | } | ||
789 | platform_devices[i] = device; | ||
790 | snd_cs423x_devices++; | ||
791 | } | ||
792 | #ifdef CONFIG_PNP | 775 | #ifdef CONFIG_PNP |
793 | #ifdef CS4232 | 776 | #ifdef CS4232 |
794 | err = pnp_register_driver(&cs4232_pnp_driver); | 777 | err = pnp_register_driver(&cs4232_pnp_driver); |
@@ -799,20 +782,20 @@ static int __init alsa_card_cs423x_init(void) | |||
799 | if (!err) | 782 | if (!err) |
800 | pnpc_registered = 1; | 783 | pnpc_registered = 1; |
801 | #endif /* CONFIG_PNP */ | 784 | #endif /* CONFIG_PNP */ |
802 | |||
803 | if (!snd_cs423x_devices) { | ||
804 | #ifdef MODULE | ||
805 | printk(KERN_ERR IDENT " soundcard not found or device busy\n"); | ||
806 | #endif | ||
807 | snd_cs423x_unregister_all(); | ||
808 | return -ENODEV; | ||
809 | } | ||
810 | return 0; | 785 | return 0; |
811 | } | 786 | } |
812 | 787 | ||
813 | static void __exit alsa_card_cs423x_exit(void) | 788 | static void __exit alsa_card_cs423x_exit(void) |
814 | { | 789 | { |
815 | snd_cs423x_unregister_all(); | 790 | #ifdef CONFIG_PNP |
791 | if (pnpc_registered) | ||
792 | pnp_unregister_card_driver(&cs423x_pnpc_driver); | ||
793 | #ifdef CS4232 | ||
794 | if (pnp_registered) | ||
795 | pnp_unregister_driver(&cs4232_pnp_driver); | ||
796 | #endif | ||
797 | #endif /* CONFIG_PNP */ | ||
798 | isa_unregister_driver(&cs423x_isa_driver); | ||
816 | } | 799 | } |
817 | 800 | ||
818 | module_init(alsa_card_cs423x_init) | 801 | module_init(alsa_card_cs423x_init) |
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index 65f97ff4eef..edc398712e8 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/isa.h> |
26 | #include <linux/time.h> | 26 | #include <linux/time.h> |
27 | #include <linux/wait.h> | 27 | #include <linux/wait.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
@@ -35,8 +35,11 @@ | |||
35 | #define SNDRV_LEGACY_FIND_FREE_DMA | 35 | #define SNDRV_LEGACY_FIND_FREE_DMA |
36 | #include <sound/initval.h> | 36 | #include <sound/initval.h> |
37 | 37 | ||
38 | #define CRD_NAME "Generic ESS ES1688/ES688 AudioDrive" | ||
39 | #define DEV_NAME "es1688" | ||
40 | |||
41 | MODULE_DESCRIPTION(CRD_NAME); | ||
38 | MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); | 42 | MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); |
39 | MODULE_DESCRIPTION("ESS ESx688 AudioDrive"); | ||
40 | MODULE_LICENSE("GPL"); | 43 | MODULE_LICENSE("GPL"); |
41 | MODULE_SUPPORTED_DEVICE("{{ESS,ES688 PnP AudioDrive,pnp:ESS0100}," | 44 | MODULE_SUPPORTED_DEVICE("{{ESS,ES688 PnP AudioDrive,pnp:ESS0100}," |
42 | "{ESS,ES1688 PnP AudioDrive,pnp:ESS0102}," | 45 | "{ESS,ES1688 PnP AudioDrive,pnp:ESS0102}," |
@@ -53,189 +56,157 @@ static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,10 */ | |||
53 | static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3 */ | 56 | static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3 */ |
54 | 57 | ||
55 | module_param_array(index, int, NULL, 0444); | 58 | module_param_array(index, int, NULL, 0444); |
56 | MODULE_PARM_DESC(index, "Index value for ESx688 soundcard."); | 59 | MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard."); |
57 | module_param_array(id, charp, NULL, 0444); | 60 | module_param_array(id, charp, NULL, 0444); |
58 | MODULE_PARM_DESC(id, "ID string for ESx688 soundcard."); | 61 | MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard."); |
59 | module_param_array(enable, bool, NULL, 0444); | 62 | module_param_array(enable, bool, NULL, 0444); |
60 | MODULE_PARM_DESC(enable, "Enable ESx688 soundcard."); | 63 | MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); |
61 | module_param_array(port, long, NULL, 0444); | 64 | module_param_array(port, long, NULL, 0444); |
62 | MODULE_PARM_DESC(port, "Port # for ESx688 driver."); | 65 | MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); |
63 | module_param_array(mpu_port, long, NULL, 0444); | 66 | module_param_array(mpu_port, long, NULL, 0444); |
64 | MODULE_PARM_DESC(mpu_port, "MPU-401 port # for ESx688 driver."); | 67 | MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " CRD_NAME " driver."); |
65 | module_param_array(irq, int, NULL, 0444); | 68 | module_param_array(irq, int, NULL, 0444); |
66 | MODULE_PARM_DESC(irq, "IRQ # for ESx688 driver."); | 69 | MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); |
67 | module_param_array(mpu_irq, int, NULL, 0444); | 70 | module_param_array(mpu_irq, int, NULL, 0444); |
68 | MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for ESx688 driver."); | 71 | MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver."); |
69 | module_param_array(dma8, int, NULL, 0444); | 72 | module_param_array(dma8, int, NULL, 0444); |
70 | MODULE_PARM_DESC(dma8, "8-bit DMA # for ESx688 driver."); | 73 | MODULE_PARM_DESC(dma8, "8-bit DMA # for " CRD_NAME " driver."); |
71 | |||
72 | static struct platform_device *devices[SNDRV_CARDS]; | ||
73 | 74 | ||
74 | #define PFX "es1688: " | 75 | static int __devinit snd_es1688_match(struct device *dev, unsigned int n) |
76 | { | ||
77 | return enable[n]; | ||
78 | } | ||
75 | 79 | ||
76 | static int __devinit snd_es1688_probe(struct platform_device *pdev) | 80 | static int __devinit snd_es1688_legacy_create(struct snd_card *card, |
81 | struct device *dev, unsigned int n, struct snd_es1688 **rchip) | ||
77 | { | 82 | { |
78 | int dev = pdev->id; | 83 | static long possible_ports[] = {0x220, 0x240, 0x260}; |
79 | static int possible_irqs[] = {5, 9, 10, 7, -1}; | 84 | static int possible_irqs[] = {5, 9, 10, 7, -1}; |
80 | static int possible_dmas[] = {1, 3, 0, -1}; | 85 | static int possible_dmas[] = {1, 3, 0, -1}; |
81 | int xirq, xdma, xmpu_irq; | 86 | |
82 | struct snd_card *card; | 87 | int i, error; |
83 | struct snd_es1688 *chip; | 88 | |
84 | struct snd_opl3 *opl3; | 89 | if (irq[n] == SNDRV_AUTO_IRQ) { |
85 | struct snd_pcm *pcm; | 90 | irq[n] = snd_legacy_find_free_irq(possible_irqs); |
86 | int err; | 91 | if (irq[n] < 0) { |
87 | 92 | snd_printk(KERN_ERR "%s: unable to find a free IRQ\n", | |
88 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 93 | dev->bus_id); |
89 | if (card == NULL) | 94 | return -EBUSY; |
90 | return -ENOMEM; | ||
91 | |||
92 | xirq = irq[dev]; | ||
93 | if (xirq == SNDRV_AUTO_IRQ) { | ||
94 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { | ||
95 | snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); | ||
96 | err = -EBUSY; | ||
97 | goto _err; | ||
98 | } | 95 | } |
99 | } | 96 | } |
100 | xmpu_irq = mpu_irq[dev]; | 97 | if (dma8[n] == SNDRV_AUTO_DMA) { |
101 | xdma = dma8[dev]; | 98 | dma8[n] = snd_legacy_find_free_dma(possible_dmas); |
102 | if (xdma == SNDRV_AUTO_DMA) { | 99 | if (dma8[n] < 0) { |
103 | if ((xdma = snd_legacy_find_free_dma(possible_dmas)) < 0) { | 100 | snd_printk(KERN_ERR "%s: unable to find a free DMA\n", |
104 | snd_printk(KERN_ERR PFX "unable to find a free DMA\n"); | 101 | dev->bus_id); |
105 | err = -EBUSY; | 102 | return -EBUSY; |
106 | goto _err; | ||
107 | } | 103 | } |
108 | } | 104 | } |
109 | 105 | ||
110 | if (port[dev] != SNDRV_AUTO_PORT) { | 106 | if (port[n] != SNDRV_AUTO_PORT) |
111 | if ((err = snd_es1688_create(card, port[dev], mpu_port[dev], | 107 | return snd_es1688_create(card, port[n], mpu_port[n], irq[n], |
112 | xirq, xmpu_irq, xdma, | 108 | mpu_irq[n], dma8[n], ES1688_HW_AUTO, rchip); |
113 | ES1688_HW_AUTO, &chip)) < 0) | 109 | |
114 | goto _err; | 110 | i = 0; |
115 | } else { | 111 | do { |
116 | /* auto-probe legacy ports */ | 112 | port[n] = possible_ports[i]; |
117 | static unsigned long possible_ports[] = { | 113 | error = snd_es1688_create(card, port[n], mpu_port[n], irq[n], |
118 | 0x220, 0x240, 0x260, | 114 | mpu_irq[n], dma8[n], ES1688_HW_AUTO, rchip); |
119 | }; | 115 | } while (error < 0 && ++i < ARRAY_SIZE(possible_ports)); |
120 | int i; | 116 | |
121 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { | 117 | return error; |
122 | err = snd_es1688_create(card, possible_ports[i], | 118 | } |
123 | mpu_port[dev], | 119 | |
124 | xirq, xmpu_irq, xdma, | 120 | static int __devinit snd_es1688_probe(struct device *dev, unsigned int n) |
125 | ES1688_HW_AUTO, &chip); | 121 | { |
126 | if (err >= 0) { | 122 | struct snd_card *card; |
127 | port[dev] = possible_ports[i]; | 123 | struct snd_es1688 *chip; |
128 | break; | 124 | struct snd_opl3 *opl3; |
129 | } | 125 | struct snd_pcm *pcm; |
130 | } | 126 | int error; |
131 | if (i >= ARRAY_SIZE(possible_ports)) | 127 | |
132 | goto _err; | 128 | card = snd_card_new(index[n], id[n], THIS_MODULE, 0); |
133 | } | 129 | if (!card) |
130 | return -EINVAL; | ||
131 | |||
132 | error = snd_es1688_legacy_create(card, dev, n, &chip); | ||
133 | if (error < 0) | ||
134 | goto out; | ||
134 | 135 | ||
135 | if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0) | 136 | error = snd_es1688_pcm(chip, 0, &pcm); |
136 | goto _err; | 137 | if (error < 0) |
138 | goto out; | ||
137 | 139 | ||
138 | if ((err = snd_es1688_mixer(chip)) < 0) | 140 | error = snd_es1688_mixer(chip); |
139 | goto _err; | 141 | if (error < 0) |
142 | goto out; | ||
140 | 143 | ||
141 | strcpy(card->driver, "ES1688"); | 144 | strcpy(card->driver, "ES1688"); |
142 | strcpy(card->shortname, pcm->name); | 145 | strcpy(card->shortname, pcm->name); |
143 | sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, xirq, xdma); | 146 | sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, |
144 | 147 | chip->port, chip->irq, chip->dma8); | |
145 | if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) { | 148 | |
146 | printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->port); | 149 | if (snd_opl3_create(card, chip->port, chip->port + 2, |
147 | } else { | 150 | OPL3_HW_OPL3, 0, &opl3) < 0) |
148 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) | 151 | printk(KERN_WARNING "%s: opl3 not detected at 0x%lx\n", |
149 | goto _err; | 152 | dev->bus_id, chip->port); |
153 | else { | ||
154 | error = snd_opl3_hwdep_new(opl3, 0, 1, NULL); | ||
155 | if (error < 0) | ||
156 | goto out; | ||
150 | } | 157 | } |
151 | 158 | ||
152 | if (xmpu_irq >= 0 && xmpu_irq != SNDRV_AUTO_IRQ && chip->mpu_port > 0) { | 159 | if (mpu_irq[n] >= 0 && mpu_irq[n] != SNDRV_AUTO_IRQ && |
153 | if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688, | 160 | chip->mpu_port > 0) { |
154 | chip->mpu_port, 0, | 161 | error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688, |
155 | xmpu_irq, | 162 | chip->mpu_port, 0, |
156 | IRQF_DISABLED, | 163 | mpu_irq[n], IRQF_DISABLED, NULL); |
157 | NULL)) < 0) | 164 | if (error < 0) |
158 | goto _err; | 165 | goto out; |
159 | } | 166 | } |
160 | 167 | ||
161 | snd_card_set_dev(card, &pdev->dev); | 168 | snd_card_set_dev(card, dev); |
162 | 169 | ||
163 | if ((err = snd_card_register(card)) < 0) | 170 | error = snd_card_register(card); |
164 | goto _err; | 171 | if (error < 0) |
172 | goto out; | ||
165 | 173 | ||
166 | platform_set_drvdata(pdev, card); | 174 | dev_set_drvdata(dev, card); |
167 | return 0; | 175 | return 0; |
168 | 176 | ||
169 | _err: | 177 | out: snd_card_free(card); |
170 | snd_card_free(card); | 178 | return error; |
171 | return err; | ||
172 | } | 179 | } |
173 | 180 | ||
174 | static int __devexit snd_es1688_remove(struct platform_device *devptr) | 181 | static int __devexit snd_es1688_remove(struct device *dev, unsigned int n) |
175 | { | 182 | { |
176 | snd_card_free(platform_get_drvdata(devptr)); | 183 | snd_card_free(dev_get_drvdata(dev)); |
177 | platform_set_drvdata(devptr, NULL); | 184 | dev_set_drvdata(dev, NULL); |
178 | return 0; | 185 | return 0; |
179 | } | 186 | } |
180 | 187 | ||
181 | #define ES1688_DRIVER "snd_es1688" | 188 | static struct isa_driver snd_es1688_driver = { |
182 | 189 | .match = snd_es1688_match, | |
183 | static struct platform_driver snd_es1688_driver = { | ||
184 | .probe = snd_es1688_probe, | 190 | .probe = snd_es1688_probe, |
185 | .remove = __devexit_p(snd_es1688_remove), | 191 | .remove = snd_es1688_remove, |
186 | /* FIXME: suspend/resume */ | 192 | #if 0 /* FIXME */ |
193 | .suspend = snd_es1688_suspend, | ||
194 | .resume = snd_es1688_resume, | ||
195 | #endif | ||
187 | .driver = { | 196 | .driver = { |
188 | .name = ES1688_DRIVER | 197 | .name = DEV_NAME |
189 | }, | 198 | } |
190 | }; | 199 | }; |
191 | 200 | ||
192 | static void __init_or_module snd_es1688_unregister_all(void) | ||
193 | { | ||
194 | int i; | ||
195 | |||
196 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
197 | platform_device_unregister(devices[i]); | ||
198 | platform_driver_unregister(&snd_es1688_driver); | ||
199 | } | ||
200 | |||
201 | static int __init alsa_card_es1688_init(void) | 201 | static int __init alsa_card_es1688_init(void) |
202 | { | 202 | { |
203 | int i, cards, err; | 203 | return isa_register_driver(&snd_es1688_driver, SNDRV_CARDS); |
204 | |||
205 | err = platform_driver_register(&snd_es1688_driver); | ||
206 | if (err < 0) | ||
207 | return err; | ||
208 | |||
209 | cards = 0; | ||
210 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
211 | struct platform_device *device; | ||
212 | if (! enable[i]) | ||
213 | continue; | ||
214 | device = platform_device_register_simple(ES1688_DRIVER, | ||
215 | i, NULL, 0); | ||
216 | if (IS_ERR(device)) | ||
217 | continue; | ||
218 | if (!platform_get_drvdata(device)) { | ||
219 | platform_device_unregister(device); | ||
220 | continue; | ||
221 | } | ||
222 | devices[i] = device; | ||
223 | cards++; | ||
224 | } | ||
225 | if (!cards) { | ||
226 | #ifdef MODULE | ||
227 | printk(KERN_ERR "ESS AudioDrive ES1688 soundcard not found or device busy\n"); | ||
228 | #endif | ||
229 | snd_es1688_unregister_all(); | ||
230 | return -ENODEV; | ||
231 | } | ||
232 | return 0; | ||
233 | } | 204 | } |
234 | 205 | ||
235 | static void __exit alsa_card_es1688_exit(void) | 206 | static void __exit alsa_card_es1688_exit(void) |
236 | { | 207 | { |
237 | snd_es1688_unregister_all(); | 208 | isa_unregister_driver(&snd_es1688_driver); |
238 | } | 209 | } |
239 | 210 | ||
240 | module_init(alsa_card_es1688_init) | 211 | module_init(alsa_card_es1688_init); |
241 | module_exit(alsa_card_es1688_exit) | 212 | module_exit(alsa_card_es1688_exit); |
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 725c115ff97..d2a9c7df0ce 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -80,7 +80,7 @@ | |||
80 | #include <sound/driver.h> | 80 | #include <sound/driver.h> |
81 | #include <linux/init.h> | 81 | #include <linux/init.h> |
82 | #include <linux/err.h> | 82 | #include <linux/err.h> |
83 | #include <linux/platform_device.h> | 83 | #include <linux/isa.h> |
84 | #include <linux/slab.h> | 84 | #include <linux/slab.h> |
85 | #include <linux/pnp.h> | 85 | #include <linux/pnp.h> |
86 | #include <linux/isapnp.h> | 86 | #include <linux/isapnp.h> |
@@ -2035,8 +2035,6 @@ MODULE_PARM_DESC(dma1, "DMA 1 # for ES18xx driver."); | |||
2035 | module_param_array(dma2, int, NULL, 0444); | 2035 | module_param_array(dma2, int, NULL, 0444); |
2036 | MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver."); | 2036 | MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver."); |
2037 | 2037 | ||
2038 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
2039 | |||
2040 | #ifdef CONFIG_PNP | 2038 | #ifdef CONFIG_PNP |
2041 | static int pnp_registered, pnpc_registered; | 2039 | static int pnp_registered, pnpc_registered; |
2042 | 2040 | ||
@@ -2237,7 +2235,12 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) | |||
2237 | return snd_card_register(card); | 2235 | return snd_card_register(card); |
2238 | } | 2236 | } |
2239 | 2237 | ||
2240 | static int __devinit snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devptr) | 2238 | static int __devinit snd_es18xx_isa_match(struct device *pdev, unsigned int dev) |
2239 | { | ||
2240 | return enable[dev] && !is_isapnp_selected(dev); | ||
2241 | } | ||
2242 | |||
2243 | static int __devinit snd_es18xx_isa_probe1(int dev, struct device *devptr) | ||
2241 | { | 2244 | { |
2242 | struct snd_card *card; | 2245 | struct snd_card *card; |
2243 | int err; | 2246 | int err; |
@@ -2245,18 +2248,17 @@ static int __devinit snd_es18xx_nonpnp_probe1(int dev, struct platform_device *d | |||
2245 | card = snd_es18xx_card_new(dev); | 2248 | card = snd_es18xx_card_new(dev); |
2246 | if (! card) | 2249 | if (! card) |
2247 | return -ENOMEM; | 2250 | return -ENOMEM; |
2248 | snd_card_set_dev(card, &devptr->dev); | 2251 | snd_card_set_dev(card, devptr); |
2249 | if ((err = snd_audiodrive_probe(card, dev)) < 0) { | 2252 | if ((err = snd_audiodrive_probe(card, dev)) < 0) { |
2250 | snd_card_free(card); | 2253 | snd_card_free(card); |
2251 | return err; | 2254 | return err; |
2252 | } | 2255 | } |
2253 | platform_set_drvdata(devptr, card); | 2256 | dev_set_drvdata(devptr, card); |
2254 | return 0; | 2257 | return 0; |
2255 | } | 2258 | } |
2256 | 2259 | ||
2257 | static int __devinit snd_es18xx_nonpnp_probe(struct platform_device *pdev) | 2260 | static int __devinit snd_es18xx_isa_probe(struct device *pdev, unsigned int dev) |
2258 | { | 2261 | { |
2259 | int dev = pdev->id; | ||
2260 | int err; | 2262 | int err; |
2261 | static int possible_irqs[] = {5, 9, 10, 7, 11, 12, -1}; | 2263 | static int possible_irqs[] = {5, 9, 10, 7, 11, 12, -1}; |
2262 | static int possible_dmas[] = {1, 0, 3, 5, -1}; | 2264 | static int possible_dmas[] = {1, 0, 3, 5, -1}; |
@@ -2281,13 +2283,13 @@ static int __devinit snd_es18xx_nonpnp_probe(struct platform_device *pdev) | |||
2281 | } | 2283 | } |
2282 | 2284 | ||
2283 | if (port[dev] != SNDRV_AUTO_PORT) { | 2285 | if (port[dev] != SNDRV_AUTO_PORT) { |
2284 | return snd_es18xx_nonpnp_probe1(dev, pdev); | 2286 | return snd_es18xx_isa_probe1(dev, pdev); |
2285 | } else { | 2287 | } else { |
2286 | static unsigned long possible_ports[] = {0x220, 0x240, 0x260, 0x280}; | 2288 | static unsigned long possible_ports[] = {0x220, 0x240, 0x260, 0x280}; |
2287 | int i; | 2289 | int i; |
2288 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { | 2290 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { |
2289 | port[dev] = possible_ports[i]; | 2291 | port[dev] = possible_ports[i]; |
2290 | err = snd_es18xx_nonpnp_probe1(dev, pdev); | 2292 | err = snd_es18xx_isa_probe1(dev, pdev); |
2291 | if (! err) | 2293 | if (! err) |
2292 | return 0; | 2294 | return 0; |
2293 | } | 2295 | } |
@@ -2295,43 +2297,44 @@ static int __devinit snd_es18xx_nonpnp_probe(struct platform_device *pdev) | |||
2295 | } | 2297 | } |
2296 | } | 2298 | } |
2297 | 2299 | ||
2298 | static int __devexit snd_es18xx_nonpnp_remove(struct platform_device *devptr) | 2300 | static int __devexit snd_es18xx_isa_remove(struct device *devptr, |
2301 | unsigned int dev) | ||
2299 | { | 2302 | { |
2300 | snd_card_free(platform_get_drvdata(devptr)); | 2303 | snd_card_free(dev_get_drvdata(devptr)); |
2301 | platform_set_drvdata(devptr, NULL); | 2304 | dev_set_drvdata(devptr, NULL); |
2302 | return 0; | 2305 | return 0; |
2303 | } | 2306 | } |
2304 | 2307 | ||
2305 | #ifdef CONFIG_PM | 2308 | #ifdef CONFIG_PM |
2306 | static int snd_es18xx_nonpnp_suspend(struct platform_device *dev, pm_message_t state) | 2309 | static int snd_es18xx_isa_suspend(struct device *dev, unsigned int n, |
2310 | pm_message_t state) | ||
2307 | { | 2311 | { |
2308 | return snd_es18xx_suspend(platform_get_drvdata(dev), state); | 2312 | return snd_es18xx_suspend(dev_get_drvdata(dev), state); |
2309 | } | 2313 | } |
2310 | 2314 | ||
2311 | static int snd_es18xx_nonpnp_resume(struct platform_device *dev) | 2315 | static int snd_es18xx_isa_resume(struct device *dev, unsigned int n) |
2312 | { | 2316 | { |
2313 | return snd_es18xx_resume(platform_get_drvdata(dev)); | 2317 | return snd_es18xx_resume(dev_get_drvdata(dev)); |
2314 | } | 2318 | } |
2315 | #endif | 2319 | #endif |
2316 | 2320 | ||
2317 | #define ES18XX_DRIVER "snd_es18xx" | 2321 | #define DEV_NAME "es18xx" |
2318 | 2322 | ||
2319 | static struct platform_driver snd_es18xx_nonpnp_driver = { | 2323 | static struct isa_driver snd_es18xx_isa_driver = { |
2320 | .probe = snd_es18xx_nonpnp_probe, | 2324 | .match = snd_es18xx_isa_match, |
2321 | .remove = __devexit_p(snd_es18xx_nonpnp_remove), | 2325 | .probe = snd_es18xx_isa_probe, |
2326 | .remove = __devexit_p(snd_es18xx_isa_remove), | ||
2322 | #ifdef CONFIG_PM | 2327 | #ifdef CONFIG_PM |
2323 | .suspend = snd_es18xx_nonpnp_suspend, | 2328 | .suspend = snd_es18xx_isa_suspend, |
2324 | .resume = snd_es18xx_nonpnp_resume, | 2329 | .resume = snd_es18xx_isa_resume, |
2325 | #endif | 2330 | #endif |
2326 | .driver = { | 2331 | .driver = { |
2327 | .name = ES18XX_DRIVER | 2332 | .name = DEV_NAME |
2328 | }, | 2333 | }, |
2329 | }; | 2334 | }; |
2330 | 2335 | ||
2331 | 2336 | ||
2332 | #ifdef CONFIG_PNP | 2337 | #ifdef CONFIG_PNP |
2333 | static unsigned int __devinitdata es18xx_pnp_devices; | ||
2334 | |||
2335 | static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev, | 2338 | static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev, |
2336 | const struct pnp_device_id *id) | 2339 | const struct pnp_device_id *id) |
2337 | { | 2340 | { |
@@ -2362,7 +2365,6 @@ static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev, | |||
2362 | } | 2365 | } |
2363 | pnp_set_drvdata(pdev, card); | 2366 | pnp_set_drvdata(pdev, card); |
2364 | dev++; | 2367 | dev++; |
2365 | es18xx_pnp_devices++; | ||
2366 | return 0; | 2368 | return 0; |
2367 | } | 2369 | } |
2368 | 2370 | ||
@@ -2424,7 +2426,6 @@ static int __devinit snd_audiodrive_pnpc_detect(struct pnp_card_link *pcard, | |||
2424 | 2426 | ||
2425 | pnp_set_card_drvdata(pcard, card); | 2427 | pnp_set_card_drvdata(pcard, card); |
2426 | dev++; | 2428 | dev++; |
2427 | es18xx_pnp_devices++; | ||
2428 | return 0; | 2429 | return 0; |
2429 | } | 2430 | } |
2430 | 2431 | ||
@@ -2460,44 +2461,14 @@ static struct pnp_card_driver es18xx_pnpc_driver = { | |||
2460 | }; | 2461 | }; |
2461 | #endif /* CONFIG_PNP */ | 2462 | #endif /* CONFIG_PNP */ |
2462 | 2463 | ||
2463 | static void __init_or_module snd_es18xx_unregister_all(void) | ||
2464 | { | ||
2465 | int i; | ||
2466 | |||
2467 | #ifdef CONFIG_PNP | ||
2468 | if (pnpc_registered) | ||
2469 | pnp_unregister_card_driver(&es18xx_pnpc_driver); | ||
2470 | if (pnp_registered) | ||
2471 | pnp_unregister_driver(&es18xx_pnp_driver); | ||
2472 | #endif | ||
2473 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
2474 | platform_device_unregister(platform_devices[i]); | ||
2475 | platform_driver_unregister(&snd_es18xx_nonpnp_driver); | ||
2476 | } | ||
2477 | |||
2478 | static int __init alsa_card_es18xx_init(void) | 2464 | static int __init alsa_card_es18xx_init(void) |
2479 | { | 2465 | { |
2480 | int i, err, cards = 0; | 2466 | int err; |
2481 | 2467 | ||
2482 | if ((err = platform_driver_register(&snd_es18xx_nonpnp_driver)) < 0) | 2468 | err = isa_register_driver(&snd_es18xx_isa_driver, SNDRV_CARDS); |
2469 | if (err < 0) | ||
2483 | return err; | 2470 | return err; |
2484 | 2471 | ||
2485 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
2486 | struct platform_device *device; | ||
2487 | if (! enable[i] || is_isapnp_selected(i)) | ||
2488 | continue; | ||
2489 | device = platform_device_register_simple(ES18XX_DRIVER, | ||
2490 | i, NULL, 0); | ||
2491 | if (IS_ERR(device)) | ||
2492 | continue; | ||
2493 | if (!platform_get_drvdata(device)) { | ||
2494 | platform_device_unregister(device); | ||
2495 | continue; | ||
2496 | } | ||
2497 | platform_devices[i] = device; | ||
2498 | cards++; | ||
2499 | } | ||
2500 | |||
2501 | #ifdef CONFIG_PNP | 2472 | #ifdef CONFIG_PNP |
2502 | err = pnp_register_driver(&es18xx_pnp_driver); | 2473 | err = pnp_register_driver(&es18xx_pnp_driver); |
2503 | if (!err) | 2474 | if (!err) |
@@ -2505,22 +2476,19 @@ static int __init alsa_card_es18xx_init(void) | |||
2505 | err = pnp_register_card_driver(&es18xx_pnpc_driver); | 2476 | err = pnp_register_card_driver(&es18xx_pnpc_driver); |
2506 | if (!err) | 2477 | if (!err) |
2507 | pnpc_registered = 1; | 2478 | pnpc_registered = 1; |
2508 | cards += es18xx_pnp_devices; | ||
2509 | #endif | ||
2510 | |||
2511 | if(!cards) { | ||
2512 | #ifdef MODULE | ||
2513 | snd_printk(KERN_ERR "ESS AudioDrive ES18xx soundcard not found or device busy\n"); | ||
2514 | #endif | 2479 | #endif |
2515 | snd_es18xx_unregister_all(); | ||
2516 | return -ENODEV; | ||
2517 | } | ||
2518 | return 0; | 2480 | return 0; |
2519 | } | 2481 | } |
2520 | 2482 | ||
2521 | static void __exit alsa_card_es18xx_exit(void) | 2483 | static void __exit alsa_card_es18xx_exit(void) |
2522 | { | 2484 | { |
2523 | snd_es18xx_unregister_all(); | 2485 | #ifdef CONFIG_PNP |
2486 | if (pnpc_registered) | ||
2487 | pnp_unregister_card_driver(&es18xx_pnpc_driver); | ||
2488 | if (pnp_registered) | ||
2489 | pnp_unregister_driver(&es18xx_pnp_driver); | ||
2490 | #endif | ||
2491 | isa_unregister_driver(&snd_es18xx_isa_driver); | ||
2524 | } | 2492 | } |
2525 | 2493 | ||
2526 | module_init(alsa_card_es18xx_init) | 2494 | module_init(alsa_card_es18xx_init) |
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index 0395e2e0dd0..8f23f433d49 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/isa.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
@@ -33,8 +33,11 @@ | |||
33 | #define SNDRV_LEGACY_FIND_FREE_DMA | 33 | #define SNDRV_LEGACY_FIND_FREE_DMA |
34 | #include <sound/initval.h> | 34 | #include <sound/initval.h> |
35 | 35 | ||
36 | #define CRD_NAME "Gravis UltraSound Classic" | ||
37 | #define DEV_NAME "gusclassic" | ||
38 | |||
39 | MODULE_DESCRIPTION(CRD_NAME); | ||
36 | MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); | 40 | MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); |
37 | MODULE_DESCRIPTION("Gravis UltraSound Classic"); | ||
38 | MODULE_LICENSE("GPL"); | 41 | MODULE_LICENSE("GPL"); |
39 | MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound Classic}}"); | 42 | MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound Classic}}"); |
40 | 43 | ||
@@ -51,32 +54,80 @@ static int channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 24}; | |||
51 | static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; | 54 | static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; |
52 | 55 | ||
53 | module_param_array(index, int, NULL, 0444); | 56 | module_param_array(index, int, NULL, 0444); |
54 | MODULE_PARM_DESC(index, "Index value for GUS Classic soundcard."); | 57 | MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard."); |
55 | module_param_array(id, charp, NULL, 0444); | 58 | module_param_array(id, charp, NULL, 0444); |
56 | MODULE_PARM_DESC(id, "ID string for GUS Classic soundcard."); | 59 | MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard."); |
57 | module_param_array(enable, bool, NULL, 0444); | 60 | module_param_array(enable, bool, NULL, 0444); |
58 | MODULE_PARM_DESC(enable, "Enable GUS Classic soundcard."); | 61 | MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); |
59 | module_param_array(port, long, NULL, 0444); | 62 | module_param_array(port, long, NULL, 0444); |
60 | MODULE_PARM_DESC(port, "Port # for GUS Classic driver."); | 63 | MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); |
61 | module_param_array(irq, int, NULL, 0444); | 64 | module_param_array(irq, int, NULL, 0444); |
62 | MODULE_PARM_DESC(irq, "IRQ # for GUS Classic driver."); | 65 | MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); |
63 | module_param_array(dma1, int, NULL, 0444); | 66 | module_param_array(dma1, int, NULL, 0444); |
64 | MODULE_PARM_DESC(dma1, "DMA1 # for GUS Classic driver."); | 67 | MODULE_PARM_DESC(dma1, "DMA1 # for " CRD_NAME " driver."); |
65 | module_param_array(dma2, int, NULL, 0444); | 68 | module_param_array(dma2, int, NULL, 0444); |
66 | MODULE_PARM_DESC(dma2, "DMA2 # for GUS Classic driver."); | 69 | MODULE_PARM_DESC(dma2, "DMA2 # for " CRD_NAME " driver."); |
67 | module_param_array(joystick_dac, int, NULL, 0444); | 70 | module_param_array(joystick_dac, int, NULL, 0444); |
68 | MODULE_PARM_DESC(joystick_dac, "Joystick DAC level 0.59V-4.52V or 0.389V-2.98V for GUS Classic driver."); | 71 | MODULE_PARM_DESC(joystick_dac, "Joystick DAC level 0.59V-4.52V or 0.389V-2.98V for " CRD_NAME " driver."); |
69 | module_param_array(channels, int, NULL, 0444); | 72 | module_param_array(channels, int, NULL, 0444); |
70 | MODULE_PARM_DESC(channels, "GF1 channels for GUS Classic driver."); | 73 | MODULE_PARM_DESC(channels, "GF1 channels for " CRD_NAME " driver."); |
71 | module_param_array(pcm_channels, int, NULL, 0444); | 74 | module_param_array(pcm_channels, int, NULL, 0444); |
72 | MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Classic driver."); | 75 | MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for " CRD_NAME " driver."); |
76 | |||
77 | static int __devinit snd_gusclassic_match(struct device *dev, unsigned int n) | ||
78 | { | ||
79 | return enable[n]; | ||
80 | } | ||
81 | |||
82 | static int __devinit snd_gusclassic_create(struct snd_card *card, | ||
83 | struct device *dev, unsigned int n, struct snd_gus_card **rgus) | ||
84 | { | ||
85 | static long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260}; | ||
86 | static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1}; | ||
87 | static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; | ||
88 | |||
89 | int i, error; | ||
90 | |||
91 | if (irq[n] == SNDRV_AUTO_IRQ) { | ||
92 | irq[n] = snd_legacy_find_free_irq(possible_irqs); | ||
93 | if (irq[n] < 0) { | ||
94 | snd_printk(KERN_ERR "%s: unable to find a free IRQ\n", | ||
95 | dev->bus_id); | ||
96 | return -EBUSY; | ||
97 | } | ||
98 | } | ||
99 | if (dma1[n] == SNDRV_AUTO_DMA) { | ||
100 | dma1[n] = snd_legacy_find_free_dma(possible_dmas); | ||
101 | if (dma1[n] < 0) { | ||
102 | snd_printk(KERN_ERR "%s: unable to find a free DMA1\n", | ||
103 | dev->bus_id); | ||
104 | return -EBUSY; | ||
105 | } | ||
106 | } | ||
107 | if (dma2[n] == SNDRV_AUTO_DMA) { | ||
108 | dma2[n] = snd_legacy_find_free_dma(possible_dmas); | ||
109 | if (dma2[n] < 0) { | ||
110 | snd_printk(KERN_ERR "%s: unable to find a free DMA2\n", | ||
111 | dev->bus_id); | ||
112 | return -EBUSY; | ||
113 | } | ||
114 | } | ||
73 | 115 | ||
74 | static struct platform_device *devices[SNDRV_CARDS]; | 116 | if (port[n] != SNDRV_AUTO_PORT) |
117 | return snd_gus_create(card, port[n], irq[n], dma1[n], dma2[n], | ||
118 | 0, channels[n], pcm_channels[n], 0, rgus); | ||
75 | 119 | ||
120 | i = 0; | ||
121 | do { | ||
122 | port[n] = possible_ports[i]; | ||
123 | error = snd_gus_create(card, port[n], irq[n], dma1[n], dma2[n], | ||
124 | 0, channels[n], pcm_channels[n], 0, rgus); | ||
125 | } while (error < 0 && ++i < ARRAY_SIZE(possible_ports)); | ||
76 | 126 | ||
77 | #define PFX "gusclassic: " | 127 | return error; |
128 | } | ||
78 | 129 | ||
79 | static int __devinit snd_gusclassic_detect(struct snd_gus_card * gus) | 130 | static int __devinit snd_gusclassic_detect(struct snd_gus_card *gus) |
80 | { | 131 | { |
81 | unsigned char d; | 132 | unsigned char d; |
82 | 133 | ||
@@ -95,187 +146,104 @@ static int __devinit snd_gusclassic_detect(struct snd_gus_card * gus) | |||
95 | return 0; | 146 | return 0; |
96 | } | 147 | } |
97 | 148 | ||
98 | static void __devinit snd_gusclassic_init(int dev, struct snd_gus_card * gus) | 149 | static int __devinit snd_gusclassic_probe(struct device *dev, unsigned int n) |
99 | { | ||
100 | gus->equal_irq = 0; | ||
101 | gus->codec_flag = 0; | ||
102 | gus->max_flag = 0; | ||
103 | gus->joystick_dac = joystick_dac[dev]; | ||
104 | } | ||
105 | |||
106 | static int __devinit snd_gusclassic_probe(struct platform_device *pdev) | ||
107 | { | 150 | { |
108 | int dev = pdev->id; | ||
109 | static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1}; | ||
110 | static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; | ||
111 | int xirq, xdma1, xdma2; | ||
112 | struct snd_card *card; | 151 | struct snd_card *card; |
113 | struct snd_gus_card *gus = NULL; | 152 | struct snd_gus_card *gus; |
114 | int err; | 153 | int error; |
115 | |||
116 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
117 | if (card == NULL) | ||
118 | return -ENOMEM; | ||
119 | if (pcm_channels[dev] < 2) | ||
120 | pcm_channels[dev] = 2; | ||
121 | |||
122 | xirq = irq[dev]; | ||
123 | if (xirq == SNDRV_AUTO_IRQ) { | ||
124 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { | ||
125 | snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); | ||
126 | err = -EBUSY; | ||
127 | goto _err; | ||
128 | } | ||
129 | } | ||
130 | xdma1 = dma1[dev]; | ||
131 | if (xdma1 == SNDRV_AUTO_DMA) { | ||
132 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { | ||
133 | snd_printk(KERN_ERR PFX "unable to find a free DMA1\n"); | ||
134 | err = -EBUSY; | ||
135 | goto _err; | ||
136 | } | ||
137 | } | ||
138 | xdma2 = dma2[dev]; | ||
139 | if (xdma2 == SNDRV_AUTO_DMA) { | ||
140 | if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { | ||
141 | snd_printk(KERN_ERR PFX "unable to find a free DMA2\n"); | ||
142 | err = -EBUSY; | ||
143 | goto _err; | ||
144 | } | ||
145 | } | ||
146 | 154 | ||
147 | if (port[dev] != SNDRV_AUTO_PORT) { | 155 | card = snd_card_new(index[n], id[n], THIS_MODULE, 0); |
148 | err = snd_gus_create(card, | 156 | if (!card) |
149 | port[dev], | 157 | return -EINVAL; |
150 | xirq, xdma1, xdma2, | ||
151 | 0, channels[dev], pcm_channels[dev], | ||
152 | 0, &gus); | ||
153 | } else { | ||
154 | /* auto-probe legacy ports */ | ||
155 | static unsigned long possible_ports[] = { | ||
156 | 0x220, 0x230, 0x240, 0x250, 0x260, | ||
157 | }; | ||
158 | int i; | ||
159 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { | ||
160 | err = snd_gus_create(card, | ||
161 | possible_ports[i], | ||
162 | xirq, xdma1, xdma2, | ||
163 | 0, channels[dev], pcm_channels[dev], | ||
164 | 0, &gus); | ||
165 | if (err >= 0) { | ||
166 | port[dev] = possible_ports[i]; | ||
167 | break; | ||
168 | } | ||
169 | } | ||
170 | } | ||
171 | if (err < 0) | ||
172 | goto _err; | ||
173 | 158 | ||
174 | if ((err = snd_gusclassic_detect(gus)) < 0) | 159 | if (pcm_channels[n] < 2) |
175 | goto _err; | 160 | pcm_channels[n] = 2; |
176 | 161 | ||
177 | snd_gusclassic_init(dev, gus); | 162 | error = snd_gusclassic_create(card, dev, n, &gus); |
178 | if ((err = snd_gus_initialize(gus)) < 0) | 163 | if (error < 0) |
179 | goto _err; | 164 | goto out; |
180 | 165 | ||
166 | error = snd_gusclassic_detect(gus); | ||
167 | if (error < 0) | ||
168 | goto out; | ||
169 | |||
170 | gus->joystick_dac = joystick_dac[n]; | ||
171 | |||
172 | error = snd_gus_initialize(gus); | ||
173 | if (error < 0) | ||
174 | goto out; | ||
175 | |||
176 | error = -ENODEV; | ||
181 | if (gus->max_flag || gus->ess_flag) { | 177 | if (gus->max_flag || gus->ess_flag) { |
182 | snd_printk(KERN_ERR PFX "GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port); | 178 | snd_printk(KERN_ERR "%s: GUS Classic or ACE soundcard was " |
183 | err = -ENODEV; | 179 | "not detected at 0x%lx\n", dev->bus_id, gus->gf1.port); |
184 | goto _err; | 180 | goto out; |
185 | } | 181 | } |
186 | 182 | ||
187 | if ((err = snd_gf1_new_mixer(gus)) < 0) | 183 | error = snd_gf1_new_mixer(gus); |
188 | goto _err; | 184 | if (error < 0) |
185 | goto out; | ||
189 | 186 | ||
190 | if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0) | 187 | error = snd_gf1_pcm_new(gus, 0, 0, NULL); |
191 | goto _err; | 188 | if (error < 0) |
189 | goto out; | ||
192 | 190 | ||
193 | if (!gus->ace_flag) { | 191 | if (!gus->ace_flag) { |
194 | if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) | 192 | error = snd_gf1_rawmidi_new(gus, 0, NULL); |
195 | goto _err; | 193 | if (error < 0) |
194 | goto out; | ||
196 | } | 195 | } |
197 | sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %d, dma %d", gus->gf1.port, xirq, xdma1); | ||
198 | if (xdma2 >= 0) | ||
199 | sprintf(card->longname + strlen(card->longname), "&%d", xdma2); | ||
200 | 196 | ||
201 | snd_card_set_dev(card, &pdev->dev); | 197 | sprintf(card->longname + strlen(card->longname), |
198 | " at 0x%lx, irq %d, dma %d", | ||
199 | gus->gf1.port, gus->gf1.irq, gus->gf1.dma1); | ||
202 | 200 | ||
203 | if ((err = snd_card_register(card)) < 0) | 201 | if (gus->gf1.dma2 >= 0) |
204 | goto _err; | 202 | sprintf(card->longname + strlen(card->longname), |
203 | "&%d", gus->gf1.dma2); | ||
205 | 204 | ||
206 | platform_set_drvdata(pdev, card); | 205 | snd_card_set_dev(card, dev); |
206 | |||
207 | error = snd_card_register(card); | ||
208 | if (error < 0) | ||
209 | goto out; | ||
210 | |||
211 | dev_set_drvdata(dev, card); | ||
207 | return 0; | 212 | return 0; |
208 | 213 | ||
209 | _err: | 214 | out: snd_card_free(card); |
210 | snd_card_free(card); | 215 | return error; |
211 | return err; | ||
212 | } | 216 | } |
213 | 217 | ||
214 | static int __devexit snd_gusclassic_remove(struct platform_device *devptr) | 218 | static int __devexit snd_gusclassic_remove(struct device *dev, unsigned int n) |
215 | { | 219 | { |
216 | snd_card_free(platform_get_drvdata(devptr)); | 220 | snd_card_free(dev_get_drvdata(dev)); |
217 | platform_set_drvdata(devptr, NULL); | 221 | dev_set_drvdata(dev, NULL); |
218 | return 0; | 222 | return 0; |
219 | } | 223 | } |
220 | 224 | ||
221 | #define GUSCLASSIC_DRIVER "snd_gusclassic" | 225 | static struct isa_driver snd_gusclassic_driver = { |
222 | 226 | .match = snd_gusclassic_match, | |
223 | static struct platform_driver snd_gusclassic_driver = { | ||
224 | .probe = snd_gusclassic_probe, | 227 | .probe = snd_gusclassic_probe, |
225 | .remove = __devexit_p(snd_gusclassic_remove), | 228 | .remove = __devexit_p(snd_gusclassic_remove), |
226 | /* FIXME: suspend/resume */ | 229 | #if 0 /* FIXME */ |
230 | .suspend = snd_gusclassic_suspend, | ||
231 | .remove = snd_gusclassic_remove, | ||
232 | #endif | ||
227 | .driver = { | 233 | .driver = { |
228 | .name = GUSCLASSIC_DRIVER | 234 | .name = DEV_NAME |
229 | }, | 235 | } |
230 | }; | 236 | }; |
231 | 237 | ||
232 | static void __init_or_module snd_gusclassic_unregister_all(void) | ||
233 | { | ||
234 | int i; | ||
235 | |||
236 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
237 | platform_device_unregister(devices[i]); | ||
238 | platform_driver_unregister(&snd_gusclassic_driver); | ||
239 | } | ||
240 | |||
241 | static int __init alsa_card_gusclassic_init(void) | 238 | static int __init alsa_card_gusclassic_init(void) |
242 | { | 239 | { |
243 | int i, cards, err; | 240 | return isa_register_driver(&snd_gusclassic_driver, SNDRV_CARDS); |
244 | |||
245 | err = platform_driver_register(&snd_gusclassic_driver); | ||
246 | if (err < 0) | ||
247 | return err; | ||
248 | |||
249 | cards = 0; | ||
250 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
251 | struct platform_device *device; | ||
252 | if (! enable[i]) | ||
253 | continue; | ||
254 | device = platform_device_register_simple(GUSCLASSIC_DRIVER, | ||
255 | i, NULL, 0); | ||
256 | if (IS_ERR(device)) | ||
257 | continue; | ||
258 | if (!platform_get_drvdata(device)) { | ||
259 | platform_device_unregister(device); | ||
260 | continue; | ||
261 | } | ||
262 | devices[i] = device; | ||
263 | cards++; | ||
264 | } | ||
265 | if (!cards) { | ||
266 | #ifdef MODULE | ||
267 | printk(KERN_ERR "GUS Classic soundcard not found or device busy\n"); | ||
268 | #endif | ||
269 | snd_gusclassic_unregister_all(); | ||
270 | return -ENODEV; | ||
271 | } | ||
272 | return 0; | ||
273 | } | 241 | } |
274 | 242 | ||
275 | static void __exit alsa_card_gusclassic_exit(void) | 243 | static void __exit alsa_card_gusclassic_exit(void) |
276 | { | 244 | { |
277 | snd_gusclassic_unregister_all(); | 245 | isa_unregister_driver(&snd_gusclassic_driver); |
278 | } | 246 | } |
279 | 247 | ||
280 | module_init(alsa_card_gusclassic_init) | 248 | module_init(alsa_card_gusclassic_init); |
281 | module_exit(alsa_card_gusclassic_exit) | 249 | module_exit(alsa_card_gusclassic_exit); |
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index 4f55fc3e66c..0aeaa6cf6cf 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/isa.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
@@ -37,8 +37,11 @@ | |||
37 | #define SNDRV_LEGACY_FIND_FREE_DMA | 37 | #define SNDRV_LEGACY_FIND_FREE_DMA |
38 | #include <sound/initval.h> | 38 | #include <sound/initval.h> |
39 | 39 | ||
40 | #define CRD_NAME "Gravis UltraSound Extreme" | ||
41 | #define DEV_NAME "gusextreme" | ||
42 | |||
43 | MODULE_DESCRIPTION(CRD_NAME); | ||
40 | MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); | 44 | MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); |
41 | MODULE_DESCRIPTION("Gravis UltraSound Extreme"); | ||
42 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
43 | MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound Extreme}}"); | 46 | MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound Extreme}}"); |
44 | 47 | ||
@@ -59,43 +62,107 @@ static int channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 24}; | |||
59 | static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; | 62 | static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; |
60 | 63 | ||
61 | module_param_array(index, int, NULL, 0444); | 64 | module_param_array(index, int, NULL, 0444); |
62 | MODULE_PARM_DESC(index, "Index value for GUS Extreme soundcard."); | 65 | MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard."); |
63 | module_param_array(id, charp, NULL, 0444); | 66 | module_param_array(id, charp, NULL, 0444); |
64 | MODULE_PARM_DESC(id, "ID string for GUS Extreme soundcard."); | 67 | MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard."); |
65 | module_param_array(enable, bool, NULL, 0444); | 68 | module_param_array(enable, bool, NULL, 0444); |
66 | MODULE_PARM_DESC(enable, "Enable GUS Extreme soundcard."); | 69 | MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); |
67 | module_param_array(port, long, NULL, 0444); | 70 | module_param_array(port, long, NULL, 0444); |
68 | MODULE_PARM_DESC(port, "Port # for GUS Extreme driver."); | 71 | MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); |
69 | module_param_array(gf1_port, long, NULL, 0444); | 72 | module_param_array(gf1_port, long, NULL, 0444); |
70 | MODULE_PARM_DESC(gf1_port, "GF1 port # for GUS Extreme driver (optional)."); | 73 | MODULE_PARM_DESC(gf1_port, "GF1 port # for " CRD_NAME " driver (optional)."); |
71 | module_param_array(mpu_port, long, NULL, 0444); | 74 | module_param_array(mpu_port, long, NULL, 0444); |
72 | MODULE_PARM_DESC(mpu_port, "MPU-401 port # for GUS Extreme driver."); | 75 | MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " CRD_NAME " driver."); |
73 | module_param_array(irq, int, NULL, 0444); | 76 | module_param_array(irq, int, NULL, 0444); |
74 | MODULE_PARM_DESC(irq, "IRQ # for GUS Extreme driver."); | 77 | MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); |
75 | module_param_array(mpu_irq, int, NULL, 0444); | 78 | module_param_array(mpu_irq, int, NULL, 0444); |
76 | MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for GUS Extreme driver."); | 79 | MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver."); |
77 | module_param_array(gf1_irq, int, NULL, 0444); | 80 | module_param_array(gf1_irq, int, NULL, 0444); |
78 | MODULE_PARM_DESC(gf1_irq, "GF1 IRQ # for GUS Extreme driver."); | 81 | MODULE_PARM_DESC(gf1_irq, "GF1 IRQ # for " CRD_NAME " driver."); |
79 | module_param_array(dma8, int, NULL, 0444); | 82 | module_param_array(dma8, int, NULL, 0444); |
80 | MODULE_PARM_DESC(dma8, "8-bit DMA # for GUS Extreme driver."); | 83 | MODULE_PARM_DESC(dma8, "8-bit DMA # for " CRD_NAME " driver."); |
81 | module_param_array(dma1, int, NULL, 0444); | 84 | module_param_array(dma1, int, NULL, 0444); |
82 | MODULE_PARM_DESC(dma1, "GF1 DMA # for GUS Extreme driver."); | 85 | MODULE_PARM_DESC(dma1, "GF1 DMA # for " CRD_NAME " driver."); |
83 | module_param_array(joystick_dac, int, NULL, 0444); | 86 | module_param_array(joystick_dac, int, NULL, 0444); |
84 | MODULE_PARM_DESC(joystick_dac, "Joystick DAC level 0.59V-4.52V or 0.389V-2.98V for GUS Extreme driver."); | 87 | MODULE_PARM_DESC(joystick_dac, "Joystick DAC level 0.59V-4.52V or 0.389V-2.98V for " CRD_NAME " driver."); |
85 | module_param_array(channels, int, NULL, 0444); | 88 | module_param_array(channels, int, NULL, 0444); |
86 | MODULE_PARM_DESC(channels, "GF1 channels for GUS Extreme driver."); | 89 | MODULE_PARM_DESC(channels, "GF1 channels for " CRD_NAME " driver."); |
87 | module_param_array(pcm_channels, int, NULL, 0444); | 90 | module_param_array(pcm_channels, int, NULL, 0444); |
88 | MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Extreme driver."); | 91 | MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for " CRD_NAME " driver."); |
92 | |||
93 | static int __devinit snd_gusextreme_match(struct device *dev, unsigned int n) | ||
94 | { | ||
95 | return enable[n]; | ||
96 | } | ||
97 | |||
98 | static int __devinit snd_gusextreme_es1688_create(struct snd_card *card, | ||
99 | struct device *dev, unsigned int n, struct snd_es1688 **rchip) | ||
100 | { | ||
101 | static long possible_ports[] = {0x220, 0x240, 0x260}; | ||
102 | static int possible_irqs[] = {5, 9, 10, 7, -1}; | ||
103 | static int possible_dmas[] = {1, 3, 0, -1}; | ||
104 | |||
105 | int i, error; | ||
106 | |||
107 | if (irq[n] == SNDRV_AUTO_IRQ) { | ||
108 | irq[n] = snd_legacy_find_free_irq(possible_irqs); | ||
109 | if (irq[n] < 0) { | ||
110 | snd_printk(KERN_ERR "%s: unable to find a free IRQ " | ||
111 | "for ES1688\n", dev->bus_id); | ||
112 | return -EBUSY; | ||
113 | } | ||
114 | } | ||
115 | if (dma8[n] == SNDRV_AUTO_DMA) { | ||
116 | dma8[n] = snd_legacy_find_free_dma(possible_dmas); | ||
117 | if (dma8[n] < 0) { | ||
118 | snd_printk(KERN_ERR "%s: unable to find a free DMA " | ||
119 | "for ES1688\n", dev->bus_id); | ||
120 | return -EBUSY; | ||
121 | } | ||
122 | } | ||
89 | 123 | ||
90 | static struct platform_device *devices[SNDRV_CARDS]; | 124 | if (port[n] != SNDRV_AUTO_PORT) |
125 | return snd_es1688_create(card, port[n], mpu_port[n], irq[n], | ||
126 | mpu_irq[n], dma8[n], ES1688_HW_1688, rchip); | ||
91 | 127 | ||
128 | i = 0; | ||
129 | do { | ||
130 | port[n] = possible_ports[i]; | ||
131 | error = snd_es1688_create(card, port[n], mpu_port[n], irq[n], | ||
132 | mpu_irq[n], dma8[n], ES1688_HW_1688, rchip); | ||
133 | } while (error < 0 && ++i < ARRAY_SIZE(possible_ports)); | ||
92 | 134 | ||
93 | #define PFX "gusextreme: " | 135 | return error; |
136 | } | ||
94 | 137 | ||
95 | static int __devinit snd_gusextreme_detect(int dev, | 138 | static int __devinit snd_gusextreme_gus_card_create(struct snd_card *card, |
96 | struct snd_card *card, | 139 | struct device *dev, unsigned int n, struct snd_gus_card **rgus) |
97 | struct snd_gus_card * gus, | 140 | { |
98 | struct snd_es1688 *es1688) | 141 | static int possible_irqs[] = {11, 12, 15, 9, 5, 7, 3, -1}; |
142 | static int possible_dmas[] = {5, 6, 7, 3, 1, -1}; | ||
143 | |||
144 | if (gf1_irq[n] == SNDRV_AUTO_IRQ) { | ||
145 | gf1_irq[n] = snd_legacy_find_free_irq(possible_irqs); | ||
146 | if (gf1_irq[n] < 0) { | ||
147 | snd_printk(KERN_ERR "%s: unable to find a free IRQ " | ||
148 | "for GF1\n", dev->bus_id); | ||
149 | return -EBUSY; | ||
150 | } | ||
151 | } | ||
152 | if (dma1[n] == SNDRV_AUTO_DMA) { | ||
153 | dma1[n] = snd_legacy_find_free_dma(possible_dmas); | ||
154 | if (dma1[n] < 0) { | ||
155 | snd_printk(KERN_ERR "%s: unable to find a free DMA " | ||
156 | "for GF1\n", dev->bus_id); | ||
157 | return -EBUSY; | ||
158 | } | ||
159 | } | ||
160 | return snd_gus_create(card, gf1_port[n], gf1_irq[n], dma1[n], -1, | ||
161 | 0, channels[n], pcm_channels[n], 0, rgus); | ||
162 | } | ||
163 | |||
164 | static int __devinit snd_gusextreme_detect(struct snd_gus_card *gus, | ||
165 | struct snd_es1688 *es1688) | ||
99 | { | 166 | { |
100 | unsigned long flags; | 167 | unsigned long flags; |
101 | unsigned char d; | 168 | unsigned char d; |
@@ -117,12 +184,13 @@ static int __devinit snd_gusextreme_detect(int dev, | |||
117 | spin_lock_irqsave(&es1688->mixer_lock, flags); | 184 | spin_lock_irqsave(&es1688->mixer_lock, flags); |
118 | snd_es1688_mixer_write(es1688, 0x40, 0x0b); /* don't change!!! */ | 185 | snd_es1688_mixer_write(es1688, 0x40, 0x0b); /* don't change!!! */ |
119 | spin_unlock_irqrestore(&es1688->mixer_lock, flags); | 186 | spin_unlock_irqrestore(&es1688->mixer_lock, flags); |
187 | |||
120 | spin_lock_irqsave(&es1688->reg_lock, flags); | 188 | spin_lock_irqsave(&es1688->reg_lock, flags); |
121 | outb(gf1_port[dev] & 0x040 ? 2 : 0, ES1688P(es1688, INIT1)); | 189 | outb(gus->gf1.port & 0x040 ? 2 : 0, ES1688P(es1688, INIT1)); |
122 | outb(0, 0x201); | 190 | outb(0, 0x201); |
123 | outb(gf1_port[dev] & 0x020 ? 2 : 0, ES1688P(es1688, INIT1)); | 191 | outb(gus->gf1.port & 0x020 ? 2 : 0, ES1688P(es1688, INIT1)); |
124 | outb(0, 0x201); | 192 | outb(0, 0x201); |
125 | outb(gf1_port[dev] & 0x010 ? 3 : 1, ES1688P(es1688, INIT1)); | 193 | outb(gus->gf1.port & 0x010 ? 3 : 1, ES1688P(es1688, INIT1)); |
126 | spin_unlock_irqrestore(&es1688->reg_lock, flags); | 194 | spin_unlock_irqrestore(&es1688->reg_lock, flags); |
127 | 195 | ||
128 | udelay(100); | 196 | udelay(100); |
@@ -139,253 +207,172 @@ static int __devinit snd_gusextreme_detect(int dev, | |||
139 | snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d); | 207 | snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d); |
140 | return -EIO; | 208 | return -EIO; |
141 | } | 209 | } |
142 | return 0; | ||
143 | } | ||
144 | 210 | ||
145 | static void __devinit snd_gusextreme_init(int dev, struct snd_gus_card * gus) | 211 | return 0; |
146 | { | ||
147 | gus->joystick_dac = joystick_dac[dev]; | ||
148 | } | 212 | } |
149 | 213 | ||
150 | static int __devinit snd_gusextreme_mixer(struct snd_es1688 *chip) | 214 | static int __devinit snd_gusextreme_mixer(struct snd_es1688 *chip) |
151 | { | 215 | { |
152 | struct snd_card *card = chip->card; | 216 | struct snd_card *card = chip->card; |
153 | struct snd_ctl_elem_id id1, id2; | 217 | struct snd_ctl_elem_id id1, id2; |
154 | int err; | 218 | int error; |
155 | 219 | ||
156 | memset(&id1, 0, sizeof(id1)); | 220 | memset(&id1, 0, sizeof(id1)); |
157 | memset(&id2, 0, sizeof(id2)); | 221 | memset(&id2, 0, sizeof(id2)); |
158 | id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER; | 222 | id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER; |
223 | |||
159 | /* reassign AUX to SYNTHESIZER */ | 224 | /* reassign AUX to SYNTHESIZER */ |
160 | strcpy(id1.name, "Aux Playback Volume"); | 225 | strcpy(id1.name, "Aux Playback Volume"); |
161 | strcpy(id2.name, "Synth Playback Volume"); | 226 | strcpy(id2.name, "Synth Playback Volume"); |
162 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) | 227 | error = snd_ctl_rename_id(card, &id1, &id2); |
163 | return err; | 228 | if (error < 0) |
229 | return error; | ||
230 | |||
164 | /* reassign Master Playback Switch to Synth Playback Switch */ | 231 | /* reassign Master Playback Switch to Synth Playback Switch */ |
165 | strcpy(id1.name, "Master Playback Switch"); | 232 | strcpy(id1.name, "Master Playback Switch"); |
166 | strcpy(id2.name, "Synth Playback Switch"); | 233 | strcpy(id2.name, "Synth Playback Switch"); |
167 | if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) | 234 | error = snd_ctl_rename_id(card, &id1, &id2); |
168 | return err; | 235 | if (error < 0) |
236 | return error; | ||
237 | |||
169 | return 0; | 238 | return 0; |
170 | } | 239 | } |
171 | 240 | ||
172 | static int __devinit snd_gusextreme_probe(struct platform_device *pdev) | 241 | static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n) |
173 | { | 242 | { |
174 | int dev = pdev->id; | ||
175 | static int possible_ess_irqs[] = {5, 9, 10, 7, -1}; | ||
176 | static int possible_ess_dmas[] = {1, 3, 0, -1}; | ||
177 | static int possible_gf1_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; | ||
178 | static int possible_gf1_dmas[] = {5, 6, 7, 1, 3, -1}; | ||
179 | int xgf1_irq, xgf1_dma, xess_irq, xmpu_irq, xess_dma; | ||
180 | struct snd_card *card; | 243 | struct snd_card *card; |
181 | struct snd_gus_card *gus; | 244 | struct snd_gus_card *gus; |
182 | struct snd_es1688 *es1688; | 245 | struct snd_es1688 *es1688; |
183 | struct snd_opl3 *opl3; | 246 | struct snd_opl3 *opl3; |
184 | int err; | 247 | int error; |
185 | 248 | ||
186 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 249 | card = snd_card_new(index[n], id[n], THIS_MODULE, 0); |
187 | if (card == NULL) | 250 | if (!card) |
188 | return -ENOMEM; | 251 | return -EINVAL; |
189 | 252 | ||
190 | xgf1_irq = gf1_irq[dev]; | 253 | if (mpu_port[n] == SNDRV_AUTO_PORT) |
191 | if (xgf1_irq == SNDRV_AUTO_IRQ) { | 254 | mpu_port[n] = 0; |
192 | if ((xgf1_irq = snd_legacy_find_free_irq(possible_gf1_irqs)) < 0) { | ||
193 | snd_printk(KERN_ERR PFX "unable to find a free IRQ for GF1\n"); | ||
194 | err = -EBUSY; | ||
195 | goto out; | ||
196 | } | ||
197 | } | ||
198 | xess_irq = irq[dev]; | ||
199 | if (xess_irq == SNDRV_AUTO_IRQ) { | ||
200 | if ((xess_irq = snd_legacy_find_free_irq(possible_ess_irqs)) < 0) { | ||
201 | snd_printk(KERN_ERR PFX "unable to find a free IRQ for ES1688\n"); | ||
202 | err = -EBUSY; | ||
203 | goto out; | ||
204 | } | ||
205 | } | ||
206 | if (mpu_port[dev] == SNDRV_AUTO_PORT) | ||
207 | mpu_port[dev] = 0; | ||
208 | xmpu_irq = mpu_irq[dev]; | ||
209 | if (xmpu_irq > 15) | ||
210 | xmpu_irq = -1; | ||
211 | xgf1_dma = dma1[dev]; | ||
212 | if (xgf1_dma == SNDRV_AUTO_DMA) { | ||
213 | if ((xgf1_dma = snd_legacy_find_free_dma(possible_gf1_dmas)) < 0) { | ||
214 | snd_printk(KERN_ERR PFX "unable to find a free DMA for GF1\n"); | ||
215 | err = -EBUSY; | ||
216 | goto out; | ||
217 | } | ||
218 | } | ||
219 | xess_dma = dma8[dev]; | ||
220 | if (xess_dma == SNDRV_AUTO_DMA) { | ||
221 | if ((xess_dma = snd_legacy_find_free_dma(possible_ess_dmas)) < 0) { | ||
222 | snd_printk(KERN_ERR PFX "unable to find a free DMA for ES1688\n"); | ||
223 | err = -EBUSY; | ||
224 | goto out; | ||
225 | } | ||
226 | } | ||
227 | 255 | ||
228 | if (port[dev] != SNDRV_AUTO_PORT) { | 256 | if (mpu_irq[n] > 15) |
229 | err = snd_es1688_create(card, port[dev], mpu_port[dev], | 257 | mpu_irq[n] = -1; |
230 | xess_irq, xmpu_irq, xess_dma, | 258 | |
231 | ES1688_HW_1688, &es1688); | 259 | error = snd_gusextreme_es1688_create(card, dev, n, &es1688); |
232 | } else { | 260 | if (error < 0) |
233 | /* auto-probe legacy ports */ | ||
234 | static unsigned long possible_ports[] = {0x220, 0x240, 0x260}; | ||
235 | int i; | ||
236 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { | ||
237 | err = snd_es1688_create(card, | ||
238 | possible_ports[i], | ||
239 | mpu_port[dev], | ||
240 | xess_irq, xmpu_irq, xess_dma, | ||
241 | ES1688_HW_1688, &es1688); | ||
242 | if (err >= 0) { | ||
243 | port[dev] = possible_ports[i]; | ||
244 | break; | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | if (err < 0) | ||
249 | goto out; | 261 | goto out; |
250 | 262 | ||
251 | if (gf1_port[dev] < 0) | 263 | if (gf1_port[n] < 0) |
252 | gf1_port[dev] = port[dev] + 0x20; | 264 | gf1_port[n] = es1688->port + 0x20; |
253 | if ((err = snd_gus_create(card, | 265 | |
254 | gf1_port[dev], | 266 | error = snd_gusextreme_gus_card_create(card, dev, n, &gus); |
255 | xgf1_irq, | 267 | if (error < 0) |
256 | xgf1_dma, | ||
257 | -1, | ||
258 | 0, channels[dev], | ||
259 | pcm_channels[dev], 0, | ||
260 | &gus)) < 0) | ||
261 | goto out; | 268 | goto out; |
262 | 269 | ||
263 | if ((err = snd_gusextreme_detect(dev, card, gus, es1688)) < 0) | 270 | error = snd_gusextreme_detect(gus, es1688); |
271 | if (error < 0) | ||
264 | goto out; | 272 | goto out; |
265 | 273 | ||
266 | snd_gusextreme_init(dev, gus); | 274 | gus->joystick_dac = joystick_dac[n]; |
267 | if ((err = snd_gus_initialize(gus)) < 0) | 275 | |
276 | error = snd_gus_initialize(gus); | ||
277 | if (error < 0) | ||
268 | goto out; | 278 | goto out; |
269 | 279 | ||
280 | error = -ENODEV; | ||
270 | if (!gus->ess_flag) { | 281 | if (!gus->ess_flag) { |
271 | snd_printk(KERN_ERR PFX "GUS Extreme soundcard was not detected at 0x%lx\n", gus->gf1.port); | 282 | snd_printk(KERN_ERR "%s: GUS Extreme soundcard was not " |
272 | err = -ENODEV; | 283 | "detected at 0x%lx\n", dev->bus_id, gus->gf1.port); |
273 | goto out; | 284 | goto out; |
274 | } | 285 | } |
275 | if ((err = snd_es1688_pcm(es1688, 0, NULL)) < 0) | 286 | gus->codec_flag = 1; |
287 | |||
288 | error = snd_es1688_pcm(es1688, 0, NULL); | ||
289 | if (error < 0) | ||
276 | goto out; | 290 | goto out; |
277 | 291 | ||
278 | if ((err = snd_es1688_mixer(es1688)) < 0) | 292 | error = snd_es1688_mixer(es1688); |
293 | if (error < 0) | ||
279 | goto out; | 294 | goto out; |
280 | 295 | ||
281 | snd_component_add(card, "ES1688"); | 296 | snd_component_add(card, "ES1688"); |
282 | if (pcm_channels[dev] > 0) { | 297 | |
283 | if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) | 298 | if (pcm_channels[n] > 0) { |
299 | error = snd_gf1_pcm_new(gus, 1, 1, NULL); | ||
300 | if (error < 0) | ||
284 | goto out; | 301 | goto out; |
285 | } | 302 | } |
286 | if ((err = snd_gf1_new_mixer(gus)) < 0) | 303 | |
304 | error = snd_gf1_new_mixer(gus); | ||
305 | if (error < 0) | ||
287 | goto out; | 306 | goto out; |
288 | 307 | ||
289 | if ((err = snd_gusextreme_mixer(es1688)) < 0) | 308 | error = snd_gusextreme_mixer(es1688); |
309 | if (error < 0) | ||
290 | goto out; | 310 | goto out; |
291 | 311 | ||
292 | if (snd_opl3_create(card, es1688->port, es1688->port + 2, | 312 | if (snd_opl3_create(card, es1688->port, es1688->port + 2, |
293 | OPL3_HW_OPL3, 0, &opl3) < 0) { | 313 | OPL3_HW_OPL3, 0, &opl3) < 0) |
294 | printk(KERN_ERR PFX "gusextreme: opl3 not detected at 0x%lx\n", es1688->port); | 314 | printk(KERN_ERR "%s: opl3 not detected at 0x%lx\n", |
295 | } else { | 315 | dev->bus_id, es1688->port); |
296 | if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0) | 316 | else { |
317 | error = snd_opl3_hwdep_new(opl3, 0, 2, NULL); | ||
318 | if (error < 0) | ||
297 | goto out; | 319 | goto out; |
298 | } | 320 | } |
299 | 321 | ||
300 | if (es1688->mpu_port >= 0x300 && | 322 | if (es1688->mpu_port >= 0x300) { |
301 | (err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688, | 323 | error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688, |
302 | es1688->mpu_port, 0, | 324 | es1688->mpu_port, 0, |
303 | xmpu_irq, | 325 | mpu_irq[n], IRQF_DISABLED, NULL); |
304 | IRQF_DISABLED, | 326 | if (error < 0) |
305 | NULL)) < 0) | 327 | goto out; |
306 | goto out; | 328 | } |
307 | 329 | ||
308 | sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, irq %i&%i, dma %i&%i", | 330 | sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, " |
309 | es1688->port, xgf1_irq, xess_irq, xgf1_dma, xess_dma); | 331 | "irq %i&%i, dma %i&%i", es1688->port, |
332 | gus->gf1.irq, es1688->irq, gus->gf1.dma1, es1688->dma8); | ||
310 | 333 | ||
311 | snd_card_set_dev(card, &pdev->dev); | 334 | snd_card_set_dev(card, dev); |
312 | 335 | ||
313 | if ((err = snd_card_register(card)) < 0) | 336 | error = snd_card_register(card); |
337 | if (error < 0) | ||
314 | goto out; | 338 | goto out; |
315 | 339 | ||
316 | platform_set_drvdata(pdev, card); | 340 | dev_set_drvdata(dev, card); |
317 | return 0; | 341 | return 0; |
318 | 342 | ||
319 | out: | 343 | out: snd_card_free(card); |
320 | snd_card_free(card); | 344 | return error; |
321 | return err; | ||
322 | } | 345 | } |
323 | 346 | ||
324 | static int __devexit snd_gusextreme_remove(struct platform_device *devptr) | 347 | static int __devexit snd_gusextreme_remove(struct device *dev, unsigned int n) |
325 | { | 348 | { |
326 | snd_card_free(platform_get_drvdata(devptr)); | 349 | snd_card_free(dev_get_drvdata(dev)); |
327 | platform_set_drvdata(devptr, NULL); | 350 | dev_set_drvdata(dev, NULL); |
328 | return 0; | 351 | return 0; |
329 | } | 352 | } |
330 | 353 | ||
331 | #define GUSEXTREME_DRIVER "snd_gusextreme" | 354 | static struct isa_driver snd_gusextreme_driver = { |
332 | 355 | .match = snd_gusextreme_match, | |
333 | static struct platform_driver snd_gusextreme_driver = { | ||
334 | .probe = snd_gusextreme_probe, | 356 | .probe = snd_gusextreme_probe, |
335 | .remove = __devexit_p(snd_gusextreme_remove), | 357 | .remove = snd_gusextreme_remove, |
336 | /* FIXME: suspend/resume */ | 358 | #if 0 /* FIXME */ |
359 | .suspend = snd_gusextreme_suspend, | ||
360 | .resume = snd_gusextreme_resume, | ||
361 | #endif | ||
337 | .driver = { | 362 | .driver = { |
338 | .name = GUSEXTREME_DRIVER | 363 | .name = DEV_NAME |
339 | }, | 364 | } |
340 | }; | 365 | }; |
341 | 366 | ||
342 | static void __init_or_module snd_gusextreme_unregister_all(void) | ||
343 | { | ||
344 | int i; | ||
345 | |||
346 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
347 | platform_device_unregister(devices[i]); | ||
348 | platform_driver_unregister(&snd_gusextreme_driver); | ||
349 | } | ||
350 | |||
351 | static int __init alsa_card_gusextreme_init(void) | 367 | static int __init alsa_card_gusextreme_init(void) |
352 | { | 368 | { |
353 | int i, cards, err; | 369 | return isa_register_driver(&snd_gusextreme_driver, SNDRV_CARDS); |
354 | |||
355 | err = platform_driver_register(&snd_gusextreme_driver); | ||
356 | if (err < 0) | ||
357 | return err; | ||
358 | |||
359 | cards = 0; | ||
360 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
361 | struct platform_device *device; | ||
362 | if (! enable[i]) | ||
363 | continue; | ||
364 | device = platform_device_register_simple(GUSEXTREME_DRIVER, | ||
365 | i, NULL, 0); | ||
366 | if (IS_ERR(device)) | ||
367 | continue; | ||
368 | if (!platform_get_drvdata(device)) { | ||
369 | platform_device_unregister(device); | ||
370 | continue; | ||
371 | } | ||
372 | devices[i] = device; | ||
373 | cards++; | ||
374 | } | ||
375 | if (!cards) { | ||
376 | #ifdef MODULE | ||
377 | printk(KERN_ERR "GUS Extreme soundcard not found or device busy\n"); | ||
378 | #endif | ||
379 | snd_gusextreme_unregister_all(); | ||
380 | return -ENODEV; | ||
381 | } | ||
382 | return 0; | ||
383 | } | 370 | } |
384 | 371 | ||
385 | static void __exit alsa_card_gusextreme_exit(void) | 372 | static void __exit alsa_card_gusextreme_exit(void) |
386 | { | 373 | { |
387 | snd_gusextreme_unregister_all(); | 374 | isa_unregister_driver(&snd_gusextreme_driver); |
388 | } | 375 | } |
389 | 376 | ||
390 | module_init(alsa_card_gusextreme_init) | 377 | module_init(alsa_card_gusextreme_init); |
391 | module_exit(alsa_card_gusextreme_exit) | 378 | module_exit(alsa_card_gusextreme_exit); |
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index d1ad90ca035..708783d4351 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/isa.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
@@ -72,8 +72,6 @@ MODULE_PARM_DESC(channels, "Used GF1 channels for GUS MAX driver."); | |||
72 | module_param_array(pcm_channels, int, NULL, 0444); | 72 | module_param_array(pcm_channels, int, NULL, 0444); |
73 | MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS MAX driver."); | 73 | MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS MAX driver."); |
74 | 74 | ||
75 | static struct platform_device *devices[SNDRV_CARDS]; | ||
76 | |||
77 | struct snd_gusmax { | 75 | struct snd_gusmax { |
78 | int irq; | 76 | int irq; |
79 | struct snd_card *card; | 77 | struct snd_card *card; |
@@ -205,9 +203,13 @@ static void snd_gusmax_free(struct snd_card *card) | |||
205 | free_irq(maxcard->irq, (void *)maxcard); | 203 | free_irq(maxcard->irq, (void *)maxcard); |
206 | } | 204 | } |
207 | 205 | ||
208 | static int __devinit snd_gusmax_probe(struct platform_device *pdev) | 206 | static int __devinit snd_gusmax_match(struct device *pdev, unsigned int dev) |
207 | { | ||
208 | return enable[dev]; | ||
209 | } | ||
210 | |||
211 | static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev) | ||
209 | { | 212 | { |
210 | int dev = pdev->id; | ||
211 | static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; | 213 | static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; |
212 | static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; | 214 | static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; |
213 | int xirq, xdma1, xdma2, err; | 215 | int xirq, xdma1, xdma2, err; |
@@ -333,7 +335,7 @@ static int __devinit snd_gusmax_probe(struct platform_device *pdev) | |||
333 | if (xdma2 >= 0) | 335 | if (xdma2 >= 0) |
334 | sprintf(card->longname + strlen(card->longname), "&%i", xdma2); | 336 | sprintf(card->longname + strlen(card->longname), "&%i", xdma2); |
335 | 337 | ||
336 | snd_card_set_dev(card, &pdev->dev); | 338 | snd_card_set_dev(card, pdev); |
337 | 339 | ||
338 | if ((err = snd_card_register(card)) < 0) | 340 | if ((err = snd_card_register(card)) < 0) |
339 | goto _err; | 341 | goto _err; |
@@ -341,7 +343,7 @@ static int __devinit snd_gusmax_probe(struct platform_device *pdev) | |||
341 | maxcard->gus = gus; | 343 | maxcard->gus = gus; |
342 | maxcard->cs4231 = cs4231; | 344 | maxcard->cs4231 = cs4231; |
343 | 345 | ||
344 | platform_set_drvdata(pdev, card); | 346 | dev_set_drvdata(pdev, card); |
345 | return 0; | 347 | return 0; |
346 | 348 | ||
347 | _err: | 349 | _err: |
@@ -349,70 +351,33 @@ static int __devinit snd_gusmax_probe(struct platform_device *pdev) | |||
349 | return err; | 351 | return err; |
350 | } | 352 | } |
351 | 353 | ||
352 | static int __devexit snd_gusmax_remove(struct platform_device *devptr) | 354 | static int __devexit snd_gusmax_remove(struct device *devptr, unsigned int dev) |
353 | { | 355 | { |
354 | snd_card_free(platform_get_drvdata(devptr)); | 356 | snd_card_free(dev_get_drvdata(devptr)); |
355 | platform_set_drvdata(devptr, NULL); | 357 | dev_set_drvdata(devptr, NULL); |
356 | return 0; | 358 | return 0; |
357 | } | 359 | } |
358 | 360 | ||
359 | #define GUSMAX_DRIVER "snd_gusmax" | 361 | #define DEV_NAME "gusmax" |
360 | 362 | ||
361 | static struct platform_driver snd_gusmax_driver = { | 363 | static struct isa_driver snd_gusmax_driver = { |
364 | .match = snd_gusmax_match, | ||
362 | .probe = snd_gusmax_probe, | 365 | .probe = snd_gusmax_probe, |
363 | .remove = __devexit_p(snd_gusmax_remove), | 366 | .remove = __devexit_p(snd_gusmax_remove), |
364 | /* FIXME: suspend/resume */ | 367 | /* FIXME: suspend/resume */ |
365 | .driver = { | 368 | .driver = { |
366 | .name = GUSMAX_DRIVER | 369 | .name = DEV_NAME |
367 | }, | 370 | }, |
368 | }; | 371 | }; |
369 | 372 | ||
370 | static void __init_or_module snd_gusmax_unregister_all(void) | ||
371 | { | ||
372 | int i; | ||
373 | |||
374 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
375 | platform_device_unregister(devices[i]); | ||
376 | platform_driver_unregister(&snd_gusmax_driver); | ||
377 | } | ||
378 | |||
379 | static int __init alsa_card_gusmax_init(void) | 373 | static int __init alsa_card_gusmax_init(void) |
380 | { | 374 | { |
381 | int i, cards, err; | 375 | return isa_register_driver(&snd_gusmax_driver, SNDRV_CARDS); |
382 | |||
383 | err = platform_driver_register(&snd_gusmax_driver); | ||
384 | if (err < 0) | ||
385 | return err; | ||
386 | |||
387 | cards = 0; | ||
388 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
389 | struct platform_device *device; | ||
390 | if (! enable[i]) | ||
391 | continue; | ||
392 | device = platform_device_register_simple(GUSMAX_DRIVER, | ||
393 | i, NULL, 0); | ||
394 | if (IS_ERR(device)) | ||
395 | continue; | ||
396 | if (!platform_get_drvdata(device)) { | ||
397 | platform_device_unregister(device); | ||
398 | continue; | ||
399 | } | ||
400 | devices[i] = device; | ||
401 | cards++; | ||
402 | } | ||
403 | if (!cards) { | ||
404 | #ifdef MODULE | ||
405 | printk(KERN_ERR "GUS MAX soundcard not found or device busy\n"); | ||
406 | #endif | ||
407 | snd_gusmax_unregister_all(); | ||
408 | return -ENODEV; | ||
409 | } | ||
410 | return 0; | ||
411 | } | 376 | } |
412 | 377 | ||
413 | static void __exit alsa_card_gusmax_exit(void) | 378 | static void __exit alsa_card_gusmax_exit(void) |
414 | { | 379 | { |
415 | snd_gusmax_unregister_all(); | 380 | isa_unregister_driver(&snd_gusmax_driver); |
416 | } | 381 | } |
417 | 382 | ||
418 | module_init(alsa_card_gusmax_init) | 383 | module_init(alsa_card_gusmax_init) |
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 4ec2d79431f..3e465725553 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <sound/driver.h> | 25 | #include <sound/driver.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/err.h> | 27 | #include <linux/err.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/isa.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/pnp.h> | 31 | #include <linux/pnp.h> |
@@ -115,9 +115,6 @@ MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for InterWave driver."); | |||
115 | module_param_array(effect, int, NULL, 0444); | 115 | module_param_array(effect, int, NULL, 0444); |
116 | MODULE_PARM_DESC(effect, "Effects enable for InterWave driver."); | 116 | MODULE_PARM_DESC(effect, "Effects enable for InterWave driver."); |
117 | 117 | ||
118 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
119 | static int pnp_registered; | ||
120 | |||
121 | struct snd_interwave { | 118 | struct snd_interwave { |
122 | int irq; | 119 | int irq; |
123 | struct snd_card *card; | 120 | struct snd_card *card; |
@@ -138,6 +135,7 @@ struct snd_interwave { | |||
138 | 135 | ||
139 | 136 | ||
140 | #ifdef CONFIG_PNP | 137 | #ifdef CONFIG_PNP |
138 | static int pnp_registered; | ||
141 | 139 | ||
142 | static struct pnp_card_device_id snd_interwave_pnpids[] = { | 140 | static struct pnp_card_device_id snd_interwave_pnpids[] = { |
143 | #ifndef SNDRV_STB | 141 | #ifndef SNDRV_STB |
@@ -793,7 +791,7 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev) | |||
793 | return 0; | 791 | return 0; |
794 | } | 792 | } |
795 | 793 | ||
796 | static int __devinit snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr) | 794 | static int __devinit snd_interwave_isa_probe1(int dev, struct device *devptr) |
797 | { | 795 | { |
798 | struct snd_card *card; | 796 | struct snd_card *card; |
799 | int err; | 797 | int err; |
@@ -802,18 +800,30 @@ static int __devinit snd_interwave_nonpnp_probe1(int dev, struct platform_device | |||
802 | if (! card) | 800 | if (! card) |
803 | return -ENOMEM; | 801 | return -ENOMEM; |
804 | 802 | ||
805 | snd_card_set_dev(card, &devptr->dev); | 803 | snd_card_set_dev(card, devptr); |
806 | if ((err = snd_interwave_probe(card, dev)) < 0) { | 804 | if ((err = snd_interwave_probe(card, dev)) < 0) { |
807 | snd_card_free(card); | 805 | snd_card_free(card); |
808 | return err; | 806 | return err; |
809 | } | 807 | } |
810 | platform_set_drvdata(devptr, card); | 808 | dev_set_drvdata(devptr, card); |
811 | return 0; | 809 | return 0; |
812 | } | 810 | } |
813 | 811 | ||
814 | static int __devinit snd_interwave_nonpnp_probe(struct platform_device *pdev) | 812 | static int __devinit snd_interwave_isa_match(struct device *pdev, |
813 | unsigned int dev) | ||
814 | { | ||
815 | if (!enable[dev]) | ||
816 | return 0; | ||
817 | #ifdef CONFIG_PNP | ||
818 | if (isapnp[dev]) | ||
819 | return 0; | ||
820 | #endif | ||
821 | return 1; | ||
822 | } | ||
823 | |||
824 | static int __devinit snd_interwave_isa_probe(struct device *pdev, | ||
825 | unsigned int dev) | ||
815 | { | 826 | { |
816 | int dev = pdev->id; | ||
817 | int err; | 827 | int err; |
818 | static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; | 828 | static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; |
819 | static int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1}; | 829 | static int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1}; |
@@ -838,13 +848,13 @@ static int __devinit snd_interwave_nonpnp_probe(struct platform_device *pdev) | |||
838 | } | 848 | } |
839 | 849 | ||
840 | if (port[dev] != SNDRV_AUTO_PORT) | 850 | if (port[dev] != SNDRV_AUTO_PORT) |
841 | return snd_interwave_nonpnp_probe1(dev, pdev); | 851 | return snd_interwave_isa_probe1(dev, pdev); |
842 | else { | 852 | else { |
843 | static long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260}; | 853 | static long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260}; |
844 | int i; | 854 | int i; |
845 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { | 855 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { |
846 | port[dev] = possible_ports[i]; | 856 | port[dev] = possible_ports[i]; |
847 | err = snd_interwave_nonpnp_probe1(dev, pdev); | 857 | err = snd_interwave_isa_probe1(dev, pdev); |
848 | if (! err) | 858 | if (! err) |
849 | return 0; | 859 | return 0; |
850 | } | 860 | } |
@@ -852,16 +862,17 @@ static int __devinit snd_interwave_nonpnp_probe(struct platform_device *pdev) | |||
852 | } | 862 | } |
853 | } | 863 | } |
854 | 864 | ||
855 | static int __devexit snd_interwave_nonpnp_remove(struct platform_device *devptr) | 865 | static int __devexit snd_interwave_isa_remove(struct device *devptr, unsigned int dev) |
856 | { | 866 | { |
857 | snd_card_free(platform_get_drvdata(devptr)); | 867 | snd_card_free(dev_get_drvdata(devptr)); |
858 | platform_set_drvdata(devptr, NULL); | 868 | dev_set_drvdata(devptr, NULL); |
859 | return 0; | 869 | return 0; |
860 | } | 870 | } |
861 | 871 | ||
862 | static struct platform_driver snd_interwave_driver = { | 872 | static struct isa_driver snd_interwave_driver = { |
863 | .probe = snd_interwave_nonpnp_probe, | 873 | .match = snd_interwave_isa_match, |
864 | .remove = __devexit_p(snd_interwave_nonpnp_remove), | 874 | .probe = snd_interwave_isa_probe, |
875 | .remove = __devexit_p(snd_interwave_isa_remove), | ||
865 | /* FIXME: suspend,resume */ | 876 | /* FIXME: suspend,resume */ |
866 | .driver = { | 877 | .driver = { |
867 | .name = INTERWAVE_DRIVER | 878 | .name = INTERWAVE_DRIVER |
@@ -869,8 +880,6 @@ static struct platform_driver snd_interwave_driver = { | |||
869 | }; | 880 | }; |
870 | 881 | ||
871 | #ifdef CONFIG_PNP | 882 | #ifdef CONFIG_PNP |
872 | static unsigned int __devinitdata interwave_pnp_devices; | ||
873 | |||
874 | static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, | 883 | static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, |
875 | const struct pnp_card_device_id *pid) | 884 | const struct pnp_card_device_id *pid) |
876 | { | 885 | { |
@@ -900,7 +909,6 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, | |||
900 | } | 909 | } |
901 | pnp_set_card_drvdata(pcard, card); | 910 | pnp_set_card_drvdata(pcard, card); |
902 | dev++; | 911 | dev++; |
903 | interwave_pnp_devices++; | ||
904 | return 0; | 912 | return 0; |
905 | } | 913 | } |
906 | 914 | ||
@@ -921,64 +929,29 @@ static struct pnp_card_driver interwave_pnpc_driver = { | |||
921 | 929 | ||
922 | #endif /* CONFIG_PNP */ | 930 | #endif /* CONFIG_PNP */ |
923 | 931 | ||
924 | static void __init_or_module snd_interwave_unregister_all(void) | ||
925 | { | ||
926 | int i; | ||
927 | |||
928 | if (pnp_registered) | ||
929 | pnp_unregister_card_driver(&interwave_pnpc_driver); | ||
930 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
931 | platform_device_unregister(platform_devices[i]); | ||
932 | platform_driver_unregister(&snd_interwave_driver); | ||
933 | } | ||
934 | |||
935 | static int __init alsa_card_interwave_init(void) | 932 | static int __init alsa_card_interwave_init(void) |
936 | { | 933 | { |
937 | int i, err, cards = 0; | 934 | int err; |
938 | 935 | ||
939 | if ((err = platform_driver_register(&snd_interwave_driver)) < 0) | 936 | err = isa_register_driver(&snd_interwave_driver, SNDRV_CARDS); |
937 | if (err < 0) | ||
940 | return err; | 938 | return err; |
941 | |||
942 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
943 | struct platform_device *device; | ||
944 | if (! enable[i]) | ||
945 | continue; | ||
946 | #ifdef CONFIG_PNP | 939 | #ifdef CONFIG_PNP |
947 | if (isapnp[i]) | ||
948 | continue; | ||
949 | #endif | ||
950 | device = platform_device_register_simple(INTERWAVE_DRIVER, | ||
951 | i, NULL, 0); | ||
952 | if (IS_ERR(device)) | ||
953 | continue; | ||
954 | if (!platform_get_drvdata(device)) { | ||
955 | platform_device_unregister(device); | ||
956 | continue; | ||
957 | } | ||
958 | platform_devices[i] = device; | ||
959 | cards++; | ||
960 | } | ||
961 | |||
962 | /* ISA PnP cards */ | 940 | /* ISA PnP cards */ |
963 | err = pnp_register_card_driver(&interwave_pnpc_driver); | 941 | err = pnp_register_card_driver(&interwave_pnpc_driver); |
964 | if (!err) { | 942 | if (!err) |
965 | pnp_registered = 1; | 943 | pnp_registered = 1; |
966 | cards += interwave_pnp_devices;; | ||
967 | } | ||
968 | |||
969 | if (!cards) { | ||
970 | #ifdef MODULE | ||
971 | printk(KERN_ERR "InterWave soundcard not found or device busy\n"); | ||
972 | #endif | 944 | #endif |
973 | snd_interwave_unregister_all(); | ||
974 | return -ENODEV; | ||
975 | } | ||
976 | return 0; | 945 | return 0; |
977 | } | 946 | } |
978 | 947 | ||
979 | static void __exit alsa_card_interwave_exit(void) | 948 | static void __exit alsa_card_interwave_exit(void) |
980 | { | 949 | { |
981 | snd_interwave_unregister_all(); | 950 | #ifdef CONFIG_PNP |
951 | if (pnp_registered) | ||
952 | pnp_unregister_card_driver(&interwave_pnpc_driver); | ||
953 | #endif | ||
954 | isa_unregister_driver(&snd_interwave_driver); | ||
982 | } | 955 | } |
983 | 956 | ||
984 | module_init(alsa_card_interwave_init) | 957 | module_init(alsa_card_interwave_init) |
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index f3db686b1c0..48743eb85fb 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/isa.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/pm.h> | 27 | #include <linux/pm.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
@@ -91,12 +91,10 @@ MODULE_PARM_DESC(dma2, "DMA2 # for OPL3-SA driver."); | |||
91 | module_param_array(opl3sa3_ymode, int, NULL, 0444); | 91 | module_param_array(opl3sa3_ymode, int, NULL, 0444); |
92 | MODULE_PARM_DESC(opl3sa3_ymode, "Speaker size selection for 3D Enhancement mode: Desktop/Large Notebook/Small Notebook/HiFi."); | 92 | MODULE_PARM_DESC(opl3sa3_ymode, "Speaker size selection for 3D Enhancement mode: Desktop/Large Notebook/Small Notebook/HiFi."); |
93 | 93 | ||
94 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
95 | #ifdef CONFIG_PNP | 94 | #ifdef CONFIG_PNP |
96 | static int pnp_registered; | 95 | static int pnp_registered; |
97 | static int pnpc_registered; | 96 | static int pnpc_registered; |
98 | #endif | 97 | #endif |
99 | static unsigned int snd_opl3sa2_devices; | ||
100 | 98 | ||
101 | /* control ports */ | 99 | /* control ports */ |
102 | #define OPL3SA2_PM_CTRL 0x01 | 100 | #define OPL3SA2_PM_CTRL 0x01 |
@@ -783,7 +781,6 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev, | |||
783 | } | 781 | } |
784 | pnp_set_drvdata(pdev, card); | 782 | pnp_set_drvdata(pdev, card); |
785 | dev++; | 783 | dev++; |
786 | snd_opl3sa2_devices++; | ||
787 | return 0; | 784 | return 0; |
788 | } | 785 | } |
789 | 786 | ||
@@ -850,7 +847,6 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard, | |||
850 | } | 847 | } |
851 | pnp_set_card_drvdata(pcard, card); | 848 | pnp_set_card_drvdata(pcard, card); |
852 | dev++; | 849 | dev++; |
853 | snd_opl3sa2_devices++; | ||
854 | return 0; | 850 | return 0; |
855 | } | 851 | } |
856 | 852 | ||
@@ -884,116 +880,95 @@ static struct pnp_card_driver opl3sa2_pnpc_driver = { | |||
884 | }; | 880 | }; |
885 | #endif /* CONFIG_PNP */ | 881 | #endif /* CONFIG_PNP */ |
886 | 882 | ||
887 | static int __devinit snd_opl3sa2_nonpnp_probe(struct platform_device *pdev) | 883 | static int __devinit snd_opl3sa2_isa_match(struct device *pdev, |
884 | unsigned int dev) | ||
888 | { | 885 | { |
889 | struct snd_card *card; | 886 | if (!enable[dev]) |
890 | int err; | 887 | return 0; |
891 | int dev = pdev->id; | 888 | #ifdef CONFIG_PNP |
892 | 889 | if (isapnp[dev]) | |
890 | return 0; | ||
891 | #endif | ||
893 | if (port[dev] == SNDRV_AUTO_PORT) { | 892 | if (port[dev] == SNDRV_AUTO_PORT) { |
894 | snd_printk(KERN_ERR PFX "specify port\n"); | 893 | snd_printk(KERN_ERR PFX "specify port\n"); |
895 | return -EINVAL; | 894 | return 0; |
896 | } | 895 | } |
897 | if (wss_port[dev] == SNDRV_AUTO_PORT) { | 896 | if (wss_port[dev] == SNDRV_AUTO_PORT) { |
898 | snd_printk(KERN_ERR PFX "specify wss_port\n"); | 897 | snd_printk(KERN_ERR PFX "specify wss_port\n"); |
899 | return -EINVAL; | 898 | return 0; |
900 | } | 899 | } |
901 | if (fm_port[dev] == SNDRV_AUTO_PORT) { | 900 | if (fm_port[dev] == SNDRV_AUTO_PORT) { |
902 | snd_printk(KERN_ERR PFX "specify fm_port\n"); | 901 | snd_printk(KERN_ERR PFX "specify fm_port\n"); |
903 | return -EINVAL; | 902 | return 0; |
904 | } | 903 | } |
905 | if (midi_port[dev] == SNDRV_AUTO_PORT) { | 904 | if (midi_port[dev] == SNDRV_AUTO_PORT) { |
906 | snd_printk(KERN_ERR PFX "specify midi_port\n"); | 905 | snd_printk(KERN_ERR PFX "specify midi_port\n"); |
907 | return -EINVAL; | 906 | return 0; |
908 | } | 907 | } |
908 | return 1; | ||
909 | } | ||
910 | |||
911 | static int __devinit snd_opl3sa2_isa_probe(struct device *pdev, | ||
912 | unsigned int dev) | ||
913 | { | ||
914 | struct snd_card *card; | ||
915 | int err; | ||
909 | 916 | ||
910 | card = snd_opl3sa2_card_new(dev); | 917 | card = snd_opl3sa2_card_new(dev); |
911 | if (! card) | 918 | if (! card) |
912 | return -ENOMEM; | 919 | return -ENOMEM; |
913 | snd_card_set_dev(card, &pdev->dev); | 920 | snd_card_set_dev(card, pdev); |
914 | if ((err = snd_opl3sa2_probe(card, dev)) < 0) { | 921 | if ((err = snd_opl3sa2_probe(card, dev)) < 0) { |
915 | snd_card_free(card); | 922 | snd_card_free(card); |
916 | return err; | 923 | return err; |
917 | } | 924 | } |
918 | platform_set_drvdata(pdev, card); | 925 | dev_set_drvdata(pdev, card); |
919 | return 0; | 926 | return 0; |
920 | } | 927 | } |
921 | 928 | ||
922 | static int __devexit snd_opl3sa2_nonpnp_remove(struct platform_device *devptr) | 929 | static int __devexit snd_opl3sa2_isa_remove(struct device *devptr, |
930 | unsigned int dev) | ||
923 | { | 931 | { |
924 | snd_card_free(platform_get_drvdata(devptr)); | 932 | snd_card_free(dev_get_drvdata(devptr)); |
925 | platform_set_drvdata(devptr, NULL); | 933 | dev_set_drvdata(devptr, NULL); |
926 | return 0; | 934 | return 0; |
927 | } | 935 | } |
928 | 936 | ||
929 | #ifdef CONFIG_PM | 937 | #ifdef CONFIG_PM |
930 | static int snd_opl3sa2_nonpnp_suspend(struct platform_device *dev, pm_message_t state) | 938 | static int snd_opl3sa2_isa_suspend(struct device *dev, unsigned int n, |
939 | pm_message_t state) | ||
931 | { | 940 | { |
932 | return snd_opl3sa2_suspend(platform_get_drvdata(dev), state); | 941 | return snd_opl3sa2_suspend(dev_get_drvdata(dev), state); |
933 | } | 942 | } |
934 | 943 | ||
935 | static int snd_opl3sa2_nonpnp_resume(struct platform_device *dev) | 944 | static int snd_opl3sa2_isa_resume(struct device *dev, unsigned int n) |
936 | { | 945 | { |
937 | return snd_opl3sa2_resume(platform_get_drvdata(dev)); | 946 | return snd_opl3sa2_resume(dev_get_drvdata(dev)); |
938 | } | 947 | } |
939 | #endif | 948 | #endif |
940 | 949 | ||
941 | #define OPL3SA2_DRIVER "snd_opl3sa2" | 950 | #define DEV_NAME "opl3sa2" |
942 | 951 | ||
943 | static struct platform_driver snd_opl3sa2_nonpnp_driver = { | 952 | static struct isa_driver snd_opl3sa2_isa_driver = { |
944 | .probe = snd_opl3sa2_nonpnp_probe, | 953 | .match = snd_opl3sa2_isa_match, |
945 | .remove = __devexit( snd_opl3sa2_nonpnp_remove), | 954 | .probe = snd_opl3sa2_isa_probe, |
955 | .remove = __devexit( snd_opl3sa2_isa_remove), | ||
946 | #ifdef CONFIG_PM | 956 | #ifdef CONFIG_PM |
947 | .suspend = snd_opl3sa2_nonpnp_suspend, | 957 | .suspend = snd_opl3sa2_isa_suspend, |
948 | .resume = snd_opl3sa2_nonpnp_resume, | 958 | .resume = snd_opl3sa2_isa_resume, |
949 | #endif | 959 | #endif |
950 | .driver = { | 960 | .driver = { |
951 | .name = OPL3SA2_DRIVER | 961 | .name = DEV_NAME |
952 | }, | 962 | }, |
953 | }; | 963 | }; |
954 | 964 | ||
955 | static void __init_or_module snd_opl3sa2_unregister_all(void) | ||
956 | { | ||
957 | int i; | ||
958 | |||
959 | #ifdef CONFIG_PNP | ||
960 | if (pnpc_registered) | ||
961 | pnp_unregister_card_driver(&opl3sa2_pnpc_driver); | ||
962 | if (pnp_registered) | ||
963 | pnp_unregister_driver(&opl3sa2_pnp_driver); | ||
964 | #endif | ||
965 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
966 | platform_device_unregister(platform_devices[i]); | ||
967 | platform_driver_unregister(&snd_opl3sa2_nonpnp_driver); | ||
968 | } | ||
969 | |||
970 | static int __init alsa_card_opl3sa2_init(void) | 965 | static int __init alsa_card_opl3sa2_init(void) |
971 | { | 966 | { |
972 | int i, err; | 967 | int err; |
973 | 968 | ||
974 | if ((err = platform_driver_register(&snd_opl3sa2_nonpnp_driver)) < 0) | 969 | err = isa_register_driver(&snd_opl3sa2_isa_driver, SNDRV_CARDS); |
970 | if (err < 0) | ||
975 | return err; | 971 | return err; |
976 | |||
977 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
978 | struct platform_device *device; | ||
979 | if (! enable[i]) | ||
980 | continue; | ||
981 | #ifdef CONFIG_PNP | ||
982 | if (isapnp[i]) | ||
983 | continue; | ||
984 | #endif | ||
985 | device = platform_device_register_simple(OPL3SA2_DRIVER, | ||
986 | i, NULL, 0); | ||
987 | if (IS_ERR(device)) | ||
988 | continue; | ||
989 | if (!platform_get_drvdata(device)) { | ||
990 | platform_device_unregister(device); | ||
991 | continue; | ||
992 | } | ||
993 | platform_devices[i] = device; | ||
994 | snd_opl3sa2_devices++; | ||
995 | } | ||
996 | |||
997 | #ifdef CONFIG_PNP | 972 | #ifdef CONFIG_PNP |
998 | err = pnp_register_driver(&opl3sa2_pnp_driver); | 973 | err = pnp_register_driver(&opl3sa2_pnp_driver); |
999 | if (!err) | 974 | if (!err) |
@@ -1002,20 +977,18 @@ static int __init alsa_card_opl3sa2_init(void) | |||
1002 | if (!err) | 977 | if (!err) |
1003 | pnpc_registered = 1; | 978 | pnpc_registered = 1; |
1004 | #endif | 979 | #endif |
1005 | |||
1006 | if (!snd_opl3sa2_devices) { | ||
1007 | #ifdef MODULE | ||
1008 | snd_printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n"); | ||
1009 | #endif | ||
1010 | snd_opl3sa2_unregister_all(); | ||
1011 | return -ENODEV; | ||
1012 | } | ||
1013 | return 0; | 980 | return 0; |
1014 | } | 981 | } |
1015 | 982 | ||
1016 | static void __exit alsa_card_opl3sa2_exit(void) | 983 | static void __exit alsa_card_opl3sa2_exit(void) |
1017 | { | 984 | { |
1018 | snd_opl3sa2_unregister_all(); | 985 | #ifdef CONFIG_PNP |
986 | if (pnpc_registered) | ||
987 | pnp_unregister_card_driver(&opl3sa2_pnpc_driver); | ||
988 | if (pnp_registered) | ||
989 | pnp_unregister_driver(&opl3sa2_pnp_driver); | ||
990 | #endif | ||
991 | isa_unregister_driver(&snd_opl3sa2_isa_driver); | ||
1019 | } | 992 | } |
1020 | 993 | ||
1021 | module_init(alsa_card_opl3sa2_init) | 994 | module_init(alsa_card_opl3sa2_init) |
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 1dd98375ac8..cd29b30b362 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <sound/driver.h> | 25 | #include <sound/driver.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/err.h> | 27 | #include <linux/err.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/isa.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/ioport.h> | 31 | #include <linux/ioport.h> |
@@ -137,10 +137,6 @@ struct snd_miro { | |||
137 | 137 | ||
138 | static void snd_miro_proc_init(struct snd_miro * miro); | 138 | static void snd_miro_proc_init(struct snd_miro * miro); |
139 | 139 | ||
140 | #define DRIVER_NAME "snd-miro" | ||
141 | |||
142 | static struct platform_device *device; | ||
143 | |||
144 | static char * snd_opti9xx_names[] = { | 140 | static char * snd_opti9xx_names[] = { |
145 | "unkown", | 141 | "unkown", |
146 | "82C928", "82C929", | 142 | "82C928", "82C929", |
@@ -558,7 +554,7 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol, | |||
558 | return change; | 554 | return change; |
559 | } | 555 | } |
560 | 556 | ||
561 | static struct snd_kcontrol_new snd_miro_controls[] = { | 557 | static struct snd_kcontrol_new snd_miro_controls[] __devinitdata = { |
562 | MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER), | 558 | MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER), |
563 | MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC), | 559 | MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC), |
564 | MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE), | 560 | MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE), |
@@ -570,7 +566,7 @@ MIRO_DOUBLE("Aux Playback Volume", 2, ACI_GET_LINE2, ACI_SET_LINE2), | |||
570 | 566 | ||
571 | /* Equalizer with seven bands (only PCM20) | 567 | /* Equalizer with seven bands (only PCM20) |
572 | from -12dB up to +12dB on each band */ | 568 | from -12dB up to +12dB on each band */ |
573 | static struct snd_kcontrol_new snd_miro_eq_controls[] = { | 569 | static struct snd_kcontrol_new snd_miro_eq_controls[] __devinitdata = { |
574 | MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1), | 570 | MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1), |
575 | MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2), | 571 | MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2), |
576 | MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3), | 572 | MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3), |
@@ -580,15 +576,15 @@ MIRO_DOUBLE("Tone Control - 6.3 kHz", 0, ACI_GET_EQ6, ACI_SET_EQ6), | |||
580 | MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), | 576 | MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), |
581 | }; | 577 | }; |
582 | 578 | ||
583 | static struct snd_kcontrol_new snd_miro_radio_control[] = { | 579 | static struct snd_kcontrol_new snd_miro_radio_control[] __devinitdata = { |
584 | MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), | 580 | MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), |
585 | }; | 581 | }; |
586 | 582 | ||
587 | static struct snd_kcontrol_new snd_miro_line_control[] = { | 583 | static struct snd_kcontrol_new snd_miro_line_control[] __devinitdata = { |
588 | MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), | 584 | MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), |
589 | }; | 585 | }; |
590 | 586 | ||
591 | static struct snd_kcontrol_new snd_miro_preamp_control[] = { | 587 | static struct snd_kcontrol_new snd_miro_preamp_control[] __devinitdata = { |
592 | { | 588 | { |
593 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 589 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
594 | .name = "Mic Boost", | 590 | .name = "Mic Boost", |
@@ -598,7 +594,7 @@ static struct snd_kcontrol_new snd_miro_preamp_control[] = { | |||
598 | .put = snd_miro_put_preamp, | 594 | .put = snd_miro_put_preamp, |
599 | }}; | 595 | }}; |
600 | 596 | ||
601 | static struct snd_kcontrol_new snd_miro_amp_control[] = { | 597 | static struct snd_kcontrol_new snd_miro_amp_control[] __devinitdata = { |
602 | { | 598 | { |
603 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 599 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
604 | .name = "Line Boost", | 600 | .name = "Line Boost", |
@@ -608,7 +604,7 @@ static struct snd_kcontrol_new snd_miro_amp_control[] = { | |||
608 | .put = snd_miro_put_amp, | 604 | .put = snd_miro_put_amp, |
609 | }}; | 605 | }}; |
610 | 606 | ||
611 | static struct snd_kcontrol_new snd_miro_capture_control[] = { | 607 | static struct snd_kcontrol_new snd_miro_capture_control[] __devinitdata = { |
612 | { | 608 | { |
613 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 609 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
614 | .name = "PCM Capture Switch", | 610 | .name = "PCM Capture Switch", |
@@ -618,7 +614,7 @@ static struct snd_kcontrol_new snd_miro_capture_control[] = { | |||
618 | .put = snd_miro_put_capture, | 614 | .put = snd_miro_put_capture, |
619 | }}; | 615 | }}; |
620 | 616 | ||
621 | static unsigned char aci_init_values[][2] __initdata = { | 617 | static unsigned char aci_init_values[][2] __devinitdata = { |
622 | { ACI_SET_MUTE, 0x00 }, | 618 | { ACI_SET_MUTE, 0x00 }, |
623 | { ACI_SET_POWERAMP, 0x00 }, | 619 | { ACI_SET_POWERAMP, 0x00 }, |
624 | { ACI_SET_PREAMP, 0x00 }, | 620 | { ACI_SET_PREAMP, 0x00 }, |
@@ -641,7 +637,7 @@ static unsigned char aci_init_values[][2] __initdata = { | |||
641 | { ACI_SET_MASTER + 1, 0x20 }, | 637 | { ACI_SET_MASTER + 1, 0x20 }, |
642 | }; | 638 | }; |
643 | 639 | ||
644 | static int __init snd_set_aci_init_values(struct snd_miro *miro) | 640 | static int __devinit snd_set_aci_init_values(struct snd_miro *miro) |
645 | { | 641 | { |
646 | int idx, error; | 642 | int idx, error; |
647 | 643 | ||
@@ -751,7 +747,8 @@ static long snd_legacy_find_free_ioport(long *port_table, long size) | |||
751 | return -1; | 747 | return -1; |
752 | } | 748 | } |
753 | 749 | ||
754 | static int __init snd_miro_init(struct snd_miro *chip, unsigned short hardware) | 750 | static int __devinit snd_miro_init(struct snd_miro *chip, |
751 | unsigned short hardware) | ||
755 | { | 752 | { |
756 | static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; | 753 | static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; |
757 | 754 | ||
@@ -962,7 +959,7 @@ static void snd_miro_proc_read(struct snd_info_entry * entry, | |||
962 | snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp); | 959 | snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp); |
963 | } | 960 | } |
964 | 961 | ||
965 | static void __init snd_miro_proc_init(struct snd_miro * miro) | 962 | static void __devinit snd_miro_proc_init(struct snd_miro * miro) |
966 | { | 963 | { |
967 | struct snd_info_entry *entry; | 964 | struct snd_info_entry *entry; |
968 | 965 | ||
@@ -974,7 +971,7 @@ static void __init snd_miro_proc_init(struct snd_miro * miro) | |||
974 | * Init | 971 | * Init |
975 | */ | 972 | */ |
976 | 973 | ||
977 | static int __init snd_miro_configure(struct snd_miro *chip) | 974 | static int __devinit snd_miro_configure(struct snd_miro *chip) |
978 | { | 975 | { |
979 | unsigned char wss_base_bits; | 976 | unsigned char wss_base_bits; |
980 | unsigned char irq_bits; | 977 | unsigned char irq_bits; |
@@ -1131,7 +1128,8 @@ __skip_mpu: | |||
1131 | return 0; | 1128 | return 0; |
1132 | } | 1129 | } |
1133 | 1130 | ||
1134 | static int __init snd_card_miro_detect(struct snd_card *card, struct snd_miro *chip) | 1131 | static int __devinit snd_card_miro_detect(struct snd_card *card, |
1132 | struct snd_miro *chip) | ||
1135 | { | 1133 | { |
1136 | int i, err; | 1134 | int i, err; |
1137 | unsigned char value; | 1135 | unsigned char value; |
@@ -1157,7 +1155,8 @@ static int __init snd_card_miro_detect(struct snd_card *card, struct snd_miro *c | |||
1157 | return -ENODEV; | 1155 | return -ENODEV; |
1158 | } | 1156 | } |
1159 | 1157 | ||
1160 | static int __init snd_card_miro_aci_detect(struct snd_card *card, struct snd_miro * miro) | 1158 | static int __devinit snd_card_miro_aci_detect(struct snd_card *card, |
1159 | struct snd_miro * miro) | ||
1161 | { | 1160 | { |
1162 | unsigned char regval; | 1161 | unsigned char regval; |
1163 | int i; | 1162 | int i; |
@@ -1213,7 +1212,12 @@ static void snd_card_miro_free(struct snd_card *card) | |||
1213 | release_and_free_resource(miro->res_mc_base); | 1212 | release_and_free_resource(miro->res_mc_base); |
1214 | } | 1213 | } |
1215 | 1214 | ||
1216 | static int __init snd_miro_probe(struct platform_device *devptr) | 1215 | static int __devinit snd_miro_match(struct device *devptr, unsigned int n) |
1216 | { | ||
1217 | return 1; | ||
1218 | } | ||
1219 | |||
1220 | static int __devinit snd_miro_probe(struct device *devptr, unsigned int n) | ||
1217 | { | 1221 | { |
1218 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; | 1222 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; |
1219 | static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; | 1223 | static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; |
@@ -1399,56 +1403,44 @@ static int __init snd_miro_probe(struct platform_device *devptr) | |||
1399 | return error; | 1403 | return error; |
1400 | } | 1404 | } |
1401 | 1405 | ||
1402 | snd_card_set_dev(card, &devptr->dev); | 1406 | snd_card_set_dev(card, devptr); |
1403 | 1407 | ||
1404 | if ((error = snd_card_register(card))) { | 1408 | if ((error = snd_card_register(card))) { |
1405 | snd_card_free(card); | 1409 | snd_card_free(card); |
1406 | return error; | 1410 | return error; |
1407 | } | 1411 | } |
1408 | 1412 | ||
1409 | platform_set_drvdata(devptr, card); | 1413 | dev_set_drvdata(devptr, card); |
1410 | return 0; | 1414 | return 0; |
1411 | } | 1415 | } |
1412 | 1416 | ||
1413 | static int __devexit snd_miro_remove(struct platform_device *devptr) | 1417 | static int __devexit snd_miro_remove(struct device *devptr, unsigned int dev) |
1414 | { | 1418 | { |
1415 | snd_card_free(platform_get_drvdata(devptr)); | 1419 | snd_card_free(dev_get_drvdata(devptr)); |
1416 | platform_set_drvdata(devptr, NULL); | 1420 | dev_set_drvdata(devptr, NULL); |
1417 | return 0; | 1421 | return 0; |
1418 | } | 1422 | } |
1419 | 1423 | ||
1420 | static struct platform_driver snd_miro_driver = { | 1424 | #define DEV_NAME "miro" |
1425 | |||
1426 | static struct isa_driver snd_miro_driver = { | ||
1427 | .match = snd_miro_match, | ||
1421 | .probe = snd_miro_probe, | 1428 | .probe = snd_miro_probe, |
1422 | .remove = __devexit_p(snd_miro_remove), | 1429 | .remove = __devexit_p(snd_miro_remove), |
1423 | /* FIXME: suspend/resume */ | 1430 | /* FIXME: suspend/resume */ |
1424 | .driver = { | 1431 | .driver = { |
1425 | .name = DRIVER_NAME | 1432 | .name = DEV_NAME |
1426 | }, | 1433 | }, |
1427 | }; | 1434 | }; |
1428 | 1435 | ||
1429 | static int __init alsa_card_miro_init(void) | 1436 | static int __init alsa_card_miro_init(void) |
1430 | { | 1437 | { |
1431 | int error; | 1438 | return isa_register_driver(&snd_miro_driver, 1); |
1432 | |||
1433 | if ((error = platform_driver_register(&snd_miro_driver)) < 0) | ||
1434 | return error; | ||
1435 | device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); | ||
1436 | if (! IS_ERR(device)) { | ||
1437 | if (platform_get_drvdata(device)) | ||
1438 | return 0; | ||
1439 | platform_device_unregister(device); | ||
1440 | } | ||
1441 | #ifdef MODULE | ||
1442 | printk(KERN_ERR "no miro soundcard found\n"); | ||
1443 | #endif | ||
1444 | platform_driver_unregister(&snd_miro_driver); | ||
1445 | return PTR_ERR(device); | ||
1446 | } | 1439 | } |
1447 | 1440 | ||
1448 | static void __exit alsa_card_miro_exit(void) | 1441 | static void __exit alsa_card_miro_exit(void) |
1449 | { | 1442 | { |
1450 | platform_device_unregister(device); | 1443 | isa_unregister_driver(&snd_miro_driver); |
1451 | platform_driver_unregister(&snd_miro_driver); | ||
1452 | } | 1444 | } |
1453 | 1445 | ||
1454 | module_init(alsa_card_miro_init) | 1446 | module_init(alsa_card_miro_init) |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index df227377c33..60c120ffb9d 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <sound/driver.h> | 26 | #include <sound/driver.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/platform_device.h> | 29 | #include <linux/isa.h> |
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/pnp.h> | 32 | #include <linux/pnp.h> |
@@ -259,7 +259,6 @@ struct snd_opti9xx { | |||
259 | }; | 259 | }; |
260 | 260 | ||
261 | static int snd_opti9xx_pnp_is_probed; | 261 | static int snd_opti9xx_pnp_is_probed; |
262 | static struct platform_device *snd_opti9xx_platform_device; | ||
263 | 262 | ||
264 | #ifdef CONFIG_PNP | 263 | #ifdef CONFIG_PNP |
265 | 264 | ||
@@ -281,10 +280,10 @@ MODULE_DEVICE_TABLE(pnp_card, snd_opti9xx_pnpids); | |||
281 | #endif /* CONFIG_PNP */ | 280 | #endif /* CONFIG_PNP */ |
282 | 281 | ||
283 | #ifdef OPTi93X | 282 | #ifdef OPTi93X |
284 | #define DRIVER_NAME "snd-card-opti93x" | 283 | #define DEV_NAME "opti93x" |
285 | #else | 284 | #else |
286 | #define DRIVER_NAME "snd-card-opti92x" | 285 | #define DEV_NAME "opti92x" |
287 | #endif /* OPTi93X */ | 286 | #endif |
288 | 287 | ||
289 | static char * snd_opti9xx_names[] = { | 288 | static char * snd_opti9xx_names[] = { |
290 | "unkown", | 289 | "unkown", |
@@ -294,7 +293,7 @@ static char * snd_opti9xx_names[] = { | |||
294 | }; | 293 | }; |
295 | 294 | ||
296 | 295 | ||
297 | static long __init snd_legacy_find_free_ioport(long *port_table, long size) | 296 | static long __devinit snd_legacy_find_free_ioport(long *port_table, long size) |
298 | { | 297 | { |
299 | while (*port_table != -1) { | 298 | while (*port_table != -1) { |
300 | if (request_region(*port_table, size, "ALSA test")) { | 299 | if (request_region(*port_table, size, "ALSA test")) { |
@@ -306,7 +305,8 @@ static long __init snd_legacy_find_free_ioport(long *port_table, long size) | |||
306 | return -1; | 305 | return -1; |
307 | } | 306 | } |
308 | 307 | ||
309 | static int __init snd_opti9xx_init(struct snd_opti9xx *chip, unsigned short hardware) | 308 | static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, |
309 | unsigned short hardware) | ||
310 | { | 310 | { |
311 | static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; | 311 | static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; |
312 | 312 | ||
@@ -451,7 +451,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, | |||
451 | (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask))) | 451 | (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask))) |
452 | 452 | ||
453 | 453 | ||
454 | static int __init snd_opti9xx_configure(struct snd_opti9xx *chip) | 454 | static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) |
455 | { | 455 | { |
456 | unsigned char wss_base_bits; | 456 | unsigned char wss_base_bits; |
457 | unsigned char irq_bits; | 457 | unsigned char irq_bits; |
@@ -934,10 +934,8 @@ static int snd_opti93x_trigger(struct snd_pcm_substream *substream, | |||
934 | case SNDRV_PCM_TRIGGER_STOP: | 934 | case SNDRV_PCM_TRIGGER_STOP: |
935 | { | 935 | { |
936 | unsigned int what = 0; | 936 | unsigned int what = 0; |
937 | struct list_head *pos; | ||
938 | struct snd_pcm_substream *s; | 937 | struct snd_pcm_substream *s; |
939 | snd_pcm_group_for_each(pos, substream) { | 938 | snd_pcm_group_for_each_entry(s, substream) { |
940 | s = snd_pcm_group_substream_entry(pos); | ||
941 | if (s == chip->playback_substream) { | 939 | if (s == chip->playback_substream) { |
942 | what |= OPTi93X_PLAYBACK_ENABLE; | 940 | what |= OPTi93X_PLAYBACK_ENABLE; |
943 | snd_pcm_trigger_done(s, substream); | 941 | snd_pcm_trigger_done(s, substream); |
@@ -1291,7 +1289,7 @@ static int snd_opti93x_create(struct snd_card *card, struct snd_opti9xx *chip, | |||
1291 | } | 1289 | } |
1292 | codec->dma2 = chip->dma2; | 1290 | codec->dma2 = chip->dma2; |
1293 | 1291 | ||
1294 | if (request_irq(chip->irq, snd_opti93x_interrupt, IRQF_DISABLED, DRIVER_NAME" - WSS", codec)) { | 1292 | if (request_irq(chip->irq, snd_opti93x_interrupt, IRQF_DISABLED, DEV_NAME" - WSS", codec)) { |
1295 | snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq); | 1293 | snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq); |
1296 | snd_opti93x_free(codec); | 1294 | snd_opti93x_free(codec); |
1297 | return -EBUSY; | 1295 | return -EBUSY; |
@@ -1561,7 +1559,7 @@ static int snd_opti93x_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
1561 | return change; | 1559 | return change; |
1562 | } | 1560 | } |
1563 | 1561 | ||
1564 | static struct snd_kcontrol_new snd_opti93x_controls[] = { | 1562 | static struct snd_kcontrol_new snd_opti93x_controls[] __devinitdata = { |
1565 | OPTi93X_DOUBLE("Master Playback Switch", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), | 1563 | OPTi93X_DOUBLE("Master Playback Switch", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), |
1566 | OPTi93X_DOUBLE("Master Playback Volume", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), | 1564 | OPTi93X_DOUBLE("Master Playback Volume", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), |
1567 | OPTi93X_DOUBLE("PCM Playback Switch", 0, OPTi93X_DAC_LEFT, OPTi93X_DAC_RIGHT, 7, 7, 1, 1), | 1565 | OPTi93X_DOUBLE("PCM Playback Switch", 0, OPTi93X_DAC_LEFT, OPTi93X_DAC_RIGHT, 7, 7, 1, 1), |
@@ -1622,7 +1620,8 @@ static int snd_opti93x_mixer(struct snd_opti93x *chip) | |||
1622 | 1620 | ||
1623 | #endif /* OPTi93X */ | 1621 | #endif /* OPTi93X */ |
1624 | 1622 | ||
1625 | static int __init snd_card_opti9xx_detect(struct snd_card *card, struct snd_opti9xx *chip) | 1623 | static int __devinit snd_card_opti9xx_detect(struct snd_card *card, |
1624 | struct snd_opti9xx *chip) | ||
1626 | { | 1625 | { |
1627 | int i, err; | 1626 | int i, err; |
1628 | 1627 | ||
@@ -1676,8 +1675,9 @@ static int __init snd_card_opti9xx_detect(struct snd_card *card, struct snd_opti | |||
1676 | } | 1675 | } |
1677 | 1676 | ||
1678 | #ifdef CONFIG_PNP | 1677 | #ifdef CONFIG_PNP |
1679 | static int __init snd_card_opti9xx_pnp(struct snd_opti9xx *chip, struct pnp_card_link *card, | 1678 | static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, |
1680 | const struct pnp_card_device_id *pid) | 1679 | struct pnp_card_link *card, |
1680 | const struct pnp_card_device_id *pid) | ||
1681 | { | 1681 | { |
1682 | struct pnp_dev *pdev; | 1682 | struct pnp_dev *pdev; |
1683 | struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); | 1683 | struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); |
@@ -1778,7 +1778,7 @@ static void snd_card_opti9xx_free(struct snd_card *card) | |||
1778 | release_and_free_resource(chip->res_mc_base); | 1778 | release_and_free_resource(chip->res_mc_base); |
1779 | } | 1779 | } |
1780 | 1780 | ||
1781 | static int __init snd_opti9xx_probe(struct snd_card *card) | 1781 | static int __devinit snd_opti9xx_probe(struct snd_card *card) |
1782 | { | 1782 | { |
1783 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; | 1783 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; |
1784 | int error; | 1784 | int error; |
@@ -1924,7 +1924,18 @@ static struct snd_card *snd_opti9xx_card_new(void) | |||
1924 | return card; | 1924 | return card; |
1925 | } | 1925 | } |
1926 | 1926 | ||
1927 | static int __init snd_opti9xx_nonpnp_probe(struct platform_device *devptr) | 1927 | static int __devinit snd_opti9xx_isa_match(struct device *devptr, |
1928 | unsigned int dev) | ||
1929 | { | ||
1930 | if (snd_opti9xx_pnp_is_probed) | ||
1931 | return 0; | ||
1932 | if (isapnp) | ||
1933 | return 0; | ||
1934 | return 1; | ||
1935 | } | ||
1936 | |||
1937 | static int __devinit snd_opti9xx_isa_probe(struct device *devptr, | ||
1938 | unsigned int dev) | ||
1928 | { | 1939 | { |
1929 | struct snd_card *card; | 1940 | struct snd_card *card; |
1930 | int error; | 1941 | int error; |
@@ -1940,9 +1951,6 @@ static int __init snd_opti9xx_nonpnp_probe(struct platform_device *devptr) | |||
1940 | static int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; | 1951 | static int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; |
1941 | #endif /* CS4231 || OPTi93X */ | 1952 | #endif /* CS4231 || OPTi93X */ |
1942 | 1953 | ||
1943 | if (snd_opti9xx_pnp_is_probed) | ||
1944 | return -EBUSY; | ||
1945 | |||
1946 | if (mpu_port == SNDRV_AUTO_PORT) { | 1954 | if (mpu_port == SNDRV_AUTO_PORT) { |
1947 | if ((mpu_port = snd_legacy_find_free_ioport(possible_mpu_ports, 2)) < 0) { | 1955 | if ((mpu_port = snd_legacy_find_free_ioport(possible_mpu_ports, 2)) < 0) { |
1948 | snd_printk(KERN_ERR "unable to find a free MPU401 port\n"); | 1956 | snd_printk(KERN_ERR "unable to find a free MPU401 port\n"); |
@@ -1984,34 +1992,36 @@ static int __init snd_opti9xx_nonpnp_probe(struct platform_device *devptr) | |||
1984 | snd_card_free(card); | 1992 | snd_card_free(card); |
1985 | return error; | 1993 | return error; |
1986 | } | 1994 | } |
1987 | snd_card_set_dev(card, &devptr->dev); | 1995 | snd_card_set_dev(card, devptr); |
1988 | if ((error = snd_opti9xx_probe(card)) < 0) { | 1996 | if ((error = snd_opti9xx_probe(card)) < 0) { |
1989 | snd_card_free(card); | 1997 | snd_card_free(card); |
1990 | return error; | 1998 | return error; |
1991 | } | 1999 | } |
1992 | platform_set_drvdata(devptr, card); | 2000 | dev_set_drvdata(devptr, card); |
1993 | return 0; | 2001 | return 0; |
1994 | } | 2002 | } |
1995 | 2003 | ||
1996 | static int __devexit snd_opti9xx_nonpnp_remove(struct platform_device *devptr) | 2004 | static int __devexit snd_opti9xx_isa_remove(struct device *devptr, |
2005 | unsigned int dev) | ||
1997 | { | 2006 | { |
1998 | snd_card_free(platform_get_drvdata(devptr)); | 2007 | snd_card_free(dev_get_drvdata(devptr)); |
1999 | platform_set_drvdata(devptr, NULL); | 2008 | dev_set_drvdata(devptr, NULL); |
2000 | return 0; | 2009 | return 0; |
2001 | } | 2010 | } |
2002 | 2011 | ||
2003 | static struct platform_driver snd_opti9xx_driver = { | 2012 | static struct isa_driver snd_opti9xx_driver = { |
2004 | .probe = snd_opti9xx_nonpnp_probe, | 2013 | .match = snd_opti9xx_isa_match, |
2005 | .remove = __devexit_p(snd_opti9xx_nonpnp_remove), | 2014 | .probe = snd_opti9xx_isa_probe, |
2015 | .remove = __devexit_p(snd_opti9xx_isa_remove), | ||
2006 | /* FIXME: suspend/resume */ | 2016 | /* FIXME: suspend/resume */ |
2007 | .driver = { | 2017 | .driver = { |
2008 | .name = DRIVER_NAME | 2018 | .name = DEV_NAME |
2009 | }, | 2019 | }, |
2010 | }; | 2020 | }; |
2011 | 2021 | ||
2012 | #ifdef CONFIG_PNP | 2022 | #ifdef CONFIG_PNP |
2013 | static int __init snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, | 2023 | static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, |
2014 | const struct pnp_card_device_id *pid) | 2024 | const struct pnp_card_device_id *pid) |
2015 | { | 2025 | { |
2016 | struct snd_card *card; | 2026 | struct snd_card *card; |
2017 | int error, hw; | 2027 | int error, hw; |
@@ -2074,11 +2084,6 @@ static struct pnp_card_driver opti9xx_pnpc_driver = { | |||
2074 | }; | 2084 | }; |
2075 | #endif | 2085 | #endif |
2076 | 2086 | ||
2077 | #ifdef CONFIG_PNP | ||
2078 | #define is_isapnp_selected() isapnp | ||
2079 | #else | ||
2080 | #define is_isapnp_selected() 0 | ||
2081 | #endif | ||
2082 | #ifdef OPTi93X | 2087 | #ifdef OPTi93X |
2083 | #define CHIP_NAME "82C93x" | 2088 | #define CHIP_NAME "82C93x" |
2084 | #else | 2089 | #else |
@@ -2087,42 +2092,19 @@ static struct pnp_card_driver opti9xx_pnpc_driver = { | |||
2087 | 2092 | ||
2088 | static int __init alsa_card_opti9xx_init(void) | 2093 | static int __init alsa_card_opti9xx_init(void) |
2089 | { | 2094 | { |
2090 | int error; | ||
2091 | struct platform_device *device; | ||
2092 | |||
2093 | #ifdef CONFIG_PNP | 2095 | #ifdef CONFIG_PNP |
2094 | pnp_register_card_driver(&opti9xx_pnpc_driver); | 2096 | pnp_register_card_driver(&opti9xx_pnpc_driver); |
2095 | if (snd_opti9xx_pnp_is_probed) | 2097 | if (snd_opti9xx_pnp_is_probed) |
2096 | return 0; | 2098 | return 0; |
2097 | #endif | 2099 | #endif |
2098 | if (! is_isapnp_selected()) { | 2100 | return isa_register_driver(&snd_opti9xx_driver, 1); |
2099 | error = platform_driver_register(&snd_opti9xx_driver); | ||
2100 | if (error < 0) | ||
2101 | return error; | ||
2102 | device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); | ||
2103 | if (!IS_ERR(device)) { | ||
2104 | if (platform_get_drvdata(device)) { | ||
2105 | snd_opti9xx_platform_device = device; | ||
2106 | return 0; | ||
2107 | } | ||
2108 | platform_device_unregister(device); | ||
2109 | } | ||
2110 | platform_driver_unregister(&snd_opti9xx_driver); | ||
2111 | } | ||
2112 | #ifdef CONFIG_PNP | ||
2113 | pnp_unregister_card_driver(&opti9xx_pnpc_driver); | ||
2114 | #endif | ||
2115 | #ifdef MODULE | ||
2116 | printk(KERN_ERR "no OPTi " CHIP_NAME " soundcard found\n"); | ||
2117 | #endif | ||
2118 | return -ENODEV; | ||
2119 | } | 2101 | } |
2120 | 2102 | ||
2121 | static void __exit alsa_card_opti9xx_exit(void) | 2103 | static void __exit alsa_card_opti9xx_exit(void) |
2122 | { | 2104 | { |
2123 | if (!snd_opti9xx_pnp_is_probed) { | 2105 | if (!snd_opti9xx_pnp_is_probed) { |
2124 | platform_device_unregister(snd_opti9xx_platform_device); | 2106 | isa_unregister_driver(&snd_opti9xx_driver); |
2125 | platform_driver_unregister(&snd_opti9xx_driver); | 2107 | return; |
2126 | } | 2108 | } |
2127 | #ifdef CONFIG_PNP | 2109 | #ifdef CONFIG_PNP |
2128 | pnp_unregister_card_driver(&opti9xx_pnpc_driver); | 2110 | pnp_unregister_card_driver(&opti9xx_pnpc_driver); |
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index d64e67f2baf..2a19b0a39ed 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/pnp.h> | 26 | #include <linux/pnp.h> |
27 | #include <linux/err.h> | 27 | #include <linux/err.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/isa.h> |
29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
30 | #include <sound/core.h> | 30 | #include <sound/core.h> |
31 | #include <sound/sb.h> | 31 | #include <sound/sb.h> |
@@ -128,7 +128,6 @@ module_param_array(seq_ports, int, NULL, 0444); | |||
128 | MODULE_PARM_DESC(seq_ports, "Number of sequencer ports for WaveTable synth."); | 128 | MODULE_PARM_DESC(seq_ports, "Number of sequencer ports for WaveTable synth."); |
129 | #endif | 129 | #endif |
130 | 130 | ||
131 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
132 | #ifdef CONFIG_PNP | 131 | #ifdef CONFIG_PNP |
133 | static int pnp_registered; | 132 | static int pnp_registered; |
134 | #endif | 133 | #endif |
@@ -519,7 +518,7 @@ static int snd_sb16_resume(struct snd_card *card) | |||
519 | } | 518 | } |
520 | #endif | 519 | #endif |
521 | 520 | ||
522 | static int __devinit snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr) | 521 | static int __devinit snd_sb16_isa_probe1(int dev, struct device *pdev) |
523 | { | 522 | { |
524 | struct snd_card_sb16 *acard; | 523 | struct snd_card_sb16 *acard; |
525 | struct snd_card *card; | 524 | struct snd_card *card; |
@@ -539,19 +538,23 @@ static int __devinit snd_sb16_nonpnp_probe1(int dev, struct platform_device *dev | |||
539 | awe_port[dev] = port[dev] + 0x400; | 538 | awe_port[dev] = port[dev] + 0x400; |
540 | #endif | 539 | #endif |
541 | 540 | ||
542 | snd_card_set_dev(card, &devptr->dev); | 541 | snd_card_set_dev(card, pdev); |
543 | if ((err = snd_sb16_probe(card, dev)) < 0) { | 542 | if ((err = snd_sb16_probe(card, dev)) < 0) { |
544 | snd_card_free(card); | 543 | snd_card_free(card); |
545 | return err; | 544 | return err; |
546 | } | 545 | } |
547 | platform_set_drvdata(devptr, card); | 546 | dev_set_drvdata(pdev, card); |
548 | return 0; | 547 | return 0; |
549 | } | 548 | } |
550 | 549 | ||
551 | 550 | ||
552 | static int __devinit snd_sb16_nonpnp_probe(struct platform_device *pdev) | 551 | static int __devinit snd_sb16_isa_match(struct device *pdev, unsigned int dev) |
552 | { | ||
553 | return enable[dev] && !is_isapnp_selected(dev); | ||
554 | } | ||
555 | |||
556 | static int __devinit snd_sb16_isa_probe(struct device *pdev, unsigned int dev) | ||
553 | { | 557 | { |
554 | int dev = pdev->id; | ||
555 | int err; | 558 | int err; |
556 | static int possible_irqs[] = {5, 9, 10, 7, -1}; | 559 | static int possible_irqs[] = {5, 9, 10, 7, -1}; |
557 | static int possible_dmas8[] = {1, 3, 0, -1}; | 560 | static int possible_dmas8[] = {1, 3, 0, -1}; |
@@ -577,13 +580,13 @@ static int __devinit snd_sb16_nonpnp_probe(struct platform_device *pdev) | |||
577 | } | 580 | } |
578 | 581 | ||
579 | if (port[dev] != SNDRV_AUTO_PORT) | 582 | if (port[dev] != SNDRV_AUTO_PORT) |
580 | return snd_sb16_nonpnp_probe1(dev, pdev); | 583 | return snd_sb16_isa_probe1(dev, pdev); |
581 | else { | 584 | else { |
582 | static int possible_ports[] = {0x220, 0x240, 0x260, 0x280}; | 585 | static int possible_ports[] = {0x220, 0x240, 0x260, 0x280}; |
583 | int i; | 586 | int i; |
584 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { | 587 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { |
585 | port[dev] = possible_ports[i]; | 588 | port[dev] = possible_ports[i]; |
586 | err = snd_sb16_nonpnp_probe1(dev, pdev); | 589 | err = snd_sb16_isa_probe1(dev, pdev); |
587 | if (! err) | 590 | if (! err) |
588 | return 0; | 591 | return 0; |
589 | } | 592 | } |
@@ -591,47 +594,47 @@ static int __devinit snd_sb16_nonpnp_probe(struct platform_device *pdev) | |||
591 | } | 594 | } |
592 | } | 595 | } |
593 | 596 | ||
594 | static int __devexit snd_sb16_nonpnp_remove(struct platform_device *devptr) | 597 | static int __devexit snd_sb16_isa_remove(struct device *pdev, unsigned int dev) |
595 | { | 598 | { |
596 | snd_card_free(platform_get_drvdata(devptr)); | 599 | snd_card_free(dev_get_drvdata(pdev)); |
597 | platform_set_drvdata(devptr, NULL); | 600 | dev_set_drvdata(pdev, NULL); |
598 | return 0; | 601 | return 0; |
599 | } | 602 | } |
600 | 603 | ||
601 | #ifdef CONFIG_PM | 604 | #ifdef CONFIG_PM |
602 | static int snd_sb16_nonpnp_suspend(struct platform_device *dev, pm_message_t state) | 605 | static int snd_sb16_isa_suspend(struct device *dev, unsigned int n, |
606 | pm_message_t state) | ||
603 | { | 607 | { |
604 | return snd_sb16_suspend(platform_get_drvdata(dev), state); | 608 | return snd_sb16_suspend(dev_get_drvdata(dev), state); |
605 | } | 609 | } |
606 | 610 | ||
607 | static int snd_sb16_nonpnp_resume(struct platform_device *dev) | 611 | static int snd_sb16_isa_resume(struct device *dev, unsigned int n) |
608 | { | 612 | { |
609 | return snd_sb16_resume(platform_get_drvdata(dev)); | 613 | return snd_sb16_resume(dev_get_drvdata(dev)); |
610 | } | 614 | } |
611 | #endif | 615 | #endif |
612 | 616 | ||
613 | #ifdef SNDRV_SBAWE | 617 | #ifdef SNDRV_SBAWE |
614 | #define SND_SB16_DRIVER "snd_sbawe" | 618 | #define DEV_NAME "sbawe" |
615 | #else | 619 | #else |
616 | #define SND_SB16_DRIVER "snd_sb16" | 620 | #define DEV_NAME "sb16" |
617 | #endif | 621 | #endif |
618 | 622 | ||
619 | static struct platform_driver snd_sb16_nonpnp_driver = { | 623 | static struct isa_driver snd_sb16_isa_driver = { |
620 | .probe = snd_sb16_nonpnp_probe, | 624 | .match = snd_sb16_isa_match, |
621 | .remove = __devexit_p(snd_sb16_nonpnp_remove), | 625 | .probe = snd_sb16_isa_probe, |
626 | .remove = __devexit_p(snd_sb16_isa_remove), | ||
622 | #ifdef CONFIG_PM | 627 | #ifdef CONFIG_PM |
623 | .suspend = snd_sb16_nonpnp_suspend, | 628 | .suspend = snd_sb16_isa_suspend, |
624 | .resume = snd_sb16_nonpnp_resume, | 629 | .resume = snd_sb16_isa_resume, |
625 | #endif | 630 | #endif |
626 | .driver = { | 631 | .driver = { |
627 | .name = SND_SB16_DRIVER | 632 | .name = DEV_NAME |
628 | }, | 633 | }, |
629 | }; | 634 | }; |
630 | 635 | ||
631 | 636 | ||
632 | #ifdef CONFIG_PNP | 637 | #ifdef CONFIG_PNP |
633 | static unsigned int __devinitdata sb16_pnp_devices; | ||
634 | |||
635 | static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, | 638 | static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, |
636 | const struct pnp_card_device_id *pid) | 639 | const struct pnp_card_device_id *pid) |
637 | { | 640 | { |
@@ -653,7 +656,6 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, | |||
653 | } | 656 | } |
654 | pnp_set_card_drvdata(pcard, card); | 657 | pnp_set_card_drvdata(pcard, card); |
655 | dev++; | 658 | dev++; |
656 | sb16_pnp_devices++; | ||
657 | return 0; | 659 | return 0; |
658 | } | 660 | } |
659 | 661 | ||
@@ -695,68 +697,29 @@ static struct pnp_card_driver sb16_pnpc_driver = { | |||
695 | 697 | ||
696 | #endif /* CONFIG_PNP */ | 698 | #endif /* CONFIG_PNP */ |
697 | 699 | ||
698 | static void __init_or_module snd_sb16_unregister_all(void) | ||
699 | { | ||
700 | int i; | ||
701 | |||
702 | #ifdef CONFIG_PNP | ||
703 | if (pnp_registered) | ||
704 | pnp_unregister_card_driver(&sb16_pnpc_driver); | ||
705 | #endif | ||
706 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
707 | platform_device_unregister(platform_devices[i]); | ||
708 | platform_driver_unregister(&snd_sb16_nonpnp_driver); | ||
709 | } | ||
710 | |||
711 | static int __init alsa_card_sb16_init(void) | 700 | static int __init alsa_card_sb16_init(void) |
712 | { | 701 | { |
713 | int i, err, cards = 0; | 702 | int err; |
714 | 703 | ||
715 | if ((err = platform_driver_register(&snd_sb16_nonpnp_driver)) < 0) | 704 | err = isa_register_driver(&snd_sb16_isa_driver, SNDRV_CARDS); |
705 | if (err < 0) | ||
716 | return err; | 706 | return err; |
717 | |||
718 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
719 | struct platform_device *device; | ||
720 | if (! enable[i] || is_isapnp_selected(i)) | ||
721 | continue; | ||
722 | device = platform_device_register_simple(SND_SB16_DRIVER, | ||
723 | i, NULL, 0); | ||
724 | if (IS_ERR(device)) | ||
725 | continue; | ||
726 | if (!platform_get_drvdata(device)) { | ||
727 | platform_device_unregister(device); | ||
728 | continue; | ||
729 | } | ||
730 | platform_devices[i] = device; | ||
731 | cards++; | ||
732 | } | ||
733 | #ifdef CONFIG_PNP | 707 | #ifdef CONFIG_PNP |
734 | /* PnP cards at last */ | 708 | /* PnP cards at last */ |
735 | err = pnp_register_card_driver(&sb16_pnpc_driver); | 709 | err = pnp_register_card_driver(&sb16_pnpc_driver); |
736 | if (!err) { | 710 | if (!err) |
737 | pnp_registered = 1; | 711 | pnp_registered = 1; |
738 | cards += sb16_pnp_devices; | ||
739 | } | ||
740 | #endif | ||
741 | |||
742 | if (!cards) { | ||
743 | #ifdef MODULE | ||
744 | snd_printk(KERN_ERR "Sound Blaster 16 soundcard not found or device busy\n"); | ||
745 | #ifdef SNDRV_SBAWE_EMU8000 | ||
746 | snd_printk(KERN_ERR "In case, if you have non-AWE card, try snd-sb16 module\n"); | ||
747 | #else | ||
748 | snd_printk(KERN_ERR "In case, if you have AWE card, try snd-sbawe module\n"); | ||
749 | #endif | 712 | #endif |
750 | #endif | ||
751 | snd_sb16_unregister_all(); | ||
752 | return -ENODEV; | ||
753 | } | ||
754 | return 0; | 713 | return 0; |
755 | } | 714 | } |
756 | 715 | ||
757 | static void __exit alsa_card_sb16_exit(void) | 716 | static void __exit alsa_card_sb16_exit(void) |
758 | { | 717 | { |
759 | snd_sb16_unregister_all(); | 718 | #ifdef CONFIG_PNP |
719 | if (pnp_registered) | ||
720 | pnp_unregister_card_driver(&sb16_pnpc_driver); | ||
721 | #endif | ||
722 | isa_unregister_driver(&snd_sb16_isa_driver); | ||
760 | } | 723 | } |
761 | 724 | ||
762 | module_init(alsa_card_sb16_init) | 725 | module_init(alsa_card_sb16_init) |
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c index 3d9d7e0107c..b279f2308ae 100644 --- a/sound/isa/sb/sb16_csp.c +++ b/sound/isa/sb/sb16_csp.c | |||
@@ -36,6 +36,13 @@ | |||
36 | MODULE_AUTHOR("Uros Bizjak <uros@kss-loka.si>"); | 36 | MODULE_AUTHOR("Uros Bizjak <uros@kss-loka.si>"); |
37 | MODULE_DESCRIPTION("ALSA driver for SB16 Creative Signal Processor"); | 37 | MODULE_DESCRIPTION("ALSA driver for SB16 Creative Signal Processor"); |
38 | MODULE_LICENSE("GPL"); | 38 | MODULE_LICENSE("GPL"); |
39 | #ifndef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL | ||
40 | MODULE_FIRMWARE("sb16/mulaw_main.csp"); | ||
41 | MODULE_FIRMWARE("sb16/alaw_main.csp"); | ||
42 | MODULE_FIRMWARE("sb16/ima_adpcm_init.csp"); | ||
43 | MODULE_FIRMWARE("sb16/ima_adpcm_playback.csp"); | ||
44 | MODULE_FIRMWARE("sb16/ima_adpcm_capture.csp"); | ||
45 | #endif | ||
39 | 46 | ||
40 | #ifdef SNDRV_LITTLE_ENDIAN | 47 | #ifdef SNDRV_LITTLE_ENDIAN |
41 | #define CSP_HDR_VALUE(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24)) | 48 | #define CSP_HDR_VALUE(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24)) |
@@ -161,13 +168,17 @@ int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep) | |||
161 | */ | 168 | */ |
162 | static void snd_sb_csp_free(struct snd_hwdep *hwdep) | 169 | static void snd_sb_csp_free(struct snd_hwdep *hwdep) |
163 | { | 170 | { |
171 | #ifndef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL | ||
164 | int i; | 172 | int i; |
173 | #endif | ||
165 | struct snd_sb_csp *p = hwdep->private_data; | 174 | struct snd_sb_csp *p = hwdep->private_data; |
166 | if (p) { | 175 | if (p) { |
167 | if (p->running & SNDRV_SB_CSP_ST_RUNNING) | 176 | if (p->running & SNDRV_SB_CSP_ST_RUNNING) |
168 | snd_sb_csp_stop(p); | 177 | snd_sb_csp_stop(p); |
178 | #ifndef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL | ||
169 | for (i = 0; i < ARRAY_SIZE(p->csp_programs); ++i) | 179 | for (i = 0; i < ARRAY_SIZE(p->csp_programs); ++i) |
170 | release_firmware(p->csp_programs[i]); | 180 | release_firmware(p->csp_programs[i]); |
181 | #endif | ||
171 | kfree(p); | 182 | kfree(p); |
172 | } | 183 | } |
173 | } | 184 | } |
@@ -690,9 +701,7 @@ static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __use | |||
690 | return err; | 701 | return err; |
691 | } | 702 | } |
692 | 703 | ||
693 | #define FIRMWARE_IN_THE_KERNEL | 704 | #ifdef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL |
694 | |||
695 | #ifdef FIRMWARE_IN_THE_KERNEL | ||
696 | #include "sb16_csp_codecs.h" | 705 | #include "sb16_csp_codecs.h" |
697 | 706 | ||
698 | static const struct firmware snd_sb_csp_static_programs[] = { | 707 | static const struct firmware snd_sb_csp_static_programs[] = { |
@@ -714,22 +723,19 @@ static int snd_sb_csp_firmware_load(struct snd_sb_csp *p, int index, int flags) | |||
714 | "sb16/ima_adpcm_capture.csp", | 723 | "sb16/ima_adpcm_capture.csp", |
715 | }; | 724 | }; |
716 | const struct firmware *program; | 725 | const struct firmware *program; |
717 | int err; | ||
718 | 726 | ||
719 | BUILD_BUG_ON(ARRAY_SIZE(names) != CSP_PROGRAM_COUNT); | 727 | BUILD_BUG_ON(ARRAY_SIZE(names) != CSP_PROGRAM_COUNT); |
720 | program = p->csp_programs[index]; | 728 | program = p->csp_programs[index]; |
721 | if (!program) { | 729 | if (!program) { |
722 | err = request_firmware(&program, names[index], | 730 | #ifdef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL |
723 | p->chip->card->dev); | 731 | program = &snd_sb_csp_static_programs[index]; |
724 | if (err >= 0) | ||
725 | p->csp_programs[index] = program; | ||
726 | else { | ||
727 | #ifdef FIRMWARE_IN_THE_KERNEL | ||
728 | program = &snd_sb_csp_static_programs[index]; | ||
729 | #else | 732 | #else |
733 | int err = request_firmware(&program, names[index], | ||
734 | p->chip->card->dev); | ||
735 | if (err < 0) | ||
730 | return err; | 736 | return err; |
731 | #endif | 737 | #endif |
732 | } | 738 | p->csp_programs[index] = program; |
733 | } | 739 | } |
734 | return snd_sb_csp_load(p, program->data, program->size, flags); | 740 | return snd_sb_csp_load(p, program->data, program->size, flags); |
735 | } | 741 | } |
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index be1e83e6dea..a1b3786b391 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/isa.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/ioport.h> | 27 | #include <linux/ioport.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
@@ -56,8 +56,6 @@ MODULE_PARM_DESC(irq, "IRQ # for SB8 driver."); | |||
56 | module_param_array(dma8, int, NULL, 0444); | 56 | module_param_array(dma8, int, NULL, 0444); |
57 | MODULE_PARM_DESC(dma8, "8-bit DMA # for SB8 driver."); | 57 | MODULE_PARM_DESC(dma8, "8-bit DMA # for SB8 driver."); |
58 | 58 | ||
59 | static struct platform_device *devices[SNDRV_CARDS]; | ||
60 | |||
61 | struct snd_sb8 { | 59 | struct snd_sb8 { |
62 | struct resource *fm_res; /* used to block FM i/o region for legacy cards */ | 60 | struct resource *fm_res; /* used to block FM i/o region for legacy cards */ |
63 | struct snd_sb *chip; | 61 | struct snd_sb *chip; |
@@ -83,9 +81,23 @@ static void snd_sb8_free(struct snd_card *card) | |||
83 | release_and_free_resource(acard->fm_res); | 81 | release_and_free_resource(acard->fm_res); |
84 | } | 82 | } |
85 | 83 | ||
86 | static int __devinit snd_sb8_probe(struct platform_device *pdev) | 84 | static int __devinit snd_sb8_match(struct device *pdev, unsigned int dev) |
85 | { | ||
86 | if (!enable[dev]) | ||
87 | return 0; | ||
88 | if (irq[dev] == SNDRV_AUTO_IRQ) { | ||
89 | snd_printk(KERN_ERR "%s: please specify irq\n", pdev->bus_id); | ||
90 | return 0; | ||
91 | } | ||
92 | if (dma8[dev] == SNDRV_AUTO_DMA) { | ||
93 | snd_printk(KERN_ERR "%s: please specify dma8\n", pdev->bus_id); | ||
94 | return 0; | ||
95 | } | ||
96 | return 1; | ||
97 | } | ||
98 | |||
99 | static int __devinit snd_sb8_probe(struct device *pdev, unsigned int dev) | ||
87 | { | 100 | { |
88 | int dev = pdev->id; | ||
89 | struct snd_sb *chip; | 101 | struct snd_sb *chip; |
90 | struct snd_card *card; | 102 | struct snd_card *card; |
91 | struct snd_sb8 *acard; | 103 | struct snd_sb8 *acard; |
@@ -180,12 +192,12 @@ static int __devinit snd_sb8_probe(struct platform_device *pdev) | |||
180 | chip->port, | 192 | chip->port, |
181 | irq[dev], dma8[dev]); | 193 | irq[dev], dma8[dev]); |
182 | 194 | ||
183 | snd_card_set_dev(card, &pdev->dev); | 195 | snd_card_set_dev(card, pdev); |
184 | 196 | ||
185 | if ((err = snd_card_register(card)) < 0) | 197 | if ((err = snd_card_register(card)) < 0) |
186 | goto _err; | 198 | goto _err; |
187 | 199 | ||
188 | platform_set_drvdata(pdev, card); | 200 | dev_set_drvdata(pdev, card); |
189 | return 0; | 201 | return 0; |
190 | 202 | ||
191 | _err: | 203 | _err: |
@@ -193,17 +205,18 @@ static int __devinit snd_sb8_probe(struct platform_device *pdev) | |||
193 | return err; | 205 | return err; |
194 | } | 206 | } |
195 | 207 | ||
196 | static int __devexit snd_sb8_remove(struct platform_device *pdev) | 208 | static int __devexit snd_sb8_remove(struct device *pdev, unsigned int dev) |
197 | { | 209 | { |
198 | snd_card_free(platform_get_drvdata(pdev)); | 210 | snd_card_free(dev_get_drvdata(pdev)); |
199 | platform_set_drvdata(pdev, NULL); | 211 | dev_set_drvdata(pdev, NULL); |
200 | return 0; | 212 | return 0; |
201 | } | 213 | } |
202 | 214 | ||
203 | #ifdef CONFIG_PM | 215 | #ifdef CONFIG_PM |
204 | static int snd_sb8_suspend(struct platform_device *dev, pm_message_t state) | 216 | static int snd_sb8_suspend(struct device *dev, unsigned int n, |
217 | pm_message_t state) | ||
205 | { | 218 | { |
206 | struct snd_card *card = platform_get_drvdata(dev); | 219 | struct snd_card *card = dev_get_drvdata(dev); |
207 | struct snd_sb8 *acard = card->private_data; | 220 | struct snd_sb8 *acard = card->private_data; |
208 | struct snd_sb *chip = acard->chip; | 221 | struct snd_sb *chip = acard->chip; |
209 | 222 | ||
@@ -213,9 +226,9 @@ static int snd_sb8_suspend(struct platform_device *dev, pm_message_t state) | |||
213 | return 0; | 226 | return 0; |
214 | } | 227 | } |
215 | 228 | ||
216 | static int snd_sb8_resume(struct platform_device *dev) | 229 | static int snd_sb8_resume(struct device *dev, unsigned int n) |
217 | { | 230 | { |
218 | struct snd_card *card = platform_get_drvdata(dev); | 231 | struct snd_card *card = dev_get_drvdata(dev); |
219 | struct snd_sb8 *acard = card->private_data; | 232 | struct snd_sb8 *acard = card->private_data; |
220 | struct snd_sb *chip = acard->chip; | 233 | struct snd_sb *chip = acard->chip; |
221 | 234 | ||
@@ -226,9 +239,10 @@ static int snd_sb8_resume(struct platform_device *dev) | |||
226 | } | 239 | } |
227 | #endif | 240 | #endif |
228 | 241 | ||
229 | #define SND_SB8_DRIVER "snd_sb8" | 242 | #define DEV_NAME "sb8" |
230 | 243 | ||
231 | static struct platform_driver snd_sb8_driver = { | 244 | static struct isa_driver snd_sb8_driver = { |
245 | .match = snd_sb8_match, | ||
232 | .probe = snd_sb8_probe, | 246 | .probe = snd_sb8_probe, |
233 | .remove = __devexit_p(snd_sb8_remove), | 247 | .remove = __devexit_p(snd_sb8_remove), |
234 | #ifdef CONFIG_PM | 248 | #ifdef CONFIG_PM |
@@ -236,56 +250,18 @@ static struct platform_driver snd_sb8_driver = { | |||
236 | .resume = snd_sb8_resume, | 250 | .resume = snd_sb8_resume, |
237 | #endif | 251 | #endif |
238 | .driver = { | 252 | .driver = { |
239 | .name = SND_SB8_DRIVER | 253 | .name = DEV_NAME |
240 | }, | 254 | }, |
241 | }; | 255 | }; |
242 | 256 | ||
243 | static void __init_or_module snd_sb8_unregister_all(void) | ||
244 | { | ||
245 | int i; | ||
246 | |||
247 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
248 | platform_device_unregister(devices[i]); | ||
249 | platform_driver_unregister(&snd_sb8_driver); | ||
250 | } | ||
251 | |||
252 | static int __init alsa_card_sb8_init(void) | 257 | static int __init alsa_card_sb8_init(void) |
253 | { | 258 | { |
254 | int i, cards, err; | 259 | return isa_register_driver(&snd_sb8_driver, SNDRV_CARDS); |
255 | |||
256 | err = platform_driver_register(&snd_sb8_driver); | ||
257 | if (err < 0) | ||
258 | return err; | ||
259 | |||
260 | cards = 0; | ||
261 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
262 | struct platform_device *device; | ||
263 | if (! enable[i]) | ||
264 | continue; | ||
265 | device = platform_device_register_simple(SND_SB8_DRIVER, | ||
266 | i, NULL, 0); | ||
267 | if (IS_ERR(device)) | ||
268 | continue; | ||
269 | if (!platform_get_drvdata(device)) { | ||
270 | platform_device_unregister(device); | ||
271 | continue; | ||
272 | } | ||
273 | devices[i] = device; | ||
274 | cards++; | ||
275 | } | ||
276 | if (!cards) { | ||
277 | #ifdef MODULE | ||
278 | snd_printk(KERN_ERR "Sound Blaster soundcard not found or device busy\n"); | ||
279 | #endif | ||
280 | snd_sb8_unregister_all(); | ||
281 | return -ENODEV; | ||
282 | } | ||
283 | return 0; | ||
284 | } | 260 | } |
285 | 261 | ||
286 | static void __exit alsa_card_sb8_exit(void) | 262 | static void __exit alsa_card_sb8_exit(void) |
287 | { | 263 | { |
288 | snd_sb8_unregister_all(); | 264 | isa_unregister_driver(&snd_sb8_driver); |
289 | } | 265 | } |
290 | 266 | ||
291 | module_init(alsa_card_sb8_init) | 267 | module_init(alsa_card_sb8_init) |
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c index 4fcd0f4e868..922519def09 100644 --- a/sound/isa/sgalaxy.c +++ b/sound/isa/sgalaxy.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <sound/driver.h> | 24 | #include <sound/driver.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/isa.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/time.h> | 29 | #include <linux/time.h> |
30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
@@ -64,8 +64,6 @@ MODULE_PARM_DESC(irq, "IRQ # for Sound Galaxy driver."); | |||
64 | module_param_array(dma1, int, NULL, 0444); | 64 | module_param_array(dma1, int, NULL, 0444); |
65 | MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver."); | 65 | MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver."); |
66 | 66 | ||
67 | static struct platform_device *devices[SNDRV_CARDS]; | ||
68 | |||
69 | #define SGALAXY_AUXC_LEFT 18 | 67 | #define SGALAXY_AUXC_LEFT 18 |
70 | #define SGALAXY_AUXC_RIGHT 19 | 68 | #define SGALAXY_AUXC_RIGHT 19 |
71 | 69 | ||
@@ -96,7 +94,8 @@ static int snd_sgalaxy_sbdsp_reset(unsigned long port) | |||
96 | return 0; | 94 | return 0; |
97 | } | 95 | } |
98 | 96 | ||
99 | static int __init snd_sgalaxy_sbdsp_command(unsigned long port, unsigned char val) | 97 | static int __devinit snd_sgalaxy_sbdsp_command(unsigned long port, |
98 | unsigned char val) | ||
100 | { | 99 | { |
101 | int i; | 100 | int i; |
102 | 101 | ||
@@ -114,7 +113,7 @@ static irqreturn_t snd_sgalaxy_dummy_interrupt(int irq, void *dev_id) | |||
114 | return IRQ_NONE; | 113 | return IRQ_NONE; |
115 | } | 114 | } |
116 | 115 | ||
117 | static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma) | 116 | static int __devinit snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma) |
118 | { | 117 | { |
119 | static int interrupt_bits[] = {-1, -1, -1, -1, -1, -1, -1, 0x08, -1, | 118 | static int interrupt_bits[] = {-1, -1, -1, -1, -1, -1, -1, 0x08, -1, |
120 | 0x10, 0x18, 0x20, -1, -1, -1, -1}; | 119 | 0x10, 0x18, 0x20, -1, -1, -1, -1}; |
@@ -161,7 +160,7 @@ static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma) | |||
161 | return 0; | 160 | return 0; |
162 | } | 161 | } |
163 | 162 | ||
164 | static int __init snd_sgalaxy_detect(int dev, int irq, int dma) | 163 | static int __devinit snd_sgalaxy_detect(int dev, int irq, int dma) |
165 | { | 164 | { |
166 | #if 0 | 165 | #if 0 |
167 | snd_printdd(PFX "switching to WSS mode\n"); | 166 | snd_printdd(PFX "switching to WSS mode\n"); |
@@ -182,7 +181,7 @@ AD1848_DOUBLE("Aux Playback Switch", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 7 | |||
182 | AD1848_DOUBLE("Aux Playback Volume", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 0, 0, 31, 0) | 181 | AD1848_DOUBLE("Aux Playback Volume", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 0, 0, 31, 0) |
183 | }; | 182 | }; |
184 | 183 | ||
185 | static int __init snd_sgalaxy_mixer(struct snd_ad1848 *chip) | 184 | static int __devinit snd_sgalaxy_mixer(struct snd_ad1848 *chip) |
186 | { | 185 | { |
187 | struct snd_card *card = chip->card; | 186 | struct snd_card *card = chip->card; |
188 | struct snd_ctl_elem_id id1, id2; | 187 | struct snd_ctl_elem_id id1, id2; |
@@ -218,23 +217,29 @@ static int __init snd_sgalaxy_mixer(struct snd_ad1848 *chip) | |||
218 | return 0; | 217 | return 0; |
219 | } | 218 | } |
220 | 219 | ||
221 | static int __init snd_sgalaxy_probe(struct platform_device *devptr) | 220 | static int __devinit snd_sgalaxy_match(struct device *devptr, unsigned int dev) |
222 | { | 221 | { |
223 | int dev = devptr->id; | 222 | if (!enable[dev]) |
224 | static int possible_irqs[] = {7, 9, 10, 11, -1}; | 223 | return 0; |
225 | static int possible_dmas[] = {1, 3, 0, -1}; | ||
226 | int err, xirq, xdma1; | ||
227 | struct snd_card *card; | ||
228 | struct snd_ad1848 *chip; | ||
229 | |||
230 | if (sbport[dev] == SNDRV_AUTO_PORT) { | 224 | if (sbport[dev] == SNDRV_AUTO_PORT) { |
231 | snd_printk(KERN_ERR PFX "specify SB port\n"); | 225 | snd_printk(KERN_ERR PFX "specify SB port\n"); |
232 | return -EINVAL; | 226 | return 0; |
233 | } | 227 | } |
234 | if (wssport[dev] == SNDRV_AUTO_PORT) { | 228 | if (wssport[dev] == SNDRV_AUTO_PORT) { |
235 | snd_printk(KERN_ERR PFX "specify WSS port\n"); | 229 | snd_printk(KERN_ERR PFX "specify WSS port\n"); |
236 | return -EINVAL; | 230 | return 0; |
237 | } | 231 | } |
232 | return 1; | ||
233 | } | ||
234 | |||
235 | static int __devinit snd_sgalaxy_probe(struct device *devptr, unsigned int dev) | ||
236 | { | ||
237 | static int possible_irqs[] = {7, 9, 10, 11, -1}; | ||
238 | static int possible_dmas[] = {1, 3, 0, -1}; | ||
239 | int err, xirq, xdma1; | ||
240 | struct snd_card *card; | ||
241 | struct snd_ad1848 *chip; | ||
242 | |||
238 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 243 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); |
239 | if (card == NULL) | 244 | if (card == NULL) |
240 | return -ENOMEM; | 245 | return -ENOMEM; |
@@ -283,12 +288,12 @@ static int __init snd_sgalaxy_probe(struct platform_device *devptr) | |||
283 | sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d", | 288 | sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d", |
284 | wssport[dev], xirq, xdma1); | 289 | wssport[dev], xirq, xdma1); |
285 | 290 | ||
286 | snd_card_set_dev(card, &devptr->dev); | 291 | snd_card_set_dev(card, devptr); |
287 | 292 | ||
288 | if ((err = snd_card_register(card)) < 0) | 293 | if ((err = snd_card_register(card)) < 0) |
289 | goto _err; | 294 | goto _err; |
290 | 295 | ||
291 | platform_set_drvdata(devptr, card); | 296 | dev_set_drvdata(devptr, card); |
292 | return 0; | 297 | return 0; |
293 | 298 | ||
294 | _err: | 299 | _err: |
@@ -296,17 +301,18 @@ static int __init snd_sgalaxy_probe(struct platform_device *devptr) | |||
296 | return err; | 301 | return err; |
297 | } | 302 | } |
298 | 303 | ||
299 | static int __devexit snd_sgalaxy_remove(struct platform_device *devptr) | 304 | static int __devexit snd_sgalaxy_remove(struct device *devptr, unsigned int dev) |
300 | { | 305 | { |
301 | snd_card_free(platform_get_drvdata(devptr)); | 306 | snd_card_free(dev_get_drvdata(devptr)); |
302 | platform_set_drvdata(devptr, NULL); | 307 | dev_set_drvdata(devptr, NULL); |
303 | return 0; | 308 | return 0; |
304 | } | 309 | } |
305 | 310 | ||
306 | #ifdef CONFIG_PM | 311 | #ifdef CONFIG_PM |
307 | static int snd_sgalaxy_suspend(struct platform_device *pdev, pm_message_t state) | 312 | static int snd_sgalaxy_suspend(struct device *pdev, unsigned int n, |
313 | pm_message_t state) | ||
308 | { | 314 | { |
309 | struct snd_card *card = platform_get_drvdata(pdev); | 315 | struct snd_card *card = dev_get_drvdata(pdev); |
310 | struct snd_ad1848 *chip = card->private_data; | 316 | struct snd_ad1848 *chip = card->private_data; |
311 | 317 | ||
312 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 318 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
@@ -314,9 +320,9 @@ static int snd_sgalaxy_suspend(struct platform_device *pdev, pm_message_t state) | |||
314 | return 0; | 320 | return 0; |
315 | } | 321 | } |
316 | 322 | ||
317 | static int snd_sgalaxy_resume(struct platform_device *pdev) | 323 | static int snd_sgalaxy_resume(struct device *pdev, unsigned int n) |
318 | { | 324 | { |
319 | struct snd_card *card = platform_get_drvdata(pdev); | 325 | struct snd_card *card = dev_get_drvdata(pdev); |
320 | struct snd_ad1848 *chip = card->private_data; | 326 | struct snd_ad1848 *chip = card->private_data; |
321 | 327 | ||
322 | chip->resume(chip); | 328 | chip->resume(chip); |
@@ -328,9 +334,10 @@ static int snd_sgalaxy_resume(struct platform_device *pdev) | |||
328 | } | 334 | } |
329 | #endif | 335 | #endif |
330 | 336 | ||
331 | #define SND_SGALAXY_DRIVER "snd_sgalaxy" | 337 | #define DEV_NAME "sgalaxy" |
332 | 338 | ||
333 | static struct platform_driver snd_sgalaxy_driver = { | 339 | static struct isa_driver snd_sgalaxy_driver = { |
340 | .match = snd_sgalaxy_match, | ||
334 | .probe = snd_sgalaxy_probe, | 341 | .probe = snd_sgalaxy_probe, |
335 | .remove = __devexit_p(snd_sgalaxy_remove), | 342 | .remove = __devexit_p(snd_sgalaxy_remove), |
336 | #ifdef CONFIG_PM | 343 | #ifdef CONFIG_PM |
@@ -338,56 +345,18 @@ static struct platform_driver snd_sgalaxy_driver = { | |||
338 | .resume = snd_sgalaxy_resume, | 345 | .resume = snd_sgalaxy_resume, |
339 | #endif | 346 | #endif |
340 | .driver = { | 347 | .driver = { |
341 | .name = SND_SGALAXY_DRIVER | 348 | .name = DEV_NAME |
342 | }, | 349 | }, |
343 | }; | 350 | }; |
344 | 351 | ||
345 | static void __init_or_module snd_sgalaxy_unregister_all(void) | ||
346 | { | ||
347 | int i; | ||
348 | |||
349 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
350 | platform_device_unregister(devices[i]); | ||
351 | platform_driver_unregister(&snd_sgalaxy_driver); | ||
352 | } | ||
353 | |||
354 | static int __init alsa_card_sgalaxy_init(void) | 352 | static int __init alsa_card_sgalaxy_init(void) |
355 | { | 353 | { |
356 | int i, cards, err; | 354 | return isa_register_driver(&snd_sgalaxy_driver, SNDRV_CARDS); |
357 | |||
358 | err = platform_driver_register(&snd_sgalaxy_driver); | ||
359 | if (err < 0) | ||
360 | return err; | ||
361 | |||
362 | cards = 0; | ||
363 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
364 | struct platform_device *device; | ||
365 | if (! enable[i]) | ||
366 | continue; | ||
367 | device = platform_device_register_simple(SND_SGALAXY_DRIVER, | ||
368 | i, NULL, 0); | ||
369 | if (IS_ERR(device)) | ||
370 | continue; | ||
371 | if (!platform_get_drvdata(device)) { | ||
372 | platform_device_unregister(device); | ||
373 | continue; | ||
374 | } | ||
375 | devices[i] = device; | ||
376 | cards++; | ||
377 | } | ||
378 | if (!cards) { | ||
379 | #ifdef MODULE | ||
380 | snd_printk(KERN_ERR "Sound Galaxy soundcard not found or device busy\n"); | ||
381 | #endif | ||
382 | snd_sgalaxy_unregister_all(); | ||
383 | return -ENODEV; | ||
384 | } | ||
385 | return 0; | ||
386 | } | 355 | } |
387 | 356 | ||
388 | static void __exit alsa_card_sgalaxy_exit(void) | 357 | static void __exit alsa_card_sgalaxy_exit(void) |
389 | { | 358 | { |
390 | snd_sgalaxy_unregister_all(); | 359 | isa_unregister_driver(&snd_sgalaxy_driver); |
391 | } | 360 | } |
392 | 361 | ||
393 | module_init(alsa_card_sgalaxy_init) | 362 | module_init(alsa_card_sgalaxy_init) |
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index b1f25823c65..08c14978558 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <sound/driver.h> | 24 | #include <sound/driver.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/isa.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/pnp.h> | 29 | #include <linux/pnp.h> |
30 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
@@ -68,8 +68,6 @@ MODULE_PARM_DESC(mpu_irq, "MPU401 IRQ # for SoundScape driver."); | |||
68 | module_param_array(dma, int, NULL, 0444); | 68 | module_param_array(dma, int, NULL, 0444); |
69 | MODULE_PARM_DESC(dma, "DMA # for SoundScape driver."); | 69 | MODULE_PARM_DESC(dma, "DMA # for SoundScape driver."); |
70 | 70 | ||
71 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
72 | |||
73 | #ifdef CONFIG_PNP | 71 | #ifdef CONFIG_PNP |
74 | static int pnp_registered; | 72 | static int pnp_registered; |
75 | static struct pnp_card_device_id sscape_pnpids[] = { | 73 | static struct pnp_card_device_id sscape_pnpids[] = { |
@@ -1254,9 +1252,27 @@ static int __devinit create_sscape(int dev, struct snd_card **rcardp) | |||
1254 | } | 1252 | } |
1255 | 1253 | ||
1256 | 1254 | ||
1257 | static int __devinit snd_sscape_probe(struct platform_device *pdev) | 1255 | static int __devinit snd_sscape_match(struct device *pdev, unsigned int i) |
1256 | { | ||
1257 | /* | ||
1258 | * Make sure we were given ALL of the other parameters. | ||
1259 | */ | ||
1260 | if (port[i] == SNDRV_AUTO_PORT) | ||
1261 | return 0; | ||
1262 | |||
1263 | if (irq[i] == SNDRV_AUTO_IRQ || | ||
1264 | mpu_irq[i] == SNDRV_AUTO_IRQ || | ||
1265 | dma[i] == SNDRV_AUTO_DMA) { | ||
1266 | printk(KERN_INFO | ||
1267 | "sscape: insufficient parameters, need IO, IRQ, MPU-IRQ and DMA\n"); | ||
1268 | return 0; | ||
1269 | } | ||
1270 | |||
1271 | return 1; | ||
1272 | } | ||
1273 | |||
1274 | static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev) | ||
1258 | { | 1275 | { |
1259 | int dev = pdev->id; | ||
1260 | struct snd_card *card; | 1276 | struct snd_card *card; |
1261 | int ret; | 1277 | int ret; |
1262 | 1278 | ||
@@ -1264,30 +1280,31 @@ static int __devinit snd_sscape_probe(struct platform_device *pdev) | |||
1264 | ret = create_sscape(dev, &card); | 1280 | ret = create_sscape(dev, &card); |
1265 | if (ret < 0) | 1281 | if (ret < 0) |
1266 | return ret; | 1282 | return ret; |
1267 | snd_card_set_dev(card, &pdev->dev); | 1283 | snd_card_set_dev(card, pdev); |
1268 | if ((ret = snd_card_register(card)) < 0) { | 1284 | if ((ret = snd_card_register(card)) < 0) { |
1269 | printk(KERN_ERR "sscape: Failed to register sound card\n"); | 1285 | printk(KERN_ERR "sscape: Failed to register sound card\n"); |
1270 | return ret; | 1286 | return ret; |
1271 | } | 1287 | } |
1272 | platform_set_drvdata(pdev, card); | 1288 | dev_set_drvdata(pdev, card); |
1273 | return 0; | 1289 | return 0; |
1274 | } | 1290 | } |
1275 | 1291 | ||
1276 | static int __devexit snd_sscape_remove(struct platform_device *devptr) | 1292 | static int __devexit snd_sscape_remove(struct device *devptr, unsigned int dev) |
1277 | { | 1293 | { |
1278 | snd_card_free(platform_get_drvdata(devptr)); | 1294 | snd_card_free(dev_get_drvdata(devptr)); |
1279 | platform_set_drvdata(devptr, NULL); | 1295 | dev_set_drvdata(devptr, NULL); |
1280 | return 0; | 1296 | return 0; |
1281 | } | 1297 | } |
1282 | 1298 | ||
1283 | #define SSCAPE_DRIVER "snd_sscape" | 1299 | #define DEV_NAME "sscape" |
1284 | 1300 | ||
1285 | static struct platform_driver snd_sscape_driver = { | 1301 | static struct isa_driver snd_sscape_driver = { |
1302 | .match = snd_sscape_match, | ||
1286 | .probe = snd_sscape_probe, | 1303 | .probe = snd_sscape_probe, |
1287 | .remove = __devexit_p(snd_sscape_remove), | 1304 | .remove = __devexit_p(snd_sscape_remove), |
1288 | /* FIXME: suspend/resume */ | 1305 | /* FIXME: suspend/resume */ |
1289 | .driver = { | 1306 | .driver = { |
1290 | .name = SSCAPE_DRIVER | 1307 | .name = DEV_NAME |
1291 | }, | 1308 | }, |
1292 | }; | 1309 | }; |
1293 | 1310 | ||
@@ -1386,72 +1403,6 @@ static struct pnp_card_driver sscape_pnpc_driver = { | |||
1386 | 1403 | ||
1387 | #endif /* CONFIG_PNP */ | 1404 | #endif /* CONFIG_PNP */ |
1388 | 1405 | ||
1389 | static void __init_or_module sscape_unregister_all(void) | ||
1390 | { | ||
1391 | int i; | ||
1392 | |||
1393 | #ifdef CONFIG_PNP | ||
1394 | if (pnp_registered) | ||
1395 | pnp_unregister_card_driver(&sscape_pnpc_driver); | ||
1396 | #endif | ||
1397 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
1398 | platform_device_unregister(platform_devices[i]); | ||
1399 | platform_driver_unregister(&snd_sscape_driver); | ||
1400 | } | ||
1401 | |||
1402 | static int __init sscape_manual_probe(void) | ||
1403 | { | ||
1404 | struct platform_device *device; | ||
1405 | int i, ret; | ||
1406 | |||
1407 | ret = platform_driver_register(&snd_sscape_driver); | ||
1408 | if (ret < 0) | ||
1409 | return ret; | ||
1410 | |||
1411 | for (i = 0; i < SNDRV_CARDS; ++i) { | ||
1412 | /* | ||
1413 | * We do NOT probe for ports. | ||
1414 | * If we're not given a port number for this | ||
1415 | * card then we completely ignore this line | ||
1416 | * of parameters. | ||
1417 | */ | ||
1418 | if (port[i] == SNDRV_AUTO_PORT) | ||
1419 | continue; | ||
1420 | |||
1421 | /* | ||
1422 | * Make sure we were given ALL of the other parameters. | ||
1423 | */ | ||
1424 | if (irq[i] == SNDRV_AUTO_IRQ || | ||
1425 | mpu_irq[i] == SNDRV_AUTO_IRQ || | ||
1426 | dma[i] == SNDRV_AUTO_DMA) { | ||
1427 | printk(KERN_INFO | ||
1428 | "sscape: insufficient parameters, need IO, IRQ, MPU-IRQ and DMA\n"); | ||
1429 | sscape_unregister_all(); | ||
1430 | return -ENXIO; | ||
1431 | } | ||
1432 | |||
1433 | /* | ||
1434 | * This cards looks OK ... | ||
1435 | */ | ||
1436 | device = platform_device_register_simple(SSCAPE_DRIVER, | ||
1437 | i, NULL, 0); | ||
1438 | if (IS_ERR(device)) | ||
1439 | continue; | ||
1440 | if (!platform_get_drvdata(device)) { | ||
1441 | platform_device_unregister(device); | ||
1442 | continue; | ||
1443 | } | ||
1444 | platform_devices[i] = device; | ||
1445 | } | ||
1446 | return 0; | ||
1447 | } | ||
1448 | |||
1449 | static void sscape_exit(void) | ||
1450 | { | ||
1451 | sscape_unregister_all(); | ||
1452 | } | ||
1453 | |||
1454 | |||
1455 | static int __init sscape_init(void) | 1406 | static int __init sscape_init(void) |
1456 | { | 1407 | { |
1457 | int ret; | 1408 | int ret; |
@@ -1462,7 +1413,7 @@ static int __init sscape_init(void) | |||
1462 | * of allocating cards, because the operator is | 1413 | * of allocating cards, because the operator is |
1463 | * S-P-E-L-L-I-N-G it out for us... | 1414 | * S-P-E-L-L-I-N-G it out for us... |
1464 | */ | 1415 | */ |
1465 | ret = sscape_manual_probe(); | 1416 | ret = isa_register_driver(&snd_sscape_driver, SNDRV_CARDS); |
1466 | if (ret < 0) | 1417 | if (ret < 0) |
1467 | return ret; | 1418 | return ret; |
1468 | #ifdef CONFIG_PNP | 1419 | #ifdef CONFIG_PNP |
@@ -1472,5 +1423,14 @@ static int __init sscape_init(void) | |||
1472 | return 0; | 1423 | return 0; |
1473 | } | 1424 | } |
1474 | 1425 | ||
1426 | static void __exit sscape_exit(void) | ||
1427 | { | ||
1428 | #ifdef CONFIG_PNP | ||
1429 | if (pnp_registered) | ||
1430 | pnp_unregister_card_driver(&sscape_pnpc_driver); | ||
1431 | #endif | ||
1432 | isa_unregister_driver(&snd_sscape_driver); | ||
1433 | } | ||
1434 | |||
1475 | module_init(sscape_init); | 1435 | module_init(sscape_init); |
1476 | module_exit(sscape_exit); | 1436 | module_exit(sscape_exit); |
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index e2fdd5fd39d..75673f72385 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/isa.h> |
28 | #include <linux/pnp.h> | 28 | #include <linux/pnp.h> |
29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
30 | #include <sound/core.h> | 30 | #include <sound/core.h> |
@@ -40,7 +40,9 @@ MODULE_SUPPORTED_DEVICE("{{Turtle Beach,Maui/Tropez/Tropez+}}"); | |||
40 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 40 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
41 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 41 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
42 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ | 42 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ |
43 | #ifdef CONFIG_PNP | ||
43 | static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; | 44 | static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; |
45 | #endif | ||
44 | static long cs4232_pcm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ | 46 | static long cs4232_pcm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ |
45 | static int cs4232_pcm_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */ | 47 | static int cs4232_pcm_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */ |
46 | static long cs4232_mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ | 48 | static long cs4232_mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ |
@@ -83,8 +85,6 @@ MODULE_PARM_DESC(fm_port, "FM port #."); | |||
83 | module_param_array(use_cs4232_midi, bool, NULL, 0444); | 85 | module_param_array(use_cs4232_midi, bool, NULL, 0444); |
84 | MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)"); | 86 | MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)"); |
85 | 87 | ||
86 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
87 | |||
88 | #ifdef CONFIG_PNP | 88 | #ifdef CONFIG_PNP |
89 | static int pnp_registered; | 89 | static int pnp_registered; |
90 | 90 | ||
@@ -588,56 +588,67 @@ snd_wavefront_probe (struct snd_card *card, int dev) | |||
588 | return snd_card_register(card); | 588 | return snd_card_register(card); |
589 | } | 589 | } |
590 | 590 | ||
591 | static int __devinit snd_wavefront_nonpnp_probe(struct platform_device *pdev) | 591 | static int __devinit snd_wavefront_isa_match(struct device *pdev, |
592 | unsigned int dev) | ||
592 | { | 593 | { |
593 | int dev = pdev->id; | 594 | if (!enable[dev]) |
594 | struct snd_card *card; | 595 | return 0; |
595 | int err; | 596 | #ifdef CONFIG_PNP |
596 | 597 | if (isapnp[dev]) | |
598 | return 0; | ||
599 | #endif | ||
597 | if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { | 600 | if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { |
598 | snd_printk("specify CS4232 port\n"); | 601 | snd_printk("specify CS4232 port\n"); |
599 | return -EINVAL; | 602 | return 0; |
600 | } | 603 | } |
601 | if (ics2115_port[dev] == SNDRV_AUTO_PORT) { | 604 | if (ics2115_port[dev] == SNDRV_AUTO_PORT) { |
602 | snd_printk("specify ICS2115 port\n"); | 605 | snd_printk("specify ICS2115 port\n"); |
603 | return -ENODEV; | 606 | return 0; |
604 | } | 607 | } |
608 | return 1; | ||
609 | } | ||
610 | |||
611 | static int __devinit snd_wavefront_isa_probe(struct device *pdev, | ||
612 | unsigned int dev) | ||
613 | { | ||
614 | struct snd_card *card; | ||
615 | int err; | ||
605 | 616 | ||
606 | card = snd_wavefront_card_new(dev); | 617 | card = snd_wavefront_card_new(dev); |
607 | if (! card) | 618 | if (! card) |
608 | return -ENOMEM; | 619 | return -ENOMEM; |
609 | snd_card_set_dev(card, &pdev->dev); | 620 | snd_card_set_dev(card, pdev); |
610 | if ((err = snd_wavefront_probe(card, dev)) < 0) { | 621 | if ((err = snd_wavefront_probe(card, dev)) < 0) { |
611 | snd_card_free(card); | 622 | snd_card_free(card); |
612 | return err; | 623 | return err; |
613 | } | 624 | } |
614 | 625 | ||
615 | platform_set_drvdata(pdev, card); | 626 | dev_set_drvdata(pdev, card); |
616 | return 0; | 627 | return 0; |
617 | } | 628 | } |
618 | 629 | ||
619 | static int __devexit snd_wavefront_nonpnp_remove(struct platform_device *devptr) | 630 | static int __devexit snd_wavefront_isa_remove(struct device *devptr, |
631 | unsigned int dev) | ||
620 | { | 632 | { |
621 | snd_card_free(platform_get_drvdata(devptr)); | 633 | snd_card_free(dev_get_drvdata(devptr)); |
622 | platform_set_drvdata(devptr, NULL); | 634 | dev_set_drvdata(devptr, NULL); |
623 | return 0; | 635 | return 0; |
624 | } | 636 | } |
625 | 637 | ||
626 | #define WAVEFRONT_DRIVER "snd_wavefront" | 638 | #define DEV_NAME "wavefront" |
627 | 639 | ||
628 | static struct platform_driver snd_wavefront_driver = { | 640 | static struct isa_driver snd_wavefront_driver = { |
629 | .probe = snd_wavefront_nonpnp_probe, | 641 | .match = snd_wavefront_isa_match, |
630 | .remove = __devexit_p(snd_wavefront_nonpnp_remove), | 642 | .probe = snd_wavefront_isa_probe, |
643 | .remove = __devexit_p(snd_wavefront_isa_remove), | ||
631 | /* FIXME: suspend, resume */ | 644 | /* FIXME: suspend, resume */ |
632 | .driver = { | 645 | .driver = { |
633 | .name = WAVEFRONT_DRIVER | 646 | .name = DEV_NAME |
634 | }, | 647 | }, |
635 | }; | 648 | }; |
636 | 649 | ||
637 | 650 | ||
638 | #ifdef CONFIG_PNP | 651 | #ifdef CONFIG_PNP |
639 | static unsigned int __devinitdata wavefront_pnp_devices; | ||
640 | |||
641 | static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, | 652 | static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, |
642 | const struct pnp_card_device_id *pid) | 653 | const struct pnp_card_device_id *pid) |
643 | { | 654 | { |
@@ -670,7 +681,6 @@ static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, | |||
670 | 681 | ||
671 | pnp_set_card_drvdata(pcard, card); | 682 | pnp_set_card_drvdata(pcard, card); |
672 | dev++; | 683 | dev++; |
673 | wavefront_pnp_devices++; | ||
674 | return 0; | 684 | return 0; |
675 | } | 685 | } |
676 | 686 | ||
@@ -691,67 +701,28 @@ static struct pnp_card_driver wavefront_pnpc_driver = { | |||
691 | 701 | ||
692 | #endif /* CONFIG_PNP */ | 702 | #endif /* CONFIG_PNP */ |
693 | 703 | ||
694 | static void __init_or_module snd_wavefront_unregister_all(void) | ||
695 | { | ||
696 | int i; | ||
697 | |||
698 | #ifdef CONFIG_PNP | ||
699 | if (pnp_registered) | ||
700 | pnp_unregister_card_driver(&wavefront_pnpc_driver); | ||
701 | #endif | ||
702 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
703 | platform_device_unregister(platform_devices[i]); | ||
704 | platform_driver_unregister(&snd_wavefront_driver); | ||
705 | } | ||
706 | |||
707 | static int __init alsa_card_wavefront_init(void) | 704 | static int __init alsa_card_wavefront_init(void) |
708 | { | 705 | { |
709 | int i, err, cards = 0; | 706 | int err; |
710 | 707 | ||
711 | if ((err = platform_driver_register(&snd_wavefront_driver)) < 0) | 708 | err = isa_register_driver(&snd_wavefront_driver, SNDRV_CARDS); |
709 | if (err < 0) | ||
712 | return err; | 710 | return err; |
713 | |||
714 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
715 | struct platform_device *device; | ||
716 | if (! enable[i]) | ||
717 | continue; | ||
718 | #ifdef CONFIG_PNP | ||
719 | if (isapnp[i]) | ||
720 | continue; | ||
721 | #endif | ||
722 | device = platform_device_register_simple(WAVEFRONT_DRIVER, | ||
723 | i, NULL, 0); | ||
724 | if (IS_ERR(device)) | ||
725 | continue; | ||
726 | if (!platform_get_drvdata(device)) { | ||
727 | platform_device_unregister(device); | ||
728 | continue; | ||
729 | } | ||
730 | platform_devices[i] = device; | ||
731 | cards++; | ||
732 | } | ||
733 | |||
734 | #ifdef CONFIG_PNP | 711 | #ifdef CONFIG_PNP |
735 | err = pnp_register_card_driver(&wavefront_pnpc_driver); | 712 | err = pnp_register_card_driver(&wavefront_pnpc_driver); |
736 | if (!err) { | 713 | if (!err) |
737 | pnp_registered = 1; | 714 | pnp_registered = 1; |
738 | cards += wavefront_pnp_devices; | ||
739 | } | ||
740 | #endif | ||
741 | |||
742 | if (!cards) { | ||
743 | #ifdef MODULE | ||
744 | printk (KERN_ERR "No WaveFront cards found or devices busy\n"); | ||
745 | #endif | 715 | #endif |
746 | snd_wavefront_unregister_all(); | ||
747 | return -ENODEV; | ||
748 | } | ||
749 | return 0; | 716 | return 0; |
750 | } | 717 | } |
751 | 718 | ||
752 | static void __exit alsa_card_wavefront_exit(void) | 719 | static void __exit alsa_card_wavefront_exit(void) |
753 | { | 720 | { |
754 | snd_wavefront_unregister_all(); | 721 | #ifdef CONFIG_PNP |
722 | if (pnp_registered) | ||
723 | pnp_unregister_card_driver(&wavefront_pnpc_driver); | ||
724 | #endif | ||
725 | isa_unregister_driver(&snd_wavefront_driver); | ||
755 | } | 726 | } |
756 | 727 | ||
757 | module_init(alsa_card_wavefront_init) | 728 | module_init(alsa_card_wavefront_init) |
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c index 15331ed8819..fc95a870f69 100644 --- a/sound/isa/wavefront/wavefront_fx.c +++ b/sound/isa/wavefront/wavefront_fx.c | |||
@@ -35,9 +35,7 @@ | |||
35 | 35 | ||
36 | #define WAIT_IDLE 0xff | 36 | #define WAIT_IDLE 0xff |
37 | 37 | ||
38 | #define FIRMWARE_IN_THE_KERNEL | 38 | #ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL |
39 | |||
40 | #ifdef FIRMWARE_IN_THE_KERNEL | ||
41 | #include "yss225.c" | 39 | #include "yss225.c" |
42 | static const struct firmware yss225_registers_firmware = { | 40 | static const struct firmware yss225_registers_firmware = { |
43 | .data = (u8 *)yss225_registers, | 41 | .data = (u8 *)yss225_registers, |
@@ -258,21 +256,21 @@ snd_wavefront_fx_start (snd_wavefront_t *dev) | |||
258 | { | 256 | { |
259 | unsigned int i; | 257 | unsigned int i; |
260 | int err; | 258 | int err; |
261 | const struct firmware *firmware; | 259 | const struct firmware *firmware = NULL; |
262 | 260 | ||
263 | if (dev->fx_initialized) | 261 | if (dev->fx_initialized) |
264 | return 0; | 262 | return 0; |
265 | 263 | ||
264 | #ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL | ||
265 | firmware = &yss225_registers_firmware; | ||
266 | #else | ||
266 | err = request_firmware(&firmware, "yamaha/yss225_registers.bin", | 267 | err = request_firmware(&firmware, "yamaha/yss225_registers.bin", |
267 | dev->card->dev); | 268 | dev->card->dev); |
268 | if (err < 0) { | 269 | if (err < 0) { |
269 | #ifdef FIRMWARE_IN_THE_KERNEL | ||
270 | firmware = &yss225_registers_firmware; | ||
271 | #else | ||
272 | err = -1; | 270 | err = -1; |
273 | goto out; | 271 | goto out; |
274 | #endif | ||
275 | } | 272 | } |
273 | #endif | ||
276 | 274 | ||
277 | for (i = 0; i + 1 < firmware->size; i += 2) { | 275 | for (i = 0; i + 1 < firmware->size; i += 2) { |
278 | if (firmware->data[i] >= 8 && firmware->data[i] < 16) { | 276 | if (firmware->data[i] >= 8 && firmware->data[i] < 16) { |
@@ -295,9 +293,12 @@ snd_wavefront_fx_start (snd_wavefront_t *dev) | |||
295 | err = 0; | 293 | err = 0; |
296 | 294 | ||
297 | out: | 295 | out: |
298 | #ifdef FIRMWARE_IN_THE_KERNEL | 296 | #ifndef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL |
299 | if (firmware != &yss225_registers_firmware) | 297 | release_firmware(firmware); |
300 | #endif | 298 | #endif |
301 | release_firmware(firmware); | ||
302 | return err; | 299 | return err; |
303 | } | 300 | } |
301 | |||
302 | #ifndef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL | ||
303 | MODULE_FIRMWARE("yamaha/yss225_registers.bin"); | ||
304 | #endif | ||