Commit 226968c7 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Jaroslav Kysela

[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: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 59540fe8
...@@ -391,6 +391,7 @@ config SND_SSCAPE ...@@ -391,6 +391,7 @@ config SND_SSCAPE
config SND_WAVEFRONT config SND_WAVEFRONT
tristate "Turtle Beach Maui,Tropez,Tropez+ (Wavefront)" tristate "Turtle Beach Maui,Tropez,Tropez+ (Wavefront)"
depends on SND depends on SND
select FW_LOADER
select SND_OPL3_LIB select SND_OPL3_LIB
select SND_MPU401_UART select SND_MPU401_UART
select SND_CS4231_LIB select SND_CS4231_LIB
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/firmware.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/snd_wavefront.h> #include <sound/snd_wavefront.h>
#include <sound/initval.h> #include <sound/initval.h>
...@@ -34,7 +35,15 @@ ...@@ -34,7 +35,15 @@
#define WAIT_IDLE 0xff #define WAIT_IDLE 0xff
#define FIRMWARE_IN_THE_KERNEL
#ifdef FIRMWARE_IN_THE_KERNEL
#include "yss225.c" #include "yss225.c"
static const struct firmware yss225_registers_firmware = {
.data = (u8 *)yss225_registers,
.size = sizeof yss225_registers
};
#endif
static int static int
wavefront_fx_idle (snd_wavefront_t *dev) wavefront_fx_idle (snd_wavefront_t *dev)
...@@ -248,25 +257,47 @@ int __devinit ...@@ -248,25 +257,47 @@ int __devinit
snd_wavefront_fx_start (snd_wavefront_t *dev) snd_wavefront_fx_start (snd_wavefront_t *dev)
{ {
unsigned int i; unsigned int i;
int err;
const struct firmware *firmware;
if (dev->fx_initialized) if (dev->fx_initialized)
return 0; return 0;
for (i = 0; i < ARRAY_SIZE(yss225_registers); ++i) { err = request_firmware(&firmware, "yamaha/yss225_registers.bin",
if (yss225_registers[i].addr >= 8 && dev->card->dev);
yss225_registers[i].addr < 16) { if (err < 0) {
outb(yss225_registers[i].data, #ifdef FIRMWARE_IN_THE_KERNEL
yss225_registers[i].addr + dev->base); firmware = &yss225_registers_firmware;
} else if (yss225_registers[i].addr == WAIT_IDLE) { #else
if (!wavefront_fx_idle(dev)) err = -1;
return -1; goto out;
#endif
}
for (i = 0; i + 1 < firmware->size; i += 2) {
if (firmware->data[i] >= 8 && firmware->data[i] < 16) {
outb(firmware->data[i + 1],
dev->base + firmware->data[i]);
} else if (firmware->data[i] == WAIT_IDLE) {
if (!wavefront_fx_idle(dev)) {
err = -1;
goto out;
}
} else { } else {
snd_printk(KERN_ERR "invalid address" snd_printk(KERN_ERR "invalid address"
" in register data\n"); " in register data\n");
return -1; err = -1;
goto out;
} }
} }
dev->fx_initialized = 1; dev->fx_initialized = 1;
return (0); err = 0;
out:
#ifdef FIRMWARE_IN_THE_KERNEL
if (firmware != &yss225_registers_firmware)
#endif
release_firmware(firmware);
return err;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment