1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Driver for Digigram VX soundcards
5 * DSP firmware management
7 * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
10 #include <linux/device.h>
11 #include <linux/firmware.h>
12 #include <linux/slab.h>
13 #include <linux/vmalloc.h>
14 #include <linux/module.h>
15 #include <sound/core.h>
16 #include <sound/hwdep.h>
17 #include <sound/vx_core.h>
21 int snd_vx_setup_firmware(struct vx_core *chip)
23 static char *fw_files[VX_TYPE_NUMS][4] = {
25 NULL, "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/",
28 NULL, "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/",
31 NULL, "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/",
33 [VX_TYPE_VXPOCKET] = {
34 "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/"
37 "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/", "/*(DEBLOBBED)*/"
43 for (i = 0; i < 4; i++) {
45 const struct firmware *fw;
46 if (! fw_files[chip->type][i])
48 sprintf(path, "vx/%s", fw_files[chip->type][i]);
49 if (reject_firmware(&fw, path, chip->dev)) {
50 snd_printk(KERN_ERR "vx: can't load firmware %s\n", path);
53 err = chip->ops->load_dsp(chip, i, fw);
59 chip->chip_status |= VX_STAT_XILINX_LOADED;
61 chip->firmware[i] = fw;
67 /* ok, we reached to the last one */
68 /* create the devices if not built yet */
69 if ((err = snd_vx_pcm_new(chip)) < 0)
72 if ((err = snd_vx_mixer_new(chip)) < 0)
75 if (chip->ops->add_controls)
76 if ((err = chip->ops->add_controls(chip)) < 0)
79 chip->chip_status |= VX_STAT_DEVICE_INIT;
80 chip->chip_status |= VX_STAT_CHIP_INIT;
82 return snd_card_register(chip->card);
86 void snd_vx_free_firmware(struct vx_core *chip)
90 for (i = 0; i < 4; i++)
91 release_firmware(chip->firmware[i]);
95 EXPORT_SYMBOL(snd_vx_setup_firmware);
96 EXPORT_SYMBOL(snd_vx_free_firmware);