1 /*
2 * Copyright (c) 2018 Rockchip Electronics Co. Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9 #include <linux/device.h>
10 #include <linux/init.h>
11 #include <linux/module.h>
12
13 #include <sound/core.h>
14 #include <sound/pcm.h>
15 #include <sound/soc.h>
16 #include <sound/dmaengine_pcm.h>
17
18 #include "rockchip_pcm.h"
19
20 static const struct snd_pcm_hardware snd_rockchip_hardware = {
21 .info = SNDRV_PCM_INFO_MMAP |
22 SNDRV_PCM_INFO_MMAP_VALID |
23 SNDRV_PCM_INFO_PAUSE |
24 SNDRV_PCM_INFO_RESUME,
25 .period_bytes_min = 32,
26 .period_bytes_max = 8192,
27 .periods_min = 1,
28 .periods_max = 52,
29 .buffer_bytes_max = 64 * 1024,
30 .fifo_size = 32,
31 };
32
33 static const struct snd_dmaengine_pcm_config rk_dmaengine_pcm_config = {
34 .pcm_hardware = &snd_rockchip_hardware,
35 .prealloc_buffer_size = 32 * 1024,
36 };
37
rockchip_pcm_platform_register(struct device * dev)38 int rockchip_pcm_platform_register(struct device *dev)
39 {
40 return devm_snd_dmaengine_pcm_register(dev, &rk_dmaengine_pcm_config,
41 SND_DMAENGINE_PCM_FLAG_COMPAT);
42 }
43 EXPORT_SYMBOL_GPL(rockchip_pcm_platform_register);
44
45 MODULE_LICENSE("GPL v2");
46