From: xxm Date: Fri, 8 Aug 2014 03:36:52 +0000 (+0800) Subject: camsys_drv: update with iommu interface related changed X-Git-Tag: firefly_0821_release~4927 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7c3d77c388f714d8ae4f4fc789791e2d69ecab07;p=firefly-linux-kernel-4.4.55.git camsys_drv: update with iommu interface related changed --- diff --git a/drivers/media/video/rk_camsys/camsys_internal.h b/drivers/media/video/rk_camsys/camsys_internal.h index 112299f3de7b..87d45670661f 100755 --- a/drivers/media/video/rk_camsys/camsys_internal.h +++ b/drivers/media/video/rk_camsys/camsys_internal.h @@ -48,8 +48,7 @@ #include #include #include -#include -#include +#include diff --git a/drivers/media/video/rk_camsys/camsys_marvin.c b/drivers/media/video/rk_camsys/camsys_marvin.c index 77a0a23e0ae1..c05ebd6d298b 100755 --- a/drivers/media/video/rk_camsys/camsys_marvin.c +++ b/drivers/media/video/rk_camsys/camsys_marvin.c @@ -194,6 +194,41 @@ static int camsys_mrv_flash_trigger_cb(void *ptr,unsigned int on) } return retval; } +static struct device *rockchip_get_sysmmu_device_by_compatible(const char *compt) +{ + struct device_node *dn = NULL; + struct platform_device *pd = NULL; + struct device *ret = NULL ; + + dn = of_find_compatible_node(NULL,NULL,compt); + if(!dn) + { + printk("can't find device node %s \r\n",compt); + return NULL; + } + + pd = of_find_device_by_node(dn); + if(!pd) + { + printk("can't find platform device in device node %s \r\n",compt); + return NULL; + } + ret = &pd->dev; + + return ret; + +} +#ifdef CONFIG_IOMMU_API +static inline void platform_set_sysmmu(struct device *iommu, struct device *dev) +{ + dev->archdata.iommu = iommu; +} +#else +static inline void platform_set_sysmmu(struct device *iommu, struct device *dev) +{ +} +#endif + static int camsys_mrv_iommu_cb(void *ptr,camsys_sysctrl_t *devctl) { @@ -212,7 +247,7 @@ static int camsys_mrv_iommu_cb(void *ptr,camsys_sysctrl_t *devctl) goto iommu_end; } - iommu_dev = rockchip_get_sysmmu_device_by_compatible("iommu,isp_mmu"); + iommu_dev = rockchip_get_sysmmu_device_by_compatible(ISP_IOMMU_COMPATIBLE_NAME); if(!iommu_dev){ camsys_err("get iommu device erro!\n"); ret = -1; @@ -247,14 +282,14 @@ static int camsys_mrv_iommu_cb(void *ptr,camsys_sysctrl_t *devctl) } if(devctl->on){ platform_set_sysmmu(iommu_dev,dev); - ret = iovmm_activate(dev); + ret = rockchip_iovmm_activate(dev); ret = ion_map_iommu(dev,client,handle,&(iommu->linear_addr),&(iommu->len)); }else{ ion_unmap_iommu(dev,client,handle); platform_set_sysmmu(iommu_dev,dev); - iovmm_deactivate(dev); + rockchip_iovmm_deactivate(dev); } iommu_end: return ret;