summaryrefslogtreecommitdiff
path: root/sound/soc/soc-generic-dmaengine-pcm.c
diff options
context:
space:
mode:
authorSugar Zhang <sugar.zhang@rock-chips.com>2021-09-23 13:50:46 +0300
committerMark Brown <broonie@kernel.org>2021-09-27 15:01:13 +0300
commitb0e3b0a7078d71455747025e7deee766d4d43432 (patch)
tree0b138b1e7fec57fdf81a7a2b26b6295ed5959241 /sound/soc/soc-generic-dmaengine-pcm.c
parentd0900042522345ed51127d787f02e1171e110e27 (diff)
downloadlinux-b0e3b0a7078d71455747025e7deee766d4d43432.tar.xz
ASoC: dmaengine: Introduce module option prealloc_buffer_size_kbytes
Currently, The fixed 512KB prealloc buffer size is too larger for tiny memory kernel (such as 16MB memory). This patch adds the module option "prealloc_buffer_size_kbytes" to specify prealloc buffer size. It's suitable for cards which use the generic dmaengine pcm driver with no config. Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Link: https://lore.kernel.org/r/1632394246-59341-1-git-send-email-sugar.zhang@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-generic-dmaengine-pcm.c')
-rw-r--r--sound/soc/soc-generic-dmaengine-pcm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index 4aa48c74f21a..c54c8ca8d715 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -15,6 +15,10 @@
#include <sound/dmaengine_pcm.h>
+static unsigned int prealloc_buffer_size_kbytes = 512;
+module_param(prealloc_buffer_size_kbytes, uint, 0444);
+MODULE_PARM_DESC(prealloc_buffer_size_kbytes, "Preallocate DMA buffer size (KB).");
+
/*
* The platforms dmaengine driver does not support reporting the amount of
* bytes that are still left to transfer.
@@ -237,7 +241,7 @@ static int dmaengine_pcm_new(struct snd_soc_component *component,
prealloc_buffer_size = config->prealloc_buffer_size;
max_buffer_size = config->pcm_hardware->buffer_bytes_max;
} else {
- prealloc_buffer_size = 512 * 1024;
+ prealloc_buffer_size = prealloc_buffer_size_kbytes * 1024;
max_buffer_size = SIZE_MAX;
}