[RFC PATCH 1/5] media: ov6650: Fix V4L2_SEL_FLAG_KEEP_CONFIG handling

From: Janusz Krzysztofik
Date: Sun May 26 2019 - 16:51:41 EST


This flag is now ignored - output frame size is affected by new crop
settings regardless of the flag value. Fix it.

Since keeping output frame size untouched while applying new crop
settings is not supported, simply return results of .get_selection() if
V4L2_SEL_FLAG_KEEP_CONFIG is passed to .set_selection().

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@xxxxxxxxx>
---
drivers/media/i2c/ov6650.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c
index c728f718716b..1b02479b616f 100644
--- a/drivers/media/i2c/ov6650.c
+++ b/drivers/media/i2c/ov6650.c
@@ -484,6 +484,10 @@ static int ov6650_set_selection(struct v4l2_subdev *sd,
sel->target != V4L2_SEL_TGT_CROP)
return -EINVAL;

+ /* No support for changing crop rectangle with frame size preserved */
+ if (sel->flags & V4L2_SEL_FLAG_KEEP_CONFIG)
+ return ov6650_get_selection(sd, cfg, sel);
+
v4l_bound_align_image(&sel->r.width, 2, W_CIF, 1,
&sel->r.height, 2, H_CIF, 1, 0);
v4l_bound_align_image(&sel->r.left, DEF_HSTRT << 1,
--
2.21.0