summaryrefslogtreecommitdiffstats
path: root/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0117-rcar-vin-fix-get_selection-use.patch
blob: 5a063c590a93062a0048eb9db82046f61bc9101a (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
From e0a3dbada217b98610a00f6878bdf111c41b5475 Mon Sep 17 00:00:00 2001
From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Date: Wed, 12 Sep 2018 22:06:53 +0300
Subject: [PATCH 061/122] rcar-vin: fix get_selection use

Get crop bounds from glue driver (imager)

Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
 drivers/media/platform/soc_camera/rcar_vin.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
index 228bbf3..50d393b 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -2334,10 +2334,26 @@ static int rcar_vin_get_selection(struct soc_camera_device *icd,
 				  struct v4l2_selection *sel)
 {
 	struct rcar_vin_cam *cam = icd->host_priv;
+	struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
+	struct v4l2_subdev_selection sdsel;
+	int ret;
 
-	sel->r = cam->subrect;
+	switch (sel->target) {
+	case V4L2_SEL_TGT_CROP_BOUNDS:
+		sdsel.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+		sdsel.target = sel->target;
 
-	return 0;
+		ret = v4l2_subdev_call(sd, pad, get_selection, NULL, &sdsel);
+		if (!ret)
+			sel->r = sdsel.r;
+		return ret;
+	case V4L2_SEL_TGT_CROP_DEFAULT:
+	case V4L2_SEL_TGT_CROP:
+		sel->r = cam->subrect;
+		return 0;
+	default:
+		return -EINVAL;
+	}
 }
 
 /* Similar to set_crop multistage iterative algorithm */
-- 
2.7.4