aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2006-11-06 03:21:58 -0500
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:01:16 -0500
commit226968c7afd464b794f34f9ea8cb4bcfe48447dc (patch)
tree7f9f2e5651ad8b42f01d78c08f1b3b6c5e26be75 /sound/isa
parent59540fe85924ecb7b9760ab422cffaea0c3ce43a (diff)
[ALSA] wavefront: add request_firmware()
Load the YSS225 register initialization data using request_firmware(), if possible, instead of using the built-in data blob. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/Kconfig1
-rw-r--r--sound/isa/wavefront/wavefront_fx.c51
2 files changed, 42 insertions, 10 deletions
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index 565ed2add38b..4e3a9729f569 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -391,6 +391,7 @@ config SND_SSCAPE
391config SND_WAVEFRONT 391config SND_WAVEFRONT
392 tristate "Turtle Beach Maui,Tropez,Tropez+ (Wavefront)" 392 tristate "Turtle Beach Maui,Tropez,Tropez+ (Wavefront)"
393 depends on SND 393 depends on SND
394 select FW_LOADER
394 select SND_OPL3_LIB 395 select SND_OPL3_LIB
395 select SND_MPU401_UART 396 select SND_MPU401_UART
396 select SND_CS4231_LIB 397 select SND_CS4231_LIB
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}