2 * Xilinx DisplayPort Sound PCM support
4 * Copyright (C) 2015 Xilinx, Inc.
6 * Author: Hyun Woo Kwon <hyunk@xilinx.com>
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
18 #include <linux/device.h>
19 #include <linux/module.h>
20 #include <linux/platform_device.h>
22 #include <sound/dmaengine_pcm.h>
23 #include <sound/pcm.h>
24 #include <sound/soc.h>
26 static 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,
40 static const struct snd_dmaengine_pcm_config xilinx_dmaengine_pcm_config = {
41 .pcm_hardware = &xilinx_pcm_hw,
42 .prealloc_buffer_size = 64 * 1024,
45 static int xilinx_dp_pcm_probe(struct platform_device *pdev)
49 ret = devm_snd_dmaengine_pcm_register(&pdev->dev,
50 &xilinx_dmaengine_pcm_config, 0);
54 dev_info(&pdev->dev, "Xilinx DisplayPort Sound PCM probed\n");
59 static int xilinx_dp_pcm_dev_remove(struct platform_device *pdev)
64 static const struct of_device_id xilinx_dp_pcm_of_match[] = {
65 { .compatible = "xlnx,dp-snd-pcm", },
66 { /* end of table */ },
68 MODULE_DEVICE_TABLE(of, xilinx_dp_pcm_of_match);
70 static struct platform_driver xilinx_dp_pcm_driver = {
72 .name = "xilinx-dp-snd-pcm",
73 .of_match_table = xilinx_dp_pcm_of_match,
75 .probe = xilinx_dp_pcm_probe,
76 .remove = xilinx_dp_pcm_dev_remove,
78 module_platform_driver(xilinx_dp_pcm_driver);
80 MODULE_DESCRIPTION("Xilinx DisplayPort Sound PCM module");
81 MODULE_LICENSE("GPL v2");