From 213457f1ef8f1de8f542da7bd193c331fbd86d32 Mon Sep 17 00:00:00 2001 From: Sugar Zhang Date: Fri, 15 Nov 2019 11:50:15 +0800 Subject: [PATCH] ASoC: rockchip: pcm: Adjust min/max value for pcm config - the original config is too strict to satisfy general usage. - adds CONFIG_SND_SOC_ROCKCHIP_PREALLOC_BUFFER_SIZE for flexible buffer size. Change-Id: I1f060269cb1887c17a2cd83701f0263993be8ec7 Signed-off-by: Sugar Zhang --- sound/soc/rockchip/Kconfig | 8 ++++++++ sound/soc/rockchip/rockchip_pcm.c | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig index 28a6c3c3b3a8..8d58beeb2eb9 100644 --- a/sound/soc/rockchip/Kconfig +++ b/sound/soc/rockchip/Kconfig @@ -6,6 +6,14 @@ config SND_SOC_ROCKCHIP the Rockchip SoCs' Audio interfaces. You will also need to select the audio interfaces to support below. +config SND_SOC_ROCKCHIP_PREALLOC_BUFFER_SIZE + int "Default prealloc buffer size (kbytes)" + depends on SND_SOC_ROCKCHIP + default "512" + help + The default value is 512 kilobytes. Only change this if you know + what you are doing. + config SND_SOC_ROCKCHIP_I2S tristate "Rockchip I2S Device Driver" depends on CLKDEV_LOOKUP && SND_SOC_ROCKCHIP diff --git a/sound/soc/rockchip/rockchip_pcm.c b/sound/soc/rockchip/rockchip_pcm.c index 4ac78d7a4b2d..2772f4b56328 100644 --- a/sound/soc/rockchip/rockchip_pcm.c +++ b/sound/soc/rockchip/rockchip_pcm.c @@ -24,17 +24,17 @@ static const struct snd_pcm_hardware snd_rockchip_hardware = { SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_INTERLEAVED, .period_bytes_min = 32, - .period_bytes_max = 8192, - .periods_min = 1, - .periods_max = 52, - .buffer_bytes_max = 64 * 1024, + .period_bytes_max = SIZE_MAX, + .periods_min = 2, + .periods_max = 4096, + .buffer_bytes_max = SIZE_MAX, .fifo_size = 32, }; static const struct snd_dmaengine_pcm_config rk_dmaengine_pcm_config = { .pcm_hardware = &snd_rockchip_hardware, .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, - .prealloc_buffer_size = 32 * 1024, + .prealloc_buffer_size = CONFIG_SND_SOC_ROCKCHIP_PREALLOC_BUFFER_SIZE * 1024, }; int rockchip_pcm_platform_register(struct device *dev)