}\r
\r
for (i=0; i<size; i++) {\r
-#if 0\r
- if (copy_from_user(&usr_fd, ®->reg[addr_tbl_vpu_dec[i]], sizeof(usr_fd)))\r
- return -EFAULT;\r
-#else\r
usr_fd = reg->reg[tbl[i]] & 0x3FF;\r
offset = reg->reg[tbl[i]] >> 10;\r
- \r
-#endif\r
if (usr_fd != 0) {\r
struct ion_handle *hdl;\r
+ int ret;\r
+ struct iep_mem_region *mem_region;\r
\r
hdl = ion_import_dma_buf(pservice->ion_client, usr_fd);\r
if (IS_ERR(hdl)) {\r
return PTR_ERR(hdl);\r
}\r
\r
-#if 0\r
- {\r
- ion_phys_addr_t phy_addr;\r
- size_t len;\r
- ion_phys(pservice->ion_client, hdl, &phy_addr, &len);\r
- \r
- reg->reg[tbl[i]] = phy_addr + offset;\r
- \r
+ mem_region = kzalloc(sizeof(struct iep_mem_region), GFP_KERNEL);\r
+ \r
+ if (mem_region == NULL) {\r
+ dev_err(pservice->iommu_dev, "allocate memory for iommu memory region failed\n");\r
ion_free(pservice->ion_client, hdl);\r
+ return -1;\r
}\r
-#else \r
- {\r
- int ret;\r
- struct iep_mem_region *mem_region;\r
- mem_region = kzalloc(sizeof(struct iep_mem_region), GFP_KERNEL);\r
- \r
- if (mem_region == NULL) {\r
- dev_err(pservice->iommu_dev, "allocate memory for iommu memory region failed\n");\r
- ion_free(pservice->ion_client, hdl);\r
- return -1;\r
- }\r
- \r
- mem_region->hdl = hdl;\r
- \r
- ret = ion_map_iommu(pservice->iommu_dev, pservice->ion_client, mem_region->hdl, &mem_region->iova, &mem_region->len);\r
- if (ret < 0) {\r
- dev_err(pservice->iommu_dev, "ion map iommu failed\n");\r
- kfree(mem_region);\r
- ion_free(pservice->ion_client, hdl);\r
- return ret;\r
- }\r
- \r
- reg->reg[tbl[i]] = mem_region->iova + offset;\r
- INIT_LIST_HEAD(&mem_region->reg_lnk);\r
- list_add_tail(&mem_region->reg_lnk, ®->mem_region_list);\r
+ \r
+ mem_region->hdl = hdl;\r
+ \r
+ ret = ion_map_iommu(pservice->iommu_dev, pservice->ion_client, mem_region->hdl, &mem_region->iova, &mem_region->len);\r
+ if (ret < 0) {\r
+ dev_err(pservice->iommu_dev, "ion map iommu failed\n");\r
+ kfree(mem_region);\r
+ ion_free(pservice->ion_client, hdl);\r
+ return ret;\r
}\r
-#endif\r
+ \r
+ reg->reg[tbl[i]] = mem_region->iova + offset;\r
+ INIT_LIST_HEAD(&mem_region->reg_lnk);\r
+ list_add_tail(&mem_region->reg_lnk, ®->mem_region_list);\r
}\r
}\r
\r
\r
#if defined(CONFIG_IEP_IOMMU)\r
if (0 > iep_reg_address_translate(&iep_service, reg)) {\r
- pr_err("error: translate reg address failed\n");\r
+ IEP_ERR("error: translate reg address failed\n");\r
kfree(reg);\r
return;\r
}\r
#endif\r
\r
wake_lock(&iep_drvdata1->wake_lock);\r
+ \r
+#if defined(CONFIG_IEP_IOMMU)\r
+ if (iep_service.iommu_dev) {\r
+ iovmm_activate(iep_service.iommu_dev);\r
+ }\r
+#endif \r
+ \r
iep_service.enable = true;\r
}\r
\r
IEP_WARNING("delay 50 ms for running task\n");\r
iep_dump();\r
}\r
+ \r
+#if defined(CONFIG_IEP_IOMMU)\r
+ if (iep_service.iommu_dev) {\r
+ iovmm_deactivate(iep_service.iommu_dev);\r
+ }\r
+#endif \r
\r
#ifdef IEP_CLK_ENABLE\r
clk_disable_unprepare(iep_drvdata1->aclk_iep);\r
}\r
\r
#if defined(CONFIG_IEP_IOMMU)\r
+ iep_service.iommu_dev = NULL;\r
iep_power_on();\r
iep_service.ion_client = rockchip_ion_client_create("iep");\r
if (IS_ERR(iep_service.ion_client)) {\r
- dev_err(&pdev->dev, "failed to create ion client for vcodec");\r
+ IEP_ERR("failed to create ion client for vcodec");\r
return PTR_ERR(iep_service.ion_client);\r
} else {\r
- dev_info(&pdev->dev, "vcodec ion client create success!\n");\r
+ IEP_INFO("iep ion client create success!\n");\r
}\r
\r
- mmu_dev = rockchip_get_sysmmu_device_by_compatible("iommu,iep");\r
+ mmu_dev = rockchip_get_sysmmu_device_by_compatible("iommu,iep_mmu");\r
\r
if (mmu_dev) {\r
platform_set_sysmmu(mmu_dev, &pdev->dev);\r