summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSammy He <r62914@freescale.com>2009-09-16 18:43:05 +0800
committerSammy He <r62914@freescale.com>2009-09-17 12:24:15 +0800
commitfea59c0274591d6f30b1d92570f84986324f4264 (patch)
tree53a6a93328c1d2657fc324855351b078780fba6a
parent7591a675377617605f79b57f799c479eb3ffd29a (diff)
ENGR00116528 Change vpu sync solution between multi-instances
Remove file as shared memory for multi-instances, but use memory allocated from vpu driver. Signed-off-by: Sammy He <r62914@freescale.com>
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc_vpu.h1
-rw-r--r--drivers/mxc/vpu/mxc_vpu.c35
2 files changed, 35 insertions, 1 deletions
diff --git a/arch/arm/plat-mxc/include/mach/mxc_vpu.h b/arch/arm/plat-mxc/include/mach/mxc_vpu.h
index 67a62d3a23b1..8a42c7de5634 100644
--- a/arch/arm/plat-mxc/include/mach/mxc_vpu.h
+++ b/arch/arm/plat-mxc/include/mach/mxc_vpu.h
@@ -49,6 +49,7 @@ struct vpu_mem_desc {
#define VPU_IOC_GET_PIC_PARA_ADDR _IO(VPU_IOC_MAGIC, 9)
#define VPU_IOC_GET_USER_DATA_ADDR _IO(VPU_IOC_MAGIC, 10)
#define VPU_IOC_SYS_SW_RESET _IO(VPU_IOC_MAGIC, 11)
+#define VPU_IOC_GET_SHARE_MEM _IO(VPU_IOC_MAGIC, 12)
#define BIT_CODE_RUN 0x000
#define BIT_CODE_DOWN 0x004
diff --git a/drivers/mxc/vpu/mxc_vpu.c b/drivers/mxc/vpu/mxc_vpu.c
index ef95ba738086..fa2824e85f77 100644
--- a/drivers/mxc/vpu/mxc_vpu.c
+++ b/drivers/mxc/vpu/mxc_vpu.c
@@ -66,6 +66,7 @@ static struct clk *vpu_clk;
static struct vpu_mem_desc bitwork_mem = { 0 };
static struct vpu_mem_desc pic_para_mem = { 0 };
static struct vpu_mem_desc user_data_mem = { 0 };
+static struct vpu_mem_desc share_mem = { 0 };
/* IRAM setting */
static struct iram_setting iram;
@@ -351,6 +352,35 @@ static int vpu_ioctl(struct inode *inode, struct file *filp, u_int cmd,
break;
}
+ case VPU_IOC_GET_SHARE_MEM:
+ {
+ spin_lock(&vpu_lock);
+ if (share_mem.cpu_addr != 0) {
+ ret = copy_to_user((void __user *)arg,
+ &share_mem,
+ sizeof(struct vpu_mem_desc));
+ spin_unlock(&vpu_lock);
+ break;
+ } else {
+ if (copy_from_user(&share_mem,
+ (struct vpu_mem_desc *)arg,
+ sizeof(struct vpu_mem_desc))) {
+ spin_unlock(&vpu_lock);
+ return -EFAULT;
+ }
+ if (vpu_alloc_dma_buffer(&share_mem) == -1)
+ ret = -EFAULT;
+ else {
+ if (copy_to_user((void __user *)arg,
+ &share_mem,
+ sizeof(struct
+ vpu_mem_desc)))
+ ret = -EFAULT;
+ }
+ }
+ spin_unlock(&vpu_lock);
+ break;
+ }
case VPU_IOC_GET_WORK_ADDR:
{
if (bitwork_mem.cpu_addr != 0) {
@@ -462,6 +492,9 @@ static int vpu_release(struct inode *inode, struct file *filp)
if (cpu_is_mx32())
vl2cc_disable();
+ /* Free shared memory when vpu device is idle */
+ vpu_free_dma_buffer(&share_mem);
+ share_mem.cpu_addr = 0;
}
spin_unlock(&vpu_lock);
@@ -729,7 +762,7 @@ static int vpu_resume(struct platform_device *pdev)
#else
#define vpu_suspend NULL
#define vpu_resume NULL
-#endif /* !CONFIG_PM */
+#endif /* !CONFIG_PM */
/*! Driver definition
*