mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
ASoC: rockchip: add support for "rockchip,force-iram"
This patch handle the force-iram function by devicetree. Change-Id: I95fe96091c560507a37cd0833cf2507e4d2bc636 Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/genalloc.h>
|
#include <linux/genalloc.h>
|
||||||
|
#include <linux/of.h>
|
||||||
#include <sound/memalloc.h>
|
#include <sound/memalloc.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -193,7 +194,13 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,
|
|||||||
if (dmab->area)
|
if (dmab->area)
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM
|
#ifdef CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM
|
||||||
break;
|
if (device->of_node) {
|
||||||
|
if (of_property_read_bool(device->of_node,
|
||||||
|
"rockchip,force-iram")) {
|
||||||
|
dev_err(device, "iram space is not enough!\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Internal memory might have limited size and no enough space,
|
/* Internal memory might have limited size and no enough space,
|
||||||
* so if we fail to malloc, try to fetch memory traditionally.
|
* so if we fail to malloc, try to fetch memory traditionally.
|
||||||
|
|||||||
@@ -268,7 +268,24 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM
|
#ifdef CONFIG_SND_SOC_ROCKCHIP_FORCE_SRAM
|
||||||
prealloc_buffer_size = 32 * 1024;
|
for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
|
||||||
|
substream = rtd->pcm->streams[i].substream;
|
||||||
|
if (substream)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!substream)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
dev = dmaengine_dma_dev(pcm, substream);
|
||||||
|
if (dev->of_node) {
|
||||||
|
ret = of_property_read_bool(dev->of_node,
|
||||||
|
"rockchip,force-iram");
|
||||||
|
if (ret)
|
||||||
|
prealloc_buffer_size = 32 * 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
dev = rtd->platform->dev;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
|
for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user