aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-11-22 10:14:55 -0500
committerTakashi Iwai <tiwai@suse.de>2012-11-22 11:48:01 -0500
commit0d144de9af28f23d28e4cdf28a08e25e9ad3b41c (patch)
treed636f6ccf8b82334f77ed4997645de47e3ae2ef8
parentd19144987c4b84bda3aaee602242060a5ab504b9 (diff)
ALSA: vx: hard dependency on the standard fw loader
Yet again like previous two commits, drop the old hwdep user-space firmware code from vx driver (snd-vxpocket and snd-vx222). Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/sound/vx_core.h6
-rw-r--r--sound/drivers/Kconfig1
-rw-r--r--sound/drivers/vx/vx_hwdep.c139
3 files changed, 1 insertions, 145 deletions
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index 4f67c762cd74..f634f8f85db5 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -27,12 +27,6 @@
27#include <sound/hwdep.h> 27#include <sound/hwdep.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29 29
30#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
31#if !defined(CONFIG_USE_VXLOADER) && !defined(CONFIG_SND_VX_LIB) /* built-in kernel */
32#define SND_VX_FW_LOADER /* use the standard firmware loader */
33#endif
34#endif
35
36struct firmware; 30struct firmware;
37struct device; 31struct device;
38 32
diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig
index 5e4384137a76..7d02c322ed93 100644
--- a/sound/drivers/Kconfig
+++ b/sound/drivers/Kconfig
@@ -14,6 +14,7 @@ config SND_OPL4_LIB
14 14
15config SND_VX_LIB 15config SND_VX_LIB
16 tristate 16 tristate
17 select FW_LOADER
17 select SND_HWDEP 18 select SND_HWDEP
18 select SND_PCM 19 select SND_PCM
19 20
diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c
index 4a1fae99ac55..3014b86362bd 100644
--- a/sound/drivers/vx/vx_hwdep.c
+++ b/sound/drivers/vx/vx_hwdep.c
@@ -29,8 +29,6 @@
29#include <sound/hwdep.h> 29#include <sound/hwdep.h>
30#include <sound/vx_core.h> 30#include <sound/vx_core.h>
31 31
32#ifdef SND_VX_FW_LOADER
33
34MODULE_FIRMWARE("vx/bx_1_vxp.b56"); 32MODULE_FIRMWARE("vx/bx_1_vxp.b56");
35MODULE_FIRMWARE("vx/bx_1_vp4.b56"); 33MODULE_FIRMWARE("vx/bx_1_vp4.b56");
36MODULE_FIRMWARE("vx/x1_1_vx2.xlx"); 34MODULE_FIRMWARE("vx/x1_1_vx2.xlx");
@@ -119,142 +117,5 @@ void snd_vx_free_firmware(struct vx_core *chip)
119#endif 117#endif
120} 118}
121 119
122#else /* old style firmware loading */
123
124static int vx_hwdep_dsp_status(struct snd_hwdep *hw,
125 struct snd_hwdep_dsp_status *info)
126{
127 static char *type_ids[VX_TYPE_NUMS] = {
128 [VX_TYPE_BOARD] = "vxboard",
129 [VX_TYPE_V2] = "vx222",
130 [VX_TYPE_MIC] = "vx222",
131 [VX_TYPE_VXPOCKET] = "vxpocket",
132 [VX_TYPE_VXP440] = "vxp440",
133 };
134 struct vx_core *vx = hw->private_data;
135
136 if (snd_BUG_ON(!type_ids[vx->type]))
137 return -EINVAL;
138 strcpy(info->id, type_ids[vx->type]);
139 if (vx_is_pcmcia(vx))
140 info->num_dsps = 4;
141 else
142 info->num_dsps = 3;
143 if (vx->chip_status & VX_STAT_CHIP_INIT)
144 info->chip_ready = 1;
145 info->version = VX_DRIVER_VERSION;
146 return 0;
147}
148
149static void free_fw(const struct firmware *fw)
150{
151 if (fw) {
152 vfree(fw->data);
153 kfree(fw);
154 }
155}
156
157static int vx_hwdep_dsp_load(struct snd_hwdep *hw,
158 struct snd_hwdep_dsp_image *dsp)
159{
160 struct vx_core *vx = hw->private_data;
161 int index, err;
162 struct firmware *fw;
163
164 if (snd_BUG_ON(!vx->ops->load_dsp))
165 return -ENXIO;
166
167 fw = kmalloc(sizeof(*fw), GFP_KERNEL);
168 if (! fw) {
169 snd_printk(KERN_ERR "cannot allocate firmware\n");
170 return -ENOMEM;
171 }
172 fw->size = dsp->length;
173 fw->data = vmalloc(fw->size);
174 if (! fw->data) {
175 snd_printk(KERN_ERR "cannot allocate firmware image (length=%d)\n",
176 (int)fw->size);
177 kfree(fw);
178 return -ENOMEM;
179 }
180 if (copy_from_user((void *)fw->data, dsp->image, dsp->length)) {
181 free_fw(fw);
182 return -EFAULT;
183 }
184
185 index = dsp->index;
186 if (! vx_is_pcmcia(vx))
187 index++;
188 err = vx->ops->load_dsp(vx, index, fw);
189 if (err < 0) {
190 free_fw(fw);
191 return err;
192 }
193#ifdef CONFIG_PM
194 vx->firmware[index] = fw;
195#else
196 free_fw(fw);
197#endif
198
199 if (index == 1)
200 vx->chip_status |= VX_STAT_XILINX_LOADED;
201 if (index < 3)
202 return 0;
203
204 /* ok, we reached to the last one */
205 /* create the devices if not built yet */
206 if (! (vx->chip_status & VX_STAT_DEVICE_INIT)) {
207 if ((err = snd_vx_pcm_new(vx)) < 0)
208 return err;
209
210 if ((err = snd_vx_mixer_new(vx)) < 0)
211 return err;
212
213 if (vx->ops->add_controls)
214 if ((err = vx->ops->add_controls(vx)) < 0)
215 return err;
216
217 if ((err = snd_card_register(vx->card)) < 0)
218 return err;
219
220 vx->chip_status |= VX_STAT_DEVICE_INIT;
221 }
222 vx->chip_status |= VX_STAT_CHIP_INIT;
223 return 0;
224}
225
226
227/* exported */
228int snd_vx_setup_firmware(struct vx_core *chip)
229{
230 int err;
231 struct snd_hwdep *hw;
232
233 if ((err = snd_hwdep_new(chip->card, SND_VX_HWDEP_ID, 0, &hw)) < 0)
234 return err;
235
236 hw->iface = SNDRV_HWDEP_IFACE_VX;
237 hw->private_data = chip;
238 hw->ops.dsp_status = vx_hwdep_dsp_status;
239 hw->ops.dsp_load = vx_hwdep_dsp_load;
240 hw->exclusive = 1;
241 sprintf(hw->name, "VX Loader (%s)", chip->card->driver);
242 chip->hwdep = hw;
243
244 return snd_card_register(chip->card);
245}
246
247/* exported */
248void snd_vx_free_firmware(struct vx_core *chip)
249{
250#ifdef CONFIG_PM
251 int i;
252 for (i = 0; i < 4; i++)
253 free_fw(chip->firmware[i]);
254#endif
255}
256
257#endif /* SND_VX_FW_LOADER */
258
259EXPORT_SYMBOL(snd_vx_setup_firmware); 120EXPORT_SYMBOL(snd_vx_setup_firmware);
260EXPORT_SYMBOL(snd_vx_free_firmware); 121EXPORT_SYMBOL(snd_vx_free_firmware);