bcm27xx: switch to 5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.10 / 950-0433-media-i2c-ov5647-Selection-compliance-fixes.patch
1 From 86d0f09da59d89d549c1ce4c0996d5c84e9d7d7a 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
5
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.
9
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.
14
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.
18
19 Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
20 ---
21 drivers/media/i2c/ov5647.c | 21 +++++++++++----------
22 1 file changed, 11 insertions(+), 10 deletions(-)
23
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
27 .height = 480
28 },
29 .crop = {
30 - .left = 0,
31 - .top = 0,
32 + .left = OV5647_PIXEL_ARRAY_LEFT,
33 + .top = OV5647_PIXEL_ARRAY_TOP,
34 .width = 1280,
35 .height = 960,
36 },
37 @@ -632,8 +632,8 @@ static struct ov5647_mode supported_mode
38 .height = 1944
39 },
40 .crop = {
41 - .left = 0,
42 - .top = 0,
43 + .left = OV5647_PIXEL_ARRAY_LEFT,
44 + .top = OV5647_PIXEL_ARRAY_TOP,
45 .width = 2592,
46 .height = 1944
47 },
48 @@ -656,8 +656,8 @@ static struct ov5647_mode supported_mode
49 .height = 1080
50 },
51 .crop = {
52 - .left = 348,
53 - .top = 434,
54 + .left = 364,
55 + .top = 450,
56 .width = 1928,
57 .height = 1080,
58 },
59 @@ -679,8 +679,8 @@ static struct ov5647_mode supported_mode
60 .height = 972
61 },
62 .crop = {
63 - .left = 0,
64 - .top = 0,
65 + .left = OV5647_PIXEL_ARRAY_LEFT,
66 + .top = OV5647_PIXEL_ARRAY_TOP,
67 .width = 2592,
68 .height = 1944,
69 },
70 @@ -703,8 +703,8 @@ static struct ov5647_mode supported_mode
71 .height = 480
72 },
73 .crop = {
74 - .left = 16,
75 - .top = 0,
76 + .left = OV5647_PIXEL_ARRAY_LEFT,
77 + .top = OV5647_PIXEL_ARRAY_TOP,
78 .width = 2560,
79 .height = 1920,
80 },
81 @@ -1080,6 +1080,7 @@ static int ov5647_get_selection(struct v
82 return 0;
83
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;