aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sound/soc/sprd
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linaro.org>2019-04-12 14:40:17 +0800
committerMark Brown <broonie@kernel.org>2019-05-06 22:48:03 +0900
commit1587a061ef562de0d97c82a95863e191bcd69d63 (patch)
tree28c61360f6669210b7483213c283f2c44f1fd2c6 /sound/soc/sprd
parentASoC: Intel: kbl_da7219_max98357a: Map BTN_0 to KEY_PLAYPAUSE (diff)
downloadwireguard-linux-1587a061ef562de0d97c82a95863e191bcd69d63.tar.xz
wireguard-linux-1587a061ef562de0d97c82a95863e191bcd69d63.zip
ASoC: sprd: Add reserved DMA memory support
For Spreadtrum audio platform driver, it need allocate a larger DMA buffer dynamically to copy audio data between userspace and kernel space, but that will increase the risk of memory allocation failure especially the system is under heavy load situation. To make sure the audio can work in this scenario, we usually reserve one region of memory to be used as a shared pool of DMA buffers for the platform component. So add of_reserved_mem_device_init_by_idx() function to initialize the shared pool of DMA buffers to be used by the platform component. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sprd')
-rw-r--r--sound/soc/sprd/sprd-pcm-dma.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c
index 9be6d4b2bf74..d38ebbbbf169 100644
--- a/sound/soc/sprd/sprd-pcm-dma.c
+++ b/sound/soc/sprd/sprd-pcm-dma.c
@@ -6,6 +6,7 @@
#include <linux/dma/sprd-dma.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of_reserved_mem.h>
#include <linux/platform_device.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
@@ -530,8 +531,14 @@ static const struct snd_soc_component_driver sprd_soc_component = {
static int sprd_soc_platform_probe(struct platform_device *pdev)
{
+ struct device_node *np = pdev->dev.of_node;
int ret;
+ ret = of_reserved_mem_device_init_by_idx(&pdev->dev, np, 0);
+ if (ret)
+ dev_warn(&pdev->dev,
+ "no reserved DMA memory for audio platform device\n");
+
ret = devm_snd_soc_register_component(&pdev->dev, &sprd_soc_component,
NULL, 0);
if (ret)