Root/
Source at commit 654fa4606ec498505bac64ceb8c5ccffb18da55d created 10 years 7 months ago. By Lars-Peter Clausen, ASoC: jz4740: Use the generic dmaengine PCM driver | |
---|---|
1 | /* |
2 | * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms of the GNU General Public License as published by the |
6 | * Free Software Foundation; either version 2 of the License, or (at your |
7 | * option) any later version. |
8 | * |
9 | * You should have received a copy of the GNU General Public License along |
10 | * with this program; if not, write to the Free Software Foundation, Inc., |
11 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
12 | * |
13 | */ |
14 | |
15 | #include <linux/init.h> |
16 | #include <linux/interrupt.h> |
17 | #include <linux/kernel.h> |
18 | #include <linux/module.h> |
19 | #include <linux/platform_device.h> |
20 | #include <linux/slab.h> |
21 | |
22 | #include <sound/dmaengine_pcm.h> |
23 | |
24 | static const struct snd_pcm_hardware jz4740_pcm_hardware = { |
25 | .info = SNDRV_PCM_INFO_MMAP | |
26 | SNDRV_PCM_INFO_MMAP_VALID | |
27 | SNDRV_PCM_INFO_INTERLEAVED | |
28 | SNDRV_PCM_INFO_BLOCK_TRANSFER, |
29 | .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8, |
30 | .period_bytes_min = 16, |
31 | .period_bytes_max = 2 * PAGE_SIZE, |
32 | .periods_min = 2, |
33 | .periods_max = 128, |
34 | .buffer_bytes_max = 128 * 2 * PAGE_SIZE, |
35 | .fifo_size = 32, |
36 | }; |
37 | |
38 | static const struct snd_dmaengine_pcm_config jz4740_dmaengine_pcm_config = { |
39 | .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, |
40 | .pcm_hardware = &jz4740_pcm_hardware, |
41 | .prealloc_buffer_size = 256 * PAGE_SIZE, |
42 | }; |
43 | |
44 | static int jz4740_pcm_probe(struct platform_device *pdev) |
45 | { |
46 | return snd_dmaengine_pcm_register(&pdev->dev, &jz4740_dmaengine_pcm_config, |
47 | SND_DMAENGINE_PCM_FLAG_COMPAT); |
48 | } |
49 | |
50 | static int jz4740_pcm_remove(struct platform_device *pdev) |
51 | { |
52 | snd_dmaengine_pcm_unregister(&pdev->dev); |
53 | return 0; |
54 | } |
55 | |
56 | static struct platform_driver jz4740_pcm_driver = { |
57 | .probe = jz4740_pcm_probe, |
58 | .remove = jz4740_pcm_remove, |
59 | .driver = { |
60 | .name = "jz4740-pcm-audio", |
61 | .owner = THIS_MODULE, |
62 | }, |
63 | }; |
64 | |
65 | module_platform_driver(jz4740_pcm_driver); |
66 | |
67 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); |
68 | MODULE_DESCRIPTION("Ingenic SoC JZ4740 PCM driver"); |
69 | MODULE_LICENSE("GPL"); |
70 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9