diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /sound/drivers/vx | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'sound/drivers/vx')
-rw-r--r-- | sound/drivers/vx/vx_core.c | 3 | ||||
-rw-r--r-- | sound/drivers/vx/vx_hwdep.c | 140 | ||||
-rw-r--r-- | sound/drivers/vx/vx_pcm.c | 2 |
3 files changed, 141 insertions, 4 deletions
diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c index de5055a3b0d..19c6e376c7c 100644 --- a/sound/drivers/vx/vx_core.c +++ b/sound/drivers/vx/vx_core.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/device.h> | 27 | #include <linux/device.h> |
28 | #include <linux/firmware.h> | 28 | #include <linux/firmware.h> |
29 | #include <linux/module.h> | ||
30 | #include <sound/core.h> | 29 | #include <sound/core.h> |
31 | #include <sound/pcm.h> | 30 | #include <sound/pcm.h> |
32 | #include <sound/asoundef.h> | 31 | #include <sound/asoundef.h> |
@@ -725,7 +724,7 @@ EXPORT_SYMBOL(snd_vx_dsp_load); | |||
725 | /* | 724 | /* |
726 | * suspend | 725 | * suspend |
727 | */ | 726 | */ |
728 | int snd_vx_suspend(struct vx_core *chip) | 727 | int snd_vx_suspend(struct vx_core *chip, pm_message_t state) |
729 | { | 728 | { |
730 | unsigned int i; | 729 | unsigned int i; |
731 | 730 | ||
diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c index 3014b86362b..f7a6fbd313e 100644 --- a/sound/drivers/vx/vx_hwdep.c +++ b/sound/drivers/vx/vx_hwdep.c | |||
@@ -24,11 +24,12 @@ | |||
24 | #include <linux/firmware.h> | 24 | #include <linux/firmware.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
27 | #include <linux/module.h> | ||
28 | #include <sound/core.h> | 27 | #include <sound/core.h> |
29 | #include <sound/hwdep.h> | 28 | #include <sound/hwdep.h> |
30 | #include <sound/vx_core.h> | 29 | #include <sound/vx_core.h> |
31 | 30 | ||
31 | #ifdef SND_VX_FW_LOADER | ||
32 | |||
32 | MODULE_FIRMWARE("vx/bx_1_vxp.b56"); | 33 | MODULE_FIRMWARE("vx/bx_1_vxp.b56"); |
33 | MODULE_FIRMWARE("vx/bx_1_vp4.b56"); | 34 | MODULE_FIRMWARE("vx/bx_1_vp4.b56"); |
34 | MODULE_FIRMWARE("vx/x1_1_vx2.xlx"); | 35 | MODULE_FIRMWARE("vx/x1_1_vx2.xlx"); |
@@ -117,5 +118,142 @@ void snd_vx_free_firmware(struct vx_core *chip) | |||
117 | #endif | 118 | #endif |
118 | } | 119 | } |
119 | 120 | ||
121 | #else /* old style firmware loading */ | ||
122 | |||
123 | static int vx_hwdep_dsp_status(struct snd_hwdep *hw, | ||
124 | struct snd_hwdep_dsp_status *info) | ||
125 | { | ||
126 | static char *type_ids[VX_TYPE_NUMS] = { | ||
127 | [VX_TYPE_BOARD] = "vxboard", | ||
128 | [VX_TYPE_V2] = "vx222", | ||
129 | [VX_TYPE_MIC] = "vx222", | ||
130 | [VX_TYPE_VXPOCKET] = "vxpocket", | ||
131 | [VX_TYPE_VXP440] = "vxp440", | ||
132 | }; | ||
133 | struct vx_core *vx = hw->private_data; | ||
134 | |||
135 | if (snd_BUG_ON(!type_ids[vx->type])) | ||
136 | return -EINVAL; | ||
137 | strcpy(info->id, type_ids[vx->type]); | ||
138 | if (vx_is_pcmcia(vx)) | ||
139 | info->num_dsps = 4; | ||
140 | else | ||
141 | info->num_dsps = 3; | ||
142 | if (vx->chip_status & VX_STAT_CHIP_INIT) | ||
143 | info->chip_ready = 1; | ||
144 | info->version = VX_DRIVER_VERSION; | ||
145 | return 0; | ||
146 | } | ||
147 | |||
148 | static void free_fw(const struct firmware *fw) | ||
149 | { | ||
150 | if (fw) { | ||
151 | vfree(fw->data); | ||
152 | kfree(fw); | ||
153 | } | ||
154 | } | ||
155 | |||
156 | static int vx_hwdep_dsp_load(struct snd_hwdep *hw, | ||
157 | struct snd_hwdep_dsp_image *dsp) | ||
158 | { | ||
159 | struct vx_core *vx = hw->private_data; | ||
160 | int index, err; | ||
161 | struct firmware *fw; | ||
162 | |||
163 | if (snd_BUG_ON(!vx->ops->load_dsp)) | ||
164 | return -ENXIO; | ||
165 | |||
166 | fw = kmalloc(sizeof(*fw), GFP_KERNEL); | ||
167 | if (! fw) { | ||
168 | snd_printk(KERN_ERR "cannot allocate firmware\n"); | ||
169 | return -ENOMEM; | ||
170 | } | ||
171 | fw->size = dsp->length; | ||
172 | fw->data = vmalloc(fw->size); | ||
173 | if (! fw->data) { | ||
174 | snd_printk(KERN_ERR "cannot allocate firmware image (length=%d)\n", | ||
175 | (int)fw->size); | ||
176 | kfree(fw); | ||
177 | return -ENOMEM; | ||
178 | } | ||
179 | if (copy_from_user((void *)fw->data, dsp->image, dsp->length)) { | ||
180 | free_fw(fw); | ||
181 | return -EFAULT; | ||
182 | } | ||
183 | |||
184 | index = dsp->index; | ||
185 | if (! vx_is_pcmcia(vx)) | ||
186 | index++; | ||
187 | err = vx->ops->load_dsp(vx, index, fw); | ||
188 | if (err < 0) { | ||
189 | free_fw(fw); | ||
190 | return err; | ||
191 | } | ||
192 | #ifdef CONFIG_PM | ||
193 | vx->firmware[index] = fw; | ||
194 | #else | ||
195 | free_fw(fw); | ||
196 | #endif | ||
197 | |||
198 | if (index == 1) | ||
199 | vx->chip_status |= VX_STAT_XILINX_LOADED; | ||
200 | if (index < 3) | ||
201 | return 0; | ||
202 | |||
203 | /* ok, we reached to the last one */ | ||
204 | /* create the devices if not built yet */ | ||
205 | if (! (vx->chip_status & VX_STAT_DEVICE_INIT)) { | ||
206 | if ((err = snd_vx_pcm_new(vx)) < 0) | ||
207 | return err; | ||
208 | |||
209 | if ((err = snd_vx_mixer_new(vx)) < 0) | ||
210 | return err; | ||
211 | |||
212 | if (vx->ops->add_controls) | ||
213 | if ((err = vx->ops->add_controls(vx)) < 0) | ||
214 | return err; | ||
215 | |||
216 | if ((err = snd_card_register(vx->card)) < 0) | ||
217 | return err; | ||
218 | |||
219 | vx->chip_status |= VX_STAT_DEVICE_INIT; | ||
220 | } | ||
221 | vx->chip_status |= VX_STAT_CHIP_INIT; | ||
222 | return 0; | ||
223 | } | ||
224 | |||
225 | |||
226 | /* exported */ | ||
227 | int snd_vx_setup_firmware(struct vx_core *chip) | ||
228 | { | ||
229 | int err; | ||
230 | struct snd_hwdep *hw; | ||
231 | |||
232 | if ((err = snd_hwdep_new(chip->card, SND_VX_HWDEP_ID, 0, &hw)) < 0) | ||
233 | return err; | ||
234 | |||
235 | hw->iface = SNDRV_HWDEP_IFACE_VX; | ||
236 | hw->private_data = chip; | ||
237 | hw->ops.dsp_status = vx_hwdep_dsp_status; | ||
238 | hw->ops.dsp_load = vx_hwdep_dsp_load; | ||
239 | hw->exclusive = 1; | ||
240 | sprintf(hw->name, "VX Loader (%s)", chip->card->driver); | ||
241 | chip->hwdep = hw; | ||
242 | |||
243 | return snd_card_register(chip->card); | ||
244 | } | ||
245 | |||
246 | /* exported */ | ||
247 | void snd_vx_free_firmware(struct vx_core *chip) | ||
248 | { | ||
249 | #ifdef CONFIG_PM | ||
250 | int i; | ||
251 | for (i = 0; i < 4; i++) | ||
252 | free_fw(chip->firmware[i]); | ||
253 | #endif | ||
254 | } | ||
255 | |||
256 | #endif /* SND_VX_FW_LOADER */ | ||
257 | |||
120 | EXPORT_SYMBOL(snd_vx_setup_firmware); | 258 | EXPORT_SYMBOL(snd_vx_setup_firmware); |
121 | EXPORT_SYMBOL(snd_vx_free_firmware); | 259 | EXPORT_SYMBOL(snd_vx_free_firmware); |
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c index deed5efff33..5e897b236ce 100644 --- a/sound/drivers/vx/vx_pcm.c +++ b/sound/drivers/vx/vx_pcm.c | |||
@@ -184,7 +184,7 @@ static int vx_set_format(struct vx_core *chip, struct vx_pipe *pipe, | |||
184 | default : | 184 | default : |
185 | snd_BUG(); | 185 | snd_BUG(); |
186 | return -EINVAL; | 186 | return -EINVAL; |
187 | } | 187 | }; |
188 | 188 | ||
189 | return vx_set_stream_format(chip, pipe, header); | 189 | return vx_set_stream_format(chip, pipe, header); |
190 | } | 190 | } |