mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
media: rockchip: isp1: support get continuous memory from specific CMA region
If no IOMMU support for ISP, we prefer to alloc continuous physical memory from our reserved CMA region than from system reserved. Change-Id: I1e598ee7309c9c53254649f5267a1e7f515c6361 Signed-off-by: Cai YiWei <cyw@rock-chips.com>
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/of_graph.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/of_reserved_mem.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/regmap.h>
|
||||
@@ -914,6 +915,24 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline bool is_iommu_enable(struct device *dev)
|
||||
{
|
||||
struct device_node *iommu;
|
||||
|
||||
iommu = of_parse_phandle(dev->of_node, "iommus", 0);
|
||||
if (!iommu) {
|
||||
dev_info(dev, "no iommu attached, using non-iommu buffers\n");
|
||||
return false;
|
||||
} else if (!of_device_is_available(iommu)) {
|
||||
dev_info(dev, "iommu is disabled, using non-iommu buffers\n");
|
||||
of_node_put(iommu);
|
||||
return false;
|
||||
}
|
||||
of_node_put(iommu);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int rkisp1_vs_irq_parse(struct platform_device *pdev)
|
||||
{
|
||||
int ret;
|
||||
@@ -1105,6 +1124,13 @@ static int rkisp1_plat_probe(struct platform_device *pdev)
|
||||
if (ret < 0)
|
||||
goto err_unreg_media_dev;
|
||||
|
||||
if (!is_iommu_enable(dev)) {
|
||||
ret = of_reserved_mem_device_init(dev);
|
||||
if (ret)
|
||||
v4l2_warn(v4l2_dev,
|
||||
"No reserved memory region assign to isp\n");
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
ret = rkisp1_vs_irq_parse(pdev);
|
||||
|
||||
Reference in New Issue
Block a user