1 From f05add64bf89b04310bc78606a5c70c0e97cb8b8 Mon Sep 17 00:00:00 2001
2 From: Paul Elder <paul.elder@ideasonboard.com>
3 Date: Tue, 22 Dec 2020 14:27:46 +0900
4 Subject: [PATCH] media: i2c: ov5647: Selection compliance fixes
6 To comply with the intended usage of the V4L2 selection target when
7 used to retrieve a sensor image properties, adjust the rectangles
8 returned by the ov5647 driver.
10 The top/left crop coordinates of the TGT_CROP rectangle were set to
11 (0, 0) instead of (16, 16) which is the offset from the larger physical
12 pixel array rectangle. This was also a mismatch with the default values
13 crop rectangle value, so this is corrected. Found with v4l2-compliance.
15 While at it, add V4L2_SEL_TGT_CROP_BOUNDS support: CROP_DEFAULT and
16 CROP_BOUNDS have the same size as the non-active pixels are not readable
17 using the selection API. Found with v4l2-compliance.
19 Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
21 drivers/media/i2c/ov5647.c | 21 +++++++++++----------
22 1 file changed, 11 insertions(+), 10 deletions(-)
24 --- a/drivers/media/i2c/ov5647.c
25 +++ b/drivers/media/i2c/ov5647.c
26 @@ -606,8 +606,8 @@ static struct ov5647_mode supported_mode
32 + .left = OV5647_PIXEL_ARRAY_LEFT,
33 + .top = OV5647_PIXEL_ARRAY_TOP,
37 @@ -632,8 +632,8 @@ static struct ov5647_mode supported_mode
43 + .left = OV5647_PIXEL_ARRAY_LEFT,
44 + .top = OV5647_PIXEL_ARRAY_TOP,
48 @@ -656,8 +656,8 @@ static struct ov5647_mode supported_mode
59 @@ -679,8 +679,8 @@ static struct ov5647_mode supported_mode
65 + .left = OV5647_PIXEL_ARRAY_LEFT,
66 + .top = OV5647_PIXEL_ARRAY_TOP,
70 @@ -703,8 +703,8 @@ static struct ov5647_mode supported_mode
76 + .left = OV5647_PIXEL_ARRAY_LEFT,
77 + .top = OV5647_PIXEL_ARRAY_TOP,
81 @@ -1080,6 +1080,7 @@ static int ov5647_get_selection(struct v
84 case V4L2_SEL_TGT_CROP_DEFAULT:
85 + case V4L2_SEL_TGT_CROP_BOUNDS:
86 sel->r.top = OV5647_PIXEL_ARRAY_TOP;
87 sel->r.left = OV5647_PIXEL_ARRAY_LEFT;
88 sel->r.width = OV5647_PIXEL_ARRAY_WIDTH;