diff options
Diffstat (limited to 'sound/soc/imx/imx-pcm-fiq.c')
-rw-r--r-- | sound/soc/imx/imx-pcm-fiq.c | 68 |
1 files changed, 54 insertions, 14 deletions
diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/imx/imx-pcm-fiq.c index b2bf27282cd2..413b78da248f 100644 --- a/sound/soc/imx/imx-pcm-fiq.c +++ b/sound/soc/imx/imx-pcm-fiq.c | |||
@@ -236,6 +236,8 @@ static struct snd_pcm_ops imx_pcm_ops = { | |||
236 | .mmap = snd_imx_pcm_mmap, | 236 | .mmap = snd_imx_pcm_mmap, |
237 | }; | 237 | }; |
238 | 238 | ||
239 | static int ssi_irq = 0; | ||
240 | |||
239 | static int imx_pcm_fiq_new(struct snd_card *card, struct snd_soc_dai *dai, | 241 | static int imx_pcm_fiq_new(struct snd_card *card, struct snd_soc_dai *dai, |
240 | struct snd_pcm *pcm) | 242 | struct snd_pcm *pcm) |
241 | { | 243 | { |
@@ -245,7 +247,7 @@ static int imx_pcm_fiq_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
245 | if (ret) | 247 | if (ret) |
246 | return ret; | 248 | return ret; |
247 | 249 | ||
248 | if (dai->playback.channels_min) { | 250 | if (dai->driver->playback.channels_min) { |
249 | struct snd_pcm_substream *substream = | 251 | struct snd_pcm_substream *substream = |
250 | pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; | 252 | pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; |
251 | struct snd_dma_buffer *buf = &substream->dma_buffer; | 253 | struct snd_dma_buffer *buf = &substream->dma_buffer; |
@@ -253,7 +255,7 @@ static int imx_pcm_fiq_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
253 | imx_ssi_fiq_tx_buffer = (unsigned long)buf->area; | 255 | imx_ssi_fiq_tx_buffer = (unsigned long)buf->area; |
254 | } | 256 | } |
255 | 257 | ||
256 | if (dai->capture.channels_min) { | 258 | if (dai->driver->capture.channels_min) { |
257 | struct snd_pcm_substream *substream = | 259 | struct snd_pcm_substream *substream = |
258 | pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; | 260 | pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
259 | struct snd_dma_buffer *buf = &substream->dma_buffer; | 261 | struct snd_dma_buffer *buf = &substream->dma_buffer; |
@@ -267,24 +269,32 @@ static int imx_pcm_fiq_new(struct snd_card *card, struct snd_soc_dai *dai, | |||
267 | return 0; | 269 | return 0; |
268 | } | 270 | } |
269 | 271 | ||
270 | static struct snd_soc_platform imx_soc_platform_fiq = { | 272 | static void imx_pcm_fiq_free(struct snd_pcm *pcm) |
271 | .pcm_ops = &imx_pcm_ops, | 273 | { |
274 | mxc_set_irq_fiq(ssi_irq, 0); | ||
275 | release_fiq(&fh); | ||
276 | imx_pcm_free(pcm); | ||
277 | } | ||
278 | |||
279 | static struct snd_soc_platform_driver imx_soc_platform_fiq = { | ||
280 | .ops = &imx_pcm_ops, | ||
272 | .pcm_new = imx_pcm_fiq_new, | 281 | .pcm_new = imx_pcm_fiq_new, |
273 | .pcm_free = imx_pcm_free, | 282 | .pcm_free = imx_pcm_fiq_free, |
274 | }; | 283 | }; |
275 | 284 | ||
276 | struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, | 285 | static int __devinit imx_soc_platform_probe(struct platform_device *pdev) |
277 | struct imx_ssi *ssi) | ||
278 | { | 286 | { |
279 | int ret = 0; | 287 | struct imx_ssi *ssi = platform_get_drvdata(pdev); |
288 | int ret; | ||
280 | 289 | ||
281 | ret = claim_fiq(&fh); | 290 | ret = claim_fiq(&fh); |
282 | if (ret) { | 291 | if (ret) { |
283 | dev_err(&pdev->dev, "failed to claim fiq: %d", ret); | 292 | dev_err(&pdev->dev, "failed to claim fiq: %d", ret); |
284 | return ERR_PTR(ret); | 293 | return ret; |
285 | } | 294 | } |
286 | 295 | ||
287 | mxc_set_irq_fiq(ssi->irq, 1); | 296 | mxc_set_irq_fiq(ssi->irq, 1); |
297 | ssi_irq = ssi->irq; | ||
288 | 298 | ||
289 | imx_pcm_fiq = ssi->irq; | 299 | imx_pcm_fiq = ssi->irq; |
290 | 300 | ||
@@ -293,13 +303,43 @@ struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, | |||
293 | ssi->dma_params_tx.burstsize = 4; | 303 | ssi->dma_params_tx.burstsize = 4; |
294 | ssi->dma_params_rx.burstsize = 6; | 304 | ssi->dma_params_rx.burstsize = 6; |
295 | 305 | ||
296 | return &imx_soc_platform_fiq; | 306 | ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq); |
307 | if (ret) | ||
308 | goto failed_register; | ||
309 | |||
310 | return 0; | ||
311 | |||
312 | failed_register: | ||
313 | mxc_set_irq_fiq(ssi_irq, 0); | ||
314 | release_fiq(&fh); | ||
315 | |||
316 | return ret; | ||
297 | } | 317 | } |
298 | 318 | ||
299 | void imx_ssi_fiq_exit(struct platform_device *pdev, | 319 | static int __devexit imx_soc_platform_remove(struct platform_device *pdev) |
300 | struct imx_ssi *ssi) | ||
301 | { | 320 | { |
302 | mxc_set_irq_fiq(ssi->irq, 0); | 321 | snd_soc_unregister_platform(&pdev->dev); |
303 | release_fiq(&fh); | 322 | return 0; |
304 | } | 323 | } |
305 | 324 | ||
325 | static struct platform_driver imx_pcm_driver = { | ||
326 | .driver = { | ||
327 | .name = "imx-fiq-pcm-audio", | ||
328 | .owner = THIS_MODULE, | ||
329 | }, | ||
330 | |||
331 | .probe = imx_soc_platform_probe, | ||
332 | .remove = __devexit_p(imx_soc_platform_remove), | ||
333 | }; | ||
334 | |||
335 | static int __init snd_imx_pcm_init(void) | ||
336 | { | ||
337 | return platform_driver_register(&imx_pcm_driver); | ||
338 | } | ||
339 | module_init(snd_imx_pcm_init); | ||
340 | |||
341 | static void __exit snd_imx_pcm_exit(void) | ||
342 | { | ||
343 | platform_driver_unregister(&imx_pcm_driver); | ||
344 | } | ||
345 | module_exit(snd_imx_pcm_exit); | ||