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 b2bf272..413b78d 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 = { .mmap = snd_imx_pcm_mmap, }; +static int ssi_irq = 0; + static int imx_pcm_fiq_new(struct snd_card *card, struct snd_soc_dai *dai, struct snd_pcm *pcm) { @@ -245,7 +247,7 @@ static int imx_pcm_fiq_new(struct snd_card *card, struct snd_soc_dai *dai, if (ret) return ret; - if (dai->playback.channels_min) { + if (dai->driver->playback.channels_min) { struct snd_pcm_substream *substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; 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, imx_ssi_fiq_tx_buffer = (unsigned long)buf->area; } - if (dai->capture.channels_min) { + if (dai->driver->capture.channels_min) { struct snd_pcm_substream *substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; 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, return 0; } -static struct snd_soc_platform imx_soc_platform_fiq = { - .pcm_ops = &imx_pcm_ops, +static void imx_pcm_fiq_free(struct snd_pcm *pcm) +{ + mxc_set_irq_fiq(ssi_irq, 0); + release_fiq(&fh); + imx_pcm_free(pcm); +} + +static struct snd_soc_platform_driver imx_soc_platform_fiq = { + .ops = &imx_pcm_ops, .pcm_new = imx_pcm_fiq_new, - .pcm_free = imx_pcm_free, + .pcm_free = imx_pcm_fiq_free, }; -struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, - struct imx_ssi *ssi) +static int __devinit imx_soc_platform_probe(struct platform_device *pdev) { - int ret = 0; + struct imx_ssi *ssi = platform_get_drvdata(pdev); + int ret; ret = claim_fiq(&fh); if (ret) { dev_err(&pdev->dev, "failed to claim fiq: %d", ret); - return ERR_PTR(ret); + return ret; } mxc_set_irq_fiq(ssi->irq, 1); + ssi_irq = ssi->irq; imx_pcm_fiq = ssi->irq; @@ -293,13 +303,43 @@ struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, ssi->dma_params_tx.burstsize = 4; ssi->dma_params_rx.burstsize = 6; - return &imx_soc_platform_fiq; + ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq); + if (ret) + goto failed_register; + + return 0; + +failed_register: + mxc_set_irq_fiq(ssi_irq, 0); + release_fiq(&fh); + + return ret; } -void imx_ssi_fiq_exit(struct platform_device *pdev, - struct imx_ssi *ssi) +static int __devexit imx_soc_platform_remove(struct platform_device *pdev) { - mxc_set_irq_fiq(ssi->irq, 0); - release_fiq(&fh); + snd_soc_unregister_platform(&pdev->dev); + return 0; } +static struct platform_driver imx_pcm_driver = { + .driver = { + .name = "imx-fiq-pcm-audio", + .owner = THIS_MODULE, + }, + + .probe = imx_soc_platform_probe, + .remove = __devexit_p(imx_soc_platform_remove), +}; + +static int __init snd_imx_pcm_init(void) +{ + return platform_driver_register(&imx_pcm_driver); +} +module_init(snd_imx_pcm_init); + +static void __exit snd_imx_pcm_exit(void) +{ + platform_driver_unregister(&imx_pcm_driver); +} +module_exit(snd_imx_pcm_exit); |