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>
19 MODULE_FIRMWARE("vx/bx_1_vxp.b56");
20 MODULE_FIRMWARE("vx/bx_1_vp4.b56");
21 MODULE_FIRMWARE("vx/x1_1_vx2.xlx");
22 MODULE_FIRMWARE("vx/x1_2_v22.xlx");
23 MODULE_FIRMWARE("vx/x1_1_vxp.xlx");
24 MODULE_FIRMWARE("vx/x1_1_vp4.xlx");
25 MODULE_FIRMWARE("vx/bd56002.boot");
26 MODULE_FIRMWARE("vx/bd563v2.boot");
27 MODULE_FIRMWARE("vx/bd563s3.boot");
28 MODULE_FIRMWARE("vx/l_1_vx2.d56");
29 MODULE_FIRMWARE("vx/l_1_v22.d56");
30 MODULE_FIRMWARE("vx/l_1_vxp.d56");
31 MODULE_FIRMWARE("vx/l_1_vp4.d56");
33 int snd_vx_setup_firmware(struct vx_core
*chip
)
35 static const char * const fw_files
[VX_TYPE_NUMS
][4] = {
37 NULL
, "x1_1_vx2.xlx", "bd56002.boot", "l_1_vx2.d56",
40 NULL
, "x1_2_v22.xlx", "bd563v2.boot", "l_1_v22.d56",
43 NULL
, "x1_2_v22.xlx", "bd563v2.boot", "l_1_v22.d56",
45 [VX_TYPE_VXPOCKET
] = {
46 "bx_1_vxp.b56", "x1_1_vxp.xlx", "bd563s3.boot", "l_1_vxp.d56"
49 "bx_1_vp4.b56", "x1_1_vp4.xlx", "bd563s3.boot", "l_1_vp4.d56"
55 for (i
= 0; i
< 4; i
++) {
57 const struct firmware
*fw
;
58 if (! fw_files
[chip
->type
][i
])
60 sprintf(path
, "vx/%s", fw_files
[chip
->type
][i
]);
61 if (request_firmware(&fw
, path
, chip
->dev
)) {
62 snd_printk(KERN_ERR
"vx: can't load firmware %s\n", path
);
65 err
= chip
->ops
->load_dsp(chip
, i
, fw
);
71 chip
->chip_status
|= VX_STAT_XILINX_LOADED
;
73 chip
->firmware
[i
] = fw
;
79 /* ok, we reached to the last one */
80 /* create the devices if not built yet */
81 if ((err
= snd_vx_pcm_new(chip
)) < 0)
84 if ((err
= snd_vx_mixer_new(chip
)) < 0)
87 if (chip
->ops
->add_controls
)
88 if ((err
= chip
->ops
->add_controls(chip
)) < 0)
91 chip
->chip_status
|= VX_STAT_DEVICE_INIT
;
92 chip
->chip_status
|= VX_STAT_CHIP_INIT
;
94 return snd_card_register(chip
->card
);
98 void snd_vx_free_firmware(struct vx_core
*chip
)
102 for (i
= 0; i
< 4; i
++)
103 release_firmware(chip
->firmware
[i
]);
107 EXPORT_SYMBOL(snd_vx_setup_firmware
);
108 EXPORT_SYMBOL(snd_vx_free_firmware
);