summaryrefslogtreecommitdiff
path: root/drivers/mxc
diff options
context:
space:
mode:
authorZhou Peng <eagle.zhou@nxp.com>2018-06-15 13:09:05 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commitf06102570ff4bdafb8a6f4868f2c6529d8caa31d (patch)
tree43a3fda8a50191ad858e3ced4a9f64f7fac461ca /drivers/mxc
parent7903a7422a2685ff801f166e280791dbd07ec1e2 (diff)
MLK-18593 - [i.MX8MM/Hantro] Add support for android platform
Add mmap to allow application map vpu h1 registers from user space Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Diffstat (limited to 'drivers/mxc')
-rwxr-xr-xdrivers/mxc/hantro_845_h1/hx280enc.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/mxc/hantro_845_h1/hx280enc.c b/drivers/mxc/hantro_845_h1/hx280enc.c
index 236d18f8833f..0fd1c7c2f32a 100755
--- a/drivers/mxc/hantro_845_h1/hx280enc.c
+++ b/drivers/mxc/hantro_845_h1/hx280enc.c
@@ -147,6 +147,7 @@ static irqreturn_t hx280enc_isr(int irq, void *dev_id, struct pt_regs *regs);
static irqreturn_t hx280enc_isr(int irq, void *dev_id);
#endif
+#ifdef VSI
/* VM operations */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28))
static struct page *hx280enc_vm_nopage(struct vm_area_struct *vma,
@@ -182,7 +183,7 @@ nopage:hx280enc_vm_nopage,
fault:hx280enc_vm_fault,
#endif
};
-
+#endif
#ifndef VSI
static int hantro_h1_clk_enable(struct device *dev)
@@ -236,15 +237,26 @@ static int hantro_h1_ctrlblk_reset(struct device *dev)
* vm_area_struct for us, so we examine this to see what was requested.
*/
-static int hx280enc_mmap(struct file *filp, struct vm_area_struct *vma)
+static int hx280enc_mmap(struct file *filp, struct vm_area_struct *vm)
{
+#ifdef VSI
int result = -EINVAL;
result = -EINVAL;
-
vma->vm_ops = &hx280enc_vm_ops;
-
return result;
+#else
+ if (vm->vm_pgoff == (hx280enc_data.iobaseaddr >> PAGE_SHIFT)) {
+ vm->vm_flags |= VM_IO;
+ vm->vm_page_prot = pgprot_noncached(vm->vm_page_prot);
+ PDEBUG("hx280enc mmap: size=0x%lX, page off=0x%lX\n", (vm->vm_end - vm->vm_start), vm->vm_pgoff);
+ return remap_pfn_range(vm, vm->vm_start, vm->vm_pgoff, vm->vm_end - vm->vm_start,
+ vm->vm_page_prot) ? -EAGAIN : 0;
+ } else {
+ pr_err("invalid map offset :0x%lX\n", vm->vm_pgoff);
+ return -EINVAL;
+ }
+#endif
}
static long hx280enc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)