aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/wavefront
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/wavefront')
-rw-r--r--sound/isa/wavefront/wavefront_fx.c51
1 files changed, 41 insertions, 10 deletions
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c
index 2e03dc504d4c..15331ed88194 100644
--- a/sound/isa/wavefront/wavefront_fx.c
+++ b/sound/isa/wavefront/wavefront_fx.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/time.h> 22#include <linux/time.h>
23#include <linux/wait.h> 23#include <linux/wait.h>
24#include <linux/firmware.h>
24#include <sound/core.h> 25#include <sound/core.h>
25#include <sound/snd_wavefront.h> 26#include <sound/snd_wavefront.h>
26#include <sound/initval.h> 27#include <sound/initval.h>
@@ -34,7 +35,15 @@
34 35
35#define WAIT_IDLE 0xff 36#define WAIT_IDLE 0xff
36 37
38#define FIRMWARE_IN_THE_KERNEL
39
40#ifdef FIRMWARE_IN_THE_KERNEL
37#include "yss225.c" 41#include "yss225.c"
42static const struct firmware yss225_registers_firmware = {
43 .data = (u8 *)yss225_registers,
44 .size = sizeof yss225_registers
45};
46#endif
38 47
39static int 48static int
40wavefront_fx_idle (snd_wavefront_t *dev) 49wavefront_fx_idle (snd_wavefront_t *dev)
@@ -248,25 +257,47 @@ int __devinit
248snd_wavefront_fx_start (snd_wavefront_t *dev) 257snd_wavefront_fx_start (snd_wavefront_t *dev)
249{ 258{
250 unsigned int i; 259 unsigned int i;
260 int err;
261 const struct firmware *firmware;
251 262
252 if (dev->fx_initialized) 263 if (dev->fx_initialized)
253 return 0; 264 return 0;
254 265
255 for (i = 0; i < ARRAY_SIZE(yss225_registers); ++i) { 266 err = request_firmware(&firmware, "yamaha/yss225_registers.bin",
256 if (yss225_registers[i].addr >= 8 && 267 dev->card->dev);
257 yss225_registers[i].addr < 16) { 268 if (err < 0) {
258 outb(yss225_registers[i].data, 269#ifdef FIRMWARE_IN_THE_KERNEL
259 yss225_registers[i].addr + dev->base); 270 firmware = &yss225_registers_firmware;
260 } else if (yss225_registers[i].addr == WAIT_IDLE) { 271#else
261 if (!wavefront_fx_idle(dev)) 272 err = -1;
262 return -1; 273 goto out;
274#endif
275 }
276
277 for (i = 0; i + 1 < firmware->size; i += 2) {
278 if (firmware->data[i] >= 8 && firmware->data[i] < 16) {
279 outb(firmware->data[i + 1],
280 dev->base + firmware->data[i]);
281 } else if (firmware->data[i] == WAIT_IDLE) {
282 if (!wavefront_fx_idle(dev)) {
283 err = -1;
284 goto out;
285 }
263 } else { 286 } else {
264 snd_printk(KERN_ERR "invalid address" 287 snd_printk(KERN_ERR "invalid address"
265 " in register data\n"); 288 " in register data\n");
266 return -1; 289 err = -1;
290 goto out;
267 } 291 }
268 } 292 }
269 293
270 dev->fx_initialized = 1; 294 dev->fx_initialized = 1;
271 return (0); 295 err = 0;
296
297out:
298#ifdef FIRMWARE_IN_THE_KERNEL
299 if (firmware != &yss225_registers_firmware)
300#endif
301 release_firmware(firmware);
302 return err;
272} 303}