2 * Driver for Digigram VX soundcards
4 * DSP firmware management
6 * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <linux/device.h>
24 #include <linux/firmware.h>
25 #include <linux/slab.h>
26 #include <linux/vmalloc.h>
27 #include <linux/module.h>
28 #include <sound/core.h>
29 #include <sound/hwdep.h>
30 #include <sound/vx_core.h>
34 int snd_vx_setup_firmware(struct vx_core *chip)
36 static char *fw_files[VX_TYPE_NUMS][4] = {
38 NULL, "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/",
41 NULL, "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/",
44 NULL, "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/",
46 [VX_TYPE_VXPOCKET] = {
47 "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/"
50 "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/"
56 for (i = 0; i < 4; i++) {
58 const struct firmware *fw;
59 if (! fw_files[chip->type][i])
61 sprintf(path, "vx/%s", fw_files[chip->type][i]);
62 if (reject_firmware(&fw, path, chip->dev)) {
63 snd_printk(KERN_ERR "vx: can't load firmware %s\n", path);
66 err = chip->ops->load_dsp(chip, i, fw);
72 chip->chip_status |= VX_STAT_XILINX_LOADED;
74 chip->firmware[i] = fw;
80 /* ok, we reached to the last one */
81 /* create the devices if not built yet */
82 if ((err = snd_vx_pcm_new(chip)) < 0)
85 if ((err = snd_vx_mixer_new(chip)) < 0)
88 if (chip->ops->add_controls)
89 if ((err = chip->ops->add_controls(chip)) < 0)
92 chip->chip_status |= VX_STAT_DEVICE_INIT;
93 chip->chip_status |= VX_STAT_CHIP_INIT;
95 return snd_card_register(chip->card);
99 void snd_vx_free_firmware(struct vx_core *chip)
103 for (i = 0; i < 4; i++)
104 release_firmware(chip->firmware[i]);
108 EXPORT_SYMBOL(snd_vx_setup_firmware);
109 EXPORT_SYMBOL(snd_vx_free_firmware);