camsys_drv: update with iommu interface related changed
authorxxm <xxm@rock-chips.com>
Fri, 8 Aug 2014 03:36:52 +0000 (11:36 +0800)
committerxxm <xxm@rock-chips.com>
Fri, 8 Aug 2014 03:36:52 +0000 (11:36 +0800)
drivers/media/video/rk_camsys/camsys_internal.h
drivers/media/video/rk_camsys/camsys_marvin.c

index 112299f3de7bb4c00049929f565b855cc6b9fbb6..87d45670661f10c388be155eaca9f946001ad26e 100755 (executable)
@@ -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>
 
 
 
index 77a0a23e0ae16684284e5cc5a7ce497b83a92abc..c05ebd6d298befd3c647255970e4aa3b5f380648 100755 (executable)
@@ -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;