camsys_drv: update with iommu interface related changed

This commit is contained in:
xxm
2014-08-08 11:36:52 +08:00
parent 383202d8d4
commit 7c3d77c388
2 changed files with 39 additions and 5 deletions

View File

@@ -48,8 +48,7 @@
#include <linux/of_gpio.h>
#include <linux/rockchip/cpu.h>
#include <media/camsys_head.h>
#include <linux/rockchip/sysmmu.h>
#include <linux/rockchip/iovmm.h>
#include <linux/rockchip-iovmm.h>

View File

@@ -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;