From 651397146e4137ab694eb74d6852b97a69fda3cf Mon Sep 17 00:00:00 2001 From: zyc Date: Fri, 19 Sep 2014 16:08:35 +0800 Subject: [PATCH] camsys_drv: v0.0x17.0 --- arch/arm/boot/dts/rk3288.dtsi | 2 +- drivers/media/video/rk_camsys/camsys_drv.c | 14 +++++++++++--- drivers/media/video/rk_camsys/camsys_internal.h | 4 +++- drivers/media/video/rk_camsys/camsys_marvin.c | 4 +--- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index c26b49c13b49..f4e71ae53257 100755 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -1263,7 +1263,7 @@ rockchip,isp,cifphy = <1>; rockchip,isp,mipiphy1,reg = <0xff968000 0x4000>; rockchip,gpios = <&gpio7 GPIO_B5 GPIO_ACTIVE_HIGH>; - rockchip,isp,iommu_enable = <0>; + rockchip,isp,iommu_enable = <1>; status = "okay"; }; diff --git a/drivers/media/video/rk_camsys/camsys_drv.c b/drivers/media/video/rk_camsys/camsys_drv.c index 4edcf457b81b..f0a088a69e1f 100755 --- a/drivers/media/video/rk_camsys/camsys_drv.c +++ b/drivers/media/video/rk_camsys/camsys_drv.c @@ -790,8 +790,17 @@ static long camsys_ioctl(struct file *filp,unsigned int cmd, unsigned long arg) { int iommu_enabled = 0; #ifdef CONFIG_ROCKCHIP_IOMMU - //of_property_read_u32(camsys_dev->pdev->dev.of_node, "rockchip,isp,iommu_enable", &iommu_enabled); - iommu_enabled = 1; + struct device_node * vpu_node =NULL; + int vpu_iommu_enabled = 0; + vpu_node = of_find_compatible_node(NULL,NULL, "vpu_service"); + if(vpu_node){ + of_property_read_u32(vpu_node, "iommu_enabled", &vpu_iommu_enabled); + of_property_read_u32(camsys_dev->pdev->dev.of_node, "rockchip,isp,iommu_enable", &iommu_enabled); + if(iommu_enabled != vpu_iommu_enabled){ + camsys_err("iommu status not consistent,check the dts file ! isp:%d,vpu:%d",iommu_enabled,vpu_iommu_enabled); + return -EFAULT; + } + } #endif if (copy_to_user((void __user *)arg,(void*)&iommu_enabled, sizeof(iommu_enabled))) return -EFAULT; @@ -1036,7 +1045,6 @@ static int camsys_platform_probe(struct platform_device *pdev){ goto fail_end; } - //map irqs irq_id = irq_of_parse_and_map(dev->of_node, 0); if (irq_id < 0) { diff --git a/drivers/media/video/rk_camsys/camsys_internal.h b/drivers/media/video/rk_camsys/camsys_internal.h index 02995906f1f7..c0c413b80484 100755 --- a/drivers/media/video/rk_camsys/camsys_internal.h +++ b/drivers/media/video/rk_camsys/camsys_internal.h @@ -101,8 +101,10 @@ 1) check extdev name when dev_id has been registered; *v0.0x16.0: 1) enable or disable IOMMU just depending on CONFIG_ROCKCHIP_IOMMU. +*v0.0x17.0: + 1) isp iommu status depend on vpu iommu status. */ -#define CAMSYS_DRIVER_VERSION KERNEL_VERSION(0,0x16,0) +#define CAMSYS_DRIVER_VERSION KERNEL_VERSION(0,0x17,0) #define CAMSYS_PLATFORM_DRV_NAME "RockChip-CamSys" diff --git a/drivers/media/video/rk_camsys/camsys_marvin.c b/drivers/media/video/rk_camsys/camsys_marvin.c index 94d856f774f5..c6a61d8b7317 100755 --- a/drivers/media/video/rk_camsys/camsys_marvin.c +++ b/drivers/media/video/rk_camsys/camsys_marvin.c @@ -237,17 +237,15 @@ static int camsys_mrv_iommu_cb(void *ptr,camsys_sysctrl_t *devctl) struct ion_client *client = NULL; struct ion_handle *handle = NULL; camsys_iommu_t *iommu = NULL; - int ret = 0; + int ret = 0,iommu_enabled = 0; camsys_dev_t * camsys_dev = (camsys_dev_t *)ptr; -#if 0 of_property_read_u32(camsys_dev->pdev->dev.of_node, "rockchip,isp,iommu_enable", &iommu_enabled); if(iommu_enabled != 1){ camsys_err("isp iommu have not been enabled!\n"); ret = -1; goto iommu_end; } -#endif iommu_dev = rockchip_get_sysmmu_device_by_compatible(ISP_IOMMU_COMPATIBLE_NAME); if(!iommu_dev){ camsys_err("get iommu device erro!\n"); -- 2.34.1