1 /* 2 * edma-pcm.c - eDMA PCM driver using dmaengine for AM3xxx, AM4xxx 3 * 4 * Copyright (C) 2014 Texas Instruments, Inc. 5 * 6 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> 7 * 8 * Based on: sound/soc/tegra/tegra_pcm.c 9 * 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU General Public License 12 * version 2 as published by the Free Software Foundation. 13 * 14 * This program is distributed in the hope that it will be useful, but 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * General Public License for more details. 18 */ 19 20 #include <linux/module.h> 21 #include <sound/core.h> 22 #include <sound/pcm.h> 23 #include <sound/pcm_params.h> 24 #include <sound/soc.h> 25 #include <sound/dmaengine_pcm.h> 26 27 #include "edma-pcm.h" 28 29 static const struct snd_pcm_hardware edma_pcm_hardware = { 30 .info = SNDRV_PCM_INFO_MMAP | 31 SNDRV_PCM_INFO_MMAP_VALID | 32 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME | 33 SNDRV_PCM_INFO_NO_PERIOD_WAKEUP | 34 SNDRV_PCM_INFO_INTERLEAVED, 35 .buffer_bytes_max = 128 * 1024, 36 .period_bytes_min = 32, 37 .period_bytes_max = 64 * 1024, 38 .periods_min = 2, 39 .periods_max = 19, /* Limit by edma dmaengine driver */ 40 }; 41 42 static const struct snd_dmaengine_pcm_config edma_dmaengine_pcm_config = { 43 .pcm_hardware = &edma_pcm_hardware, 44 .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, 45 .prealloc_buffer_size = 128 * 1024, 46 }; 47 48 int edma_pcm_platform_register(struct device *dev) 49 { 50 return devm_snd_dmaengine_pcm_register(dev, &edma_dmaengine_pcm_config, 0); 51 } 52 EXPORT_SYMBOL_GPL(edma_pcm_platform_register); 53 54 MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>"); 55 MODULE_DESCRIPTION("eDMA PCM ASoC platform driver"); 56 MODULE_LICENSE("GPL"); 57