18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com 48c2ecf20Sopenharmony_ci * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/module.h> 88c2ecf20Sopenharmony_ci#include <sound/core.h> 98c2ecf20Sopenharmony_ci#include <sound/pcm.h> 108c2ecf20Sopenharmony_ci#include <sound/pcm_params.h> 118c2ecf20Sopenharmony_ci#include <sound/soc.h> 128c2ecf20Sopenharmony_ci#include <sound/dmaengine_pcm.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include "udma-pcm.h" 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_cistatic const struct snd_pcm_hardware udma_pcm_hardware = { 178c2ecf20Sopenharmony_ci .info = SNDRV_PCM_INFO_MMAP | 188c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_MMAP_VALID | 198c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME | 208c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_NO_PERIOD_WAKEUP | 218c2ecf20Sopenharmony_ci SNDRV_PCM_INFO_INTERLEAVED, 228c2ecf20Sopenharmony_ci .buffer_bytes_max = SIZE_MAX, 238c2ecf20Sopenharmony_ci .period_bytes_min = 32, 248c2ecf20Sopenharmony_ci .period_bytes_max = SZ_64K, 258c2ecf20Sopenharmony_ci .periods_min = 2, 268c2ecf20Sopenharmony_ci .periods_max = UINT_MAX, 278c2ecf20Sopenharmony_ci}; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_cistatic const struct snd_dmaengine_pcm_config udma_dmaengine_pcm_config = { 308c2ecf20Sopenharmony_ci .pcm_hardware = &udma_pcm_hardware, 318c2ecf20Sopenharmony_ci .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, 328c2ecf20Sopenharmony_ci}; 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciint udma_pcm_platform_register(struct device *dev) 358c2ecf20Sopenharmony_ci{ 368c2ecf20Sopenharmony_ci return devm_snd_dmaengine_pcm_register(dev, &udma_dmaengine_pcm_config, 378c2ecf20Sopenharmony_ci 0); 388c2ecf20Sopenharmony_ci} 398c2ecf20Sopenharmony_ciEXPORT_SYMBOL_GPL(udma_pcm_platform_register); 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ciMODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>"); 428c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("UDMA PCM ASoC platform driver"); 438c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2"); 44