summaryrefslogtreecommitdiffstats
path: root/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0406-Add-new-custom_ioctl-ops-for-soc-camera.patch
blob: 599b8a42631aa87ef93af14055c262c60b766e9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From cf252d28e6db8fdcc6e21ae456835cdd3920b3ce Mon Sep 17 00:00:00 2001
From: Petr Nechaev <petr.nechaev@cogentembedded.com>
Date: Sat, 3 Aug 2019 00:39:57 +0300
Subject: [PATCH] Add new custom_ioctl ops for soc camera

It allows to implement custom ioctls in soc_camera host drivers.
---
 drivers/media/platform/soc_camera/soc_camera.c | 13 +++++++++++++
 include/media/soc_camera.h                     |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index 7e5ca15adb2b..80846832dd61 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1075,6 +1075,18 @@ static int soc_camera_g_edid(struct file *file, void *fh,
 	return -ENOIOCTLCMD;
 }
 
+static long soc_camera_default(struct file *file, void *fh,
+			     bool valid_prio, unsigned int cmd, void *arg)
+{
+	struct soc_camera_device *icd = video_drvdata(file);
+	struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
+
+	if (ici->ops->custom_ioctl)
+		return ici->ops->custom_ioctl(icd, valid_prio, cmd, arg);
+
+	return -ENOIOCTLCMD;
+}
+
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 static int soc_camera_g_register(struct file *file, void *priv,
 				 struct v4l2_dbg_register *reg)
@@ -2092,6 +2104,7 @@ static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = {
 	.vidioc_g_parm		 = soc_camera_g_parm,
 	.vidioc_s_parm		 = soc_camera_s_parm,
 	.vidioc_g_edid		 = soc_camera_g_edid,
+	.vidioc_default		 = soc_camera_default,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 	.vidioc_g_register	= soc_camera_g_register,
 	.vidioc_s_register	= soc_camera_s_register,
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 53c650d82b57..adcfadabcdc5 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -124,6 +124,8 @@ struct soc_camera_host_ops {
 	int (*enum_framesizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *);
 	unsigned int (*poll)(struct file *, poll_table *);
 	int (*get_edid)(struct soc_camera_device *, struct v4l2_edid *);
+	long (*custom_ioctl)(struct soc_camera_device *, bool valid_prio,
+			 unsigned int cmd, void *arg);
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 	int (*get_register)(struct soc_camera_device *, struct v4l2_dbg_register *reg);
 	int (*set_register)(struct soc_camera_device *, const struct v4l2_dbg_register *reg);
-- 
2.20.1