2 * Copyright (c) 2018 Rockchip Electronics Co. Ltd.
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.
9 #include <linux/device.h>
10 #include <linux/init.h>
11 #include <linux/module.h>
13 #include <sound/core.h>
14 #include <sound/pcm.h>
15 #include <sound/soc.h>
16 #include <sound/dmaengine_pcm.h>
18 #include "rockchip_pcm.h"
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 SNDRV_PCM_INFO_INTERLEAVED,
26 .period_bytes_min = 32,
27 .period_bytes_max = 8192,
30 .buffer_bytes_max = 64 * 1024,
34 static const struct snd_dmaengine_pcm_config rk_dmaengine_pcm_config = {
35 .pcm_hardware = &snd_rockchip_hardware,
36 .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
37 .prealloc_buffer_size = 32 * 1024,
40 int rockchip_pcm_platform_register(struct device *dev)
42 return devm_snd_dmaengine_pcm_register(dev, &rk_dmaengine_pcm_config,
43 SND_DMAENGINE_PCM_FLAG_COMPAT);
45 EXPORT_SYMBOL_GPL(rockchip_pcm_platform_register);
47 MODULE_LICENSE("GPL v2");