2 * linux/sound/arm/ep93xx-pcm.c - EP93xx ALSA PCM interface
4 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
5 * Copyright (C) 2006 Applied Data Systems
7 * Rewritten for the SoC audio subsystem (Based on PXA2xx code):
8 * Copyright (c) 2008 Ryan Mallon
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
15 #include <linux/module.h>
16 #include <linux/init.h>
17 #include <linux/platform_device.h>
18 #include <linux/dmaengine.h>
20 #include <sound/pcm.h>
21 #include <sound/soc.h>
22 #include <sound/dmaengine_pcm.h>
24 #include <linux/platform_data/dma-ep93xx.h>
26 static const struct snd_pcm_hardware ep93xx_pcm_hardware = {
27 .info = (SNDRV_PCM_INFO_MMAP |
28 SNDRV_PCM_INFO_MMAP_VALID |
29 SNDRV_PCM_INFO_INTERLEAVED |
30 SNDRV_PCM_INFO_BLOCK_TRANSFER),
32 .rates = SNDRV_PCM_RATE_8000_192000,
33 .rate_min = SNDRV_PCM_RATE_8000,
34 .rate_max = SNDRV_PCM_RATE_192000,
36 .formats = (SNDRV_PCM_FMTBIT_S16_LE |
37 SNDRV_PCM_FMTBIT_S24_LE |
38 SNDRV_PCM_FMTBIT_S32_LE),
40 .buffer_bytes_max = 131072,
41 .period_bytes_min = 32,
42 .period_bytes_max = 32768,
48 static bool ep93xx_pcm_dma_filter(struct dma_chan *chan, void *filter_param)
50 struct ep93xx_dma_data *data = filter_param;
52 if (data->direction == ep93xx_dma_chan_direction(chan)) {
60 static const struct snd_dmaengine_pcm_config ep93xx_dmaengine_pcm_config = {
61 .pcm_hardware = &ep93xx_pcm_hardware,
62 .compat_filter_fn = ep93xx_pcm_dma_filter,
63 .prealloc_buffer_size = 131072,
66 static int ep93xx_soc_platform_probe(struct platform_device *pdev)
68 return snd_dmaengine_pcm_register(&pdev->dev,
69 &ep93xx_dmaengine_pcm_config,
70 SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
71 SND_DMAENGINE_PCM_FLAG_NO_DT |
72 SND_DMAENGINE_PCM_FLAG_COMPAT);
75 static int ep93xx_soc_platform_remove(struct platform_device *pdev)
77 snd_dmaengine_pcm_unregister(&pdev->dev);
81 static struct platform_driver ep93xx_pcm_driver = {
83 .name = "ep93xx-pcm-audio",
87 .probe = ep93xx_soc_platform_probe,
88 .remove = ep93xx_soc_platform_remove,
91 module_platform_driver(ep93xx_pcm_driver);
93 MODULE_AUTHOR("Ryan Mallon");
94 MODULE_DESCRIPTION("EP93xx ALSA PCM interface");
95 MODULE_LICENSE("GPL");
96 MODULE_ALIAS("platform:ep93xx-pcm-audio");