18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2018 Rockchip Electronics Co. Ltd. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <linux/device.h> 78c2ecf20Sopenharmony_ci#include <linux/init.h> 88c2ecf20Sopenharmony_ci#include <linux/module.h> 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <sound/core.h> 118c2ecf20Sopenharmony_ci#include <sound/pcm.h> 128c2ecf20Sopenharmony_ci#include <sound/soc.h> 138c2ecf20Sopenharmony_ci#include <sound/dmaengine_pcm.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#include "rockchip_pcm.h" 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_cistatic const struct snd_pcm_hardware snd_rockchip_hardware = { 188c2ecf20Sopenharmony_ci .info = SNDRV_PCM_INFO_MMAP | 198c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_MMAP_VALID | 208c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_PAUSE | 218c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_RESUME | 228c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_INTERLEAVED, 238c2ecf20Sopenharmony_ci .period_bytes_min = 32, 248c2ecf20Sopenharmony_ci .period_bytes_max = 8192, 258c2ecf20Sopenharmony_ci .periods_min = 1, 268c2ecf20Sopenharmony_ci .periods_max = 52, 278c2ecf20Sopenharmony_ci .buffer_bytes_max = 64 * 1024, 288c2ecf20Sopenharmony_ci .fifo_size = 32, 298c2ecf20Sopenharmony_ci}; 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_cistatic const struct snd_dmaengine_pcm_config rk_dmaengine_pcm_config = { 328c2ecf20Sopenharmony_ci .pcm_hardware = &snd_rockchip_hardware, 338c2ecf20Sopenharmony_ci .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, 348c2ecf20Sopenharmony_ci .prealloc_buffer_size = 32 * 1024, 358c2ecf20Sopenharmony_ci}; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ciint rockchip_pcm_platform_register(struct device *dev) 388c2ecf20Sopenharmony_ci{ 398c2ecf20Sopenharmony_ci return devm_snd_dmaengine_pcm_register(dev, &rk_dmaengine_pcm_config, 408c2ecf20Sopenharmony_ci SND_DMAENGINE_PCM_FLAG_COMPAT); 418c2ecf20Sopenharmony_ci} 428c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(rockchip_pcm_platform_register); 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2"); 45