1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#include <linux/device.h>
19#include <linux/module.h>
20#include <linux/platform_device.h>
21
22#include <sound/dmaengine_pcm.h>
23#include <sound/pcm.h>
24#include <sound/soc.h>
25
26static const struct snd_pcm_hardware xilinx_pcm_hw = {
27 .info = SNDRV_PCM_INFO_MMAP |
28 SNDRV_PCM_INFO_MMAP_VALID |
29 SNDRV_PCM_INFO_INTERLEAVED |
30 SNDRV_PCM_INFO_PAUSE |
31 SNDRV_PCM_INFO_RESUME |
32 SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
33 .buffer_bytes_max = 128 * 1024,
34 .period_bytes_min = 256,
35 .period_bytes_max = 1024 * 1024,
36 .periods_min = 2,
37 .periods_max = 256,
38};
39
40static const struct snd_dmaengine_pcm_config xilinx_dmaengine_pcm_config = {
41 .pcm_hardware = &xilinx_pcm_hw,
42 .prealloc_buffer_size = 64 * 1024,
43};
44
45static int xilinx_dp_pcm_probe(struct platform_device *pdev)
46{
47 int ret;
48
49 dev_set_name(&pdev->dev, pdev->dev.of_node->name);
50 ret = devm_snd_dmaengine_pcm_register(&pdev->dev,
51 &xilinx_dmaengine_pcm_config, 0);
52 if (ret)
53 return ret;
54
55 dev_info(&pdev->dev, "Xilinx DisplayPort Sound PCM probed\n");
56
57 return 0;
58}
59
60static const struct of_device_id xilinx_dp_pcm_of_match[] = {
61 { .compatible = "xlnx,dp-snd-pcm", },
62 { },
63};
64MODULE_DEVICE_TABLE(of, xilinx_dp_pcm_of_match);
65
66static struct platform_driver xilinx_dp_pcm_driver = {
67 .driver = {
68 .name = "xilinx-dp-snd-pcm",
69 .of_match_table = xilinx_dp_pcm_of_match,
70 },
71 .probe = xilinx_dp_pcm_probe,
72};
73module_platform_driver(xilinx_dp_pcm_driver);
74
75MODULE_DESCRIPTION("Xilinx DisplayPort Sound PCM module");
76MODULE_LICENSE("GPL v2");
77