VPU: support compatible vpu request from userspace.
authorAlpha Lin <alpha.lin@rock-chips.com>
Thu, 4 Jun 2015 07:15:01 +0000 (15:15 +0800)
committerAlpha Lin <alpha.lin@rock-chips.com>
Thu, 4 Jun 2015 08:32:16 +0000 (16:32 +0800)
This revision need rk3368 android library libvpu to
revert it VPUReq_t definition, Revert RK_U64 req;
to RK_U32 *req;

Signed-off-by: Alpha Lin <alpha.lin@rock-chips.com>
arch/arm/mach-rockchip/vcodec_service.c

index 4a13af81ba649dc39aac40045d535155a17f93aa..238d763e477d2541dab97e0adec4b8870b48a471 100644 (file)
@@ -17,6 +17,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/clk.h>
+#include <linux/compat.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -475,10 +476,15 @@ struct vcodec_combo {
         enum vcodec_device_id current_hw_mode;
 };
 
-typedef struct vpu_request {
-       u64 req;
+struct vpu_request {
+       u32 *req;
        u32 size;
-} vpu_request;
+};
+
+struct compat_vpu_request {
+       compat_uptr_t req;
+       u32 size;
+};
 
 /* debugfs root directory for all device (vpu, hevc).*/
 static struct dentry *parent;
@@ -895,8 +901,6 @@ static int vcodec_bufid_to_iova(struct vpu_subdev_data *data, u8 *tbl,
                return -1;
        }
 
-       vpu_service_power_on(pservice);
-
        for (i = 0; i < size; i++) {
                usr_fd = reg->reg[tbl[i]] & 0x3FF;
 
@@ -1068,9 +1072,8 @@ static vpu_reg *reg_init(struct vpu_subdev_data *data,
        }
 
        if (size > data->reg_size) {
-               /*printk("warning: vpu reg size %lu is larger than hw reg size %lu\n",
-                 size, pservice->reg_size);
-               size = pservice->reg_size;*/
+               /*printk("warning: vpu reg size %u is larger than hw reg size %u\n",
+                 size, data->reg_size);*/
                extra_size = size - data->reg_size;
                size = data->reg_size;
        }
@@ -1515,8 +1518,8 @@ static long vpu_service_ioctl(struct file *filp, unsigned int cmd,
                break;
        }
        case VPU_IOC_GET_HW_FUSE_STATUS : {
-               vpu_request req;
-               if (copy_from_user(&req, (void __user *)arg, sizeof(vpu_request))) {
+               struct vpu_request req;
+               if (copy_from_user(&req, (void __user *)arg, sizeof(struct vpu_request))) {
                        vpu_err("error: VPU_IOC_GET_HW_FUSE_STATUS copy_from_user failed\n");
                        return -EFAULT;
                } else {
@@ -1542,10 +1545,10 @@ static long vpu_service_ioctl(struct file *filp, unsigned int cmd,
                break;
        }
        case VPU_IOC_SET_REG : {
-               vpu_request req;
+               struct vpu_request req;
                vpu_reg *reg;
                if (copy_from_user(&req, (void __user *)arg,
-                       sizeof(vpu_request))) {
+                       sizeof(struct vpu_request))) {
                        vpu_err("error: VPU_IOC_SET_REG copy_from_user failed\n");
                        return -EFAULT;
                }
@@ -1562,10 +1565,10 @@ static long vpu_service_ioctl(struct file *filp, unsigned int cmd,
                break;
        }
        case VPU_IOC_GET_REG : {
-               vpu_request req;
+               struct vpu_request req;
                vpu_reg *reg;
                if (copy_from_user(&req, (void __user *)arg,
-                       sizeof(vpu_request))) {
+                       sizeof(struct vpu_request))) {
                        vpu_err("error: VPU_IOC_GET_REG copy_from_user failed\n");
                        return -EFAULT;
                } else {
@@ -1648,9 +1651,10 @@ static long compat_vpu_service_ioctl(struct file *filp, unsigned int cmd,
                break;
        }
        case COMPAT_VPU_IOC_GET_HW_FUSE_STATUS : {
-               vpu_request req;
+               struct compat_vpu_request req;
+
                if (copy_from_user(&req, compat_ptr((compat_uptr_t)arg),
-                                  sizeof(vpu_request))) {
+                                  sizeof(struct compat_vpu_request))) {
                        vpu_err("error: VPU_IOC_GET_HW_FUSE_STATUS"
                                " copy_from_user failed\n");
                        return -EFAULT;
@@ -1679,10 +1683,10 @@ static long compat_vpu_service_ioctl(struct file *filp, unsigned int cmd,
                break;
        }
        case COMPAT_VPU_IOC_SET_REG : {
-               vpu_request req;
+               struct compat_vpu_request req;
                vpu_reg *reg;
                if (copy_from_user(&req, compat_ptr((compat_uptr_t)arg),
-                                  sizeof(vpu_request))) {
+                                  sizeof(struct compat_vpu_request))) {
                        vpu_err("VPU_IOC_SET_REG copy_from_user failed\n");
                        return -EFAULT;
                }
@@ -1699,10 +1703,10 @@ static long compat_vpu_service_ioctl(struct file *filp, unsigned int cmd,
                break;
        }
        case COMPAT_VPU_IOC_GET_REG : {
-               vpu_request req;
+               struct compat_vpu_request req;
                vpu_reg *reg;
                if (copy_from_user(&req, compat_ptr((compat_uptr_t)arg),
-                                  sizeof(vpu_request))) {
+                                  sizeof(struct compat_vpu_request))) {
                        vpu_err("VPU_IOC_GET_REG copy_from_user failed\n");
                        return -EFAULT;
                } else {