bcm27xx: add support for linux v5.15
[openwrt/staging/noltari.git] / target / linux / bcm27xx / patches-5.15 / 950-0324-media-i2c-imx477-Selection-compliance-fixes.patch
1 From 7da0b5ae8e757e56c3405a4e68b5ae91a2ea3227 Mon Sep 17 00:00:00 2001
2 From: Naushir Patuck <naush@raspberrypi.com>
3 Date: Wed, 9 Dec 2020 11:30:12 +0000
4 Subject: [PATCH] media: i2c: imx477: 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 imx477 driver.
9
10 The top/left crop coordinates of the TGT_CROP rectangle were set to
11 (0, 0) instead of (8, 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 This commit mirrors 543790f777ba1b3264c168c653db6d415e7c983f done for
20 the imx219 sensor.
21
22 Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
23 ---
24 drivers/media/i2c/imx477.c | 17 +++++++++--------
25 1 file changed, 9 insertions(+), 8 deletions(-)
26
27 --- a/drivers/media/i2c/imx477.c
28 +++ b/drivers/media/i2c/imx477.c
29 @@ -900,8 +900,8 @@ static const struct imx477_mode supporte
30 .height = 3040,
31 .line_length_pix = 0x5dc0,
32 .crop = {
33 - .left = 0,
34 - .top = 0,
35 + .left = IMX477_PIXEL_ARRAY_LEFT,
36 + .top = IMX477_PIXEL_ARRAY_TOP,
37 .width = 4056,
38 .height = 3040,
39 },
40 @@ -924,8 +924,8 @@ static const struct imx477_mode supporte
41 .height = 1520,
42 .line_length_pix = 0x31c4,
43 .crop = {
44 - .left = 0,
45 - .top = 0,
46 + .left = IMX477_PIXEL_ARRAY_LEFT,
47 + .top = IMX477_PIXEL_ARRAY_TOP,
48 .width = 4056,
49 .height = 3040,
50 },
51 @@ -948,8 +948,8 @@ static const struct imx477_mode supporte
52 .height = 1080,
53 .line_length_pix = 0x31c4,
54 .crop = {
55 - .left = 0,
56 - .top = 440,
57 + .left = IMX477_PIXEL_ARRAY_LEFT,
58 + .top = IMX477_PIXEL_ARRAY_TOP + 440,
59 .width = 4056,
60 .height = 2600,
61 },
62 @@ -983,8 +983,8 @@ static const struct imx477_mode supporte
63 * rectangle once the driver is expanded to represent
64 * its processing blocks with multiple subdevs.
65 */
66 - .left = 4,
67 - .top = 0,
68 + .left = IMX477_PIXEL_ARRAY_LEFT + 4,
69 + .top = IMX477_PIXEL_ARRAY_TOP,
70 .width = 4052,
71 .height = 3040,
72 },
73 @@ -1696,6 +1696,7 @@ static int imx477_get_selection(struct v
74 return 0;
75
76 case V4L2_SEL_TGT_CROP_DEFAULT:
77 + case V4L2_SEL_TGT_CROP_BOUNDS:
78 sel->r.left = IMX477_PIXEL_ARRAY_LEFT;
79 sel->r.top = IMX477_PIXEL_ARRAY_TOP;
80 sel->r.width = IMX477_PIXEL_ARRAY_WIDTH;