From 18f87aa6b8b4e480cdf95d5c9a0baddc22bfee67 Mon Sep 17 00:00:00 2001 From: Hu Kejun Date: Thu, 31 May 2018 16:46:24 +0800 Subject: [PATCH] media: rk-isp10: add module parameter for dumpsys Change-Id: I7ab56cbdcc5a0ce1441c972a1daa044593e6eb9f Signed-off-by: Hu Kejun --- .../media/platform/rk-isp10/cif_isp10_v4l2.c | 48 ++++++++++++------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/rk-isp10/cif_isp10_v4l2.c b/drivers/media/platform/rk-isp10/cif_isp10_v4l2.c index 0ccfb0a9508c..ae04c07e10b5 100644 --- a/drivers/media/platform/rk-isp10/cif_isp10_v4l2.c +++ b/drivers/media/platform/rk-isp10/cif_isp10_v4l2.c @@ -1088,14 +1088,26 @@ static int cif_isp10_v4l2_release(struct file *file) return ret; } -static unsigned int __maybe_unused cif_isp10_v4l2_poll( +static bool cifisp10_meta_mmap; +module_param_named(meta_mmap, cifisp10_meta_mmap, bool, 0644); +MODULE_PARM_DESC(meta_mmap, "Meta mmap onoff (N-Y)"); + +static unsigned int cif_isp10_v4l2_poll( struct file *file, struct poll_table_struct *wait) { - struct cif_isp10_v4l2_fh *fh = to_fh(file); - int ret = 0; - struct vb2_queue *queue = to_vb2_queue(file); - unsigned long req_events = poll_requested_events(wait); + struct cif_isp10_v4l2_fh *fh; + int ret; + struct vb2_queue *queue; + unsigned long req_events; + + if (!cifisp10_meta_mmap) + return vb2_fop_poll(file, wait); + + ret = 0; + fh = to_fh(file); + queue = to_vb2_queue(file); + req_events = poll_requested_events(wait); cif_isp10_pltfrm_pr_dbg(NULL, "%s\n", cif_isp10_v4l2_buf_type_string(queue->type)); @@ -1119,7 +1131,7 @@ static unsigned int __maybe_unused cif_isp10_v4l2_poll( /* * VMA operations. */ -static void __maybe_unused cif_isp10_v4l2_vm_open(struct vm_area_struct *vma) +static void cif_isp10_v4l2_vm_open(struct vm_area_struct *vma) { struct cif_isp10_metadata_s *metadata = (struct cif_isp10_metadata_s *)vma->vm_private_data; @@ -1127,7 +1139,7 @@ static void __maybe_unused cif_isp10_v4l2_vm_open(struct vm_area_struct *vma) metadata->vmas++; } -static void __maybe_unused cif_isp10_v4l2_vm_close(struct vm_area_struct *vma) +static void cif_isp10_v4l2_vm_close(struct vm_area_struct *vma) { struct cif_isp10_metadata_s *metadata = (struct cif_isp10_metadata_s *)vma->vm_private_data; @@ -1135,18 +1147,24 @@ static void __maybe_unused cif_isp10_v4l2_vm_close(struct vm_area_struct *vma) metadata->vmas--; } -static const struct __maybe_unused vm_operations_struct cif_isp10_vm_ops = { +static const struct vm_operations_struct cif_isp10_vm_ops = { .open = cif_isp10_v4l2_vm_open, .close = cif_isp10_v4l2_vm_close, }; -int __maybe_unused cif_isp10_v4l2_mmap(struct file *file, struct vm_area_struct *vma) +int cif_isp10_v4l2_mmap(struct file *file, struct vm_area_struct *vma) { - struct vb2_queue *queue = to_vb2_queue(file); - struct cif_isp10_device *dev = to_cif_isp10_device(queue); - enum cif_isp10_stream_id strm = to_stream_id(file); + struct vb2_queue *queue; + struct cif_isp10_device *dev; + enum cif_isp10_stream_id strm; int retval; + if (!cifisp10_meta_mmap) + return vb2_fop_mmap(file, vma); + + queue = to_vb2_queue(file); + dev = to_cif_isp10_device(queue); + strm = to_stream_id(file); retval = cif_isp10_mmap(dev, strm, vma); if (retval < 0) goto done; @@ -1166,10 +1184,8 @@ const struct v4l2_file_operations cif_isp10_v4l2_fops = { .compat_ioctl32 = video_ioctl2, #endif .release = cif_isp10_v4l2_release, - //.poll = cif_isp10_v4l2_poll, - //.mmap = cif_isp10_v4l2_mmap, - .poll = vb2_fop_poll, - .mmap = vb2_fop_mmap, + .poll = cif_isp10_v4l2_poll, + .mmap = cif_isp10_v4l2_mmap, }; /*TBD: clean up code below this line******************************************/