Jianqun Xu | 75b3119 | 2018-06-08 16:31:09 +0800 | [diff] [blame] | 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 | |
Katsuhiro Suzuki | 24d6638 | 2018-09-11 01:39:32 +0900 | [diff] [blame] | 24 | SNDRV_PCM_INFO_RESUME | |
| 25 | SNDRV_PCM_INFO_INTERLEAVED, |
Jianqun Xu | 75b3119 | 2018-06-08 16:31:09 +0800 | [diff] [blame] | 26 | .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 | |
| 34 | static const struct snd_dmaengine_pcm_config rk_dmaengine_pcm_config = { |
| 35 | .pcm_hardware = &snd_rockchip_hardware, |
Katsuhiro Suzuki | 16a8ee4 | 2018-11-11 00:18:44 +0900 | [diff] [blame] | 36 | .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, |
Jianqun Xu | 75b3119 | 2018-06-08 16:31:09 +0800 | [diff] [blame] | 37 | .prealloc_buffer_size = 32 * 1024, |
| 38 | }; |
| 39 | |
| 40 | int 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 | } |
| 45 | EXPORT_SYMBOL_GPL(rockchip_pcm_platform_register); |
| 46 | |
| 47 | MODULE_LICENSE("GPL v2"); |