~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to sound/soc/fsl/fsl_dma.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
294
294
 * Regardless of where the memory is actually allocated, since the device can
295
295
 * technically DMA to any 36-bit address, we do need to set the DMA mask to 36.
296
296
 */
297
 
static int fsl_dma_new(struct snd_card *card, struct snd_soc_dai *dai,
298
 
        struct snd_pcm *pcm)
 
297
static int fsl_dma_new(struct snd_soc_pcm_runtime *rtd)
299
298
{
 
299
        struct snd_card *card = rtd->card->snd_card;
 
300
        struct snd_soc_dai *dai = rtd->cpu_dai;
 
301
        struct snd_pcm *pcm = rtd->pcm;
300
302
        static u64 fsl_dma_dmamask = DMA_BIT_MASK(36);
301
303
        int ret;
302
304
 
310
312
         * should allocate a DMA buffer only for the streams that are valid.
311
313
         */
312
314
 
313
 
        if (dai->driver->playback.channels_min) {
 
315
        if (pcm->streams[0].substream) {
314
316
                ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
315
317
                        fsl_dma_hardware.buffer_bytes_max,
316
318
                        &pcm->streams[0].substream->dma_buffer);
320
322
                }
321
323
        }
322
324
 
323
 
        if (dai->driver->capture.channels_min) {
 
325
        if (pcm->streams[1].substream) {
324
326
                ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
325
327
                        fsl_dma_hardware.buffer_bytes_max,
326
328
                        &pcm->streams[1].substream->dma_buffer);
327
329
                if (ret) {
 
330
                        dev_err(card->dev, "can't alloc capture dma buffer\n");
328
331
                        snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer);
329
 
                        dev_err(card->dev, "can't alloc capture dma buffer\n");
330
332
                        return ret;
331
333
                }
332
334
        }
449
451
        dma_private->ld_buf_phys = ld_buf_phys;
450
452
        dma_private->dma_buf_phys = substream->dma_buffer.addr;
451
453
 
452
 
        ret = request_irq(dma_private->irq, fsl_dma_isr, 0, "DMA", dma_private);
 
454
        ret = request_irq(dma_private->irq, fsl_dma_isr, 0, "fsldma-audio",
 
455
                          dma_private);
453
456
        if (ret) {
454
457
                dev_err(dev, "can't register ISR for IRQ %u (ret=%i)\n",
455
458
                        dma_private->irq, ret);
896
899
        .pointer        = fsl_dma_pointer,
897
900
};
898
901
 
899
 
static int __devinit fsl_soc_dma_probe(struct platform_device *pdev,
900
 
                                       const struct of_device_id *match)
 
902
static int __devinit fsl_soc_dma_probe(struct platform_device *pdev)
901
903
 {
902
904
        struct dma_object *dma;
903
905
        struct device_node *np = pdev->dev.of_node;
979
981
};
980
982
MODULE_DEVICE_TABLE(of, fsl_soc_dma_ids);
981
983
 
982
 
static struct of_platform_driver fsl_soc_dma_driver = {
 
984
static struct platform_driver fsl_soc_dma_driver = {
983
985
        .driver = {
984
986
                .name = "fsl-pcm-audio",
985
987
                .owner = THIS_MODULE,
993
995
{
994
996
        pr_info("Freescale Elo DMA ASoC PCM Driver\n");
995
997
 
996
 
        return of_register_platform_driver(&fsl_soc_dma_driver);
 
998
        return platform_driver_register(&fsl_soc_dma_driver);
997
999
}
998
1000
 
999
1001
static void __exit fsl_soc_dma_exit(void)
1000
1002
{
1001
 
        of_unregister_platform_driver(&fsl_soc_dma_driver);
 
1003
        platform_driver_unregister(&fsl_soc_dma_driver);
1002
1004
}
1003
1005
 
1004
1006
module_init(fsl_soc_dma_init);