blob: 4ac78d7a4b2da8fb51e9de8fcc751614787fb324 [file] [log] [blame]
Jianqun Xu75b31192018-06-08 16:31:09 +08001/*
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
20static 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 |
Katsuhiro Suzuki24d66382018-09-11 01:39:32 +090024 SNDRV_PCM_INFO_RESUME |
25 SNDRV_PCM_INFO_INTERLEAVED,
Jianqun Xu75b31192018-06-08 16:31:09 +080026 .period_bytes_min = 32,
27 .period_bytes_max = 8192,
28 .periods_min = 1,
29 .periods_max = 52,
30 .buffer_bytes_max = 64 * 1024,
31 .fifo_size = 32,
32};
33
34static const struct snd_dmaengine_pcm_config rk_dmaengine_pcm_config = {
35 .pcm_hardware = &snd_rockchip_hardware,
Katsuhiro Suzuki16a8ee42018-11-11 00:18:44 +090036 .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
Jianqun Xu75b31192018-06-08 16:31:09 +080037 .prealloc_buffer_size = 32 * 1024,
38};
39
40int rockchip_pcm_platform_register(struct device *dev)
41{
42 return devm_snd_dmaengine_pcm_register(dev, &rk_dmaengine_pcm_config,
43 SND_DMAENGINE_PCM_FLAG_COMPAT);
44}
45EXPORT_SYMBOL_GPL(rockchip_pcm_platform_register);
46
47MODULE_LICENSE("GPL v2");