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 const char * const 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 err = snd_vx_pcm_new(chip);
73 err = snd_vx_mixer_new(chip);
77 if (chip->ops->add_controls) {
78 err = chip->ops->add_controls(chip);
83 chip->chip_status |= VX_STAT_DEVICE_INIT;
84 chip->chip_status |= VX_STAT_CHIP_INIT;
86 return snd_card_register(chip->card);
90 void snd_vx_free_firmware(struct vx_core *chip)
94 for (i = 0; i < 4; i++)
95 release_firmware(chip->firmware[i]);
99 EXPORT_SYMBOL(snd_vx_setup_firmware);
100 EXPORT_SYMBOL(snd_vx_free_firmware);