1 From cdbecdb538b1854fd61213c490da8b2ded81b5d8 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
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.
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.
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 This commit mirrors 543790f777ba1b3264c168c653db6d415e7c983f done for
22 Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
24 drivers/media/i2c/imx477.c | 17 +++++++++--------
25 1 file changed, 9 insertions(+), 8 deletions(-)
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
31 .line_length_pix = 0x5dc0,
35 + .left = IMX477_PIXEL_ARRAY_LEFT,
36 + .top = IMX477_PIXEL_ARRAY_TOP,
40 @@ -924,8 +924,8 @@ static const struct imx477_mode supporte
42 .line_length_pix = 0x31c4,
46 + .left = IMX477_PIXEL_ARRAY_LEFT,
47 + .top = IMX477_PIXEL_ARRAY_TOP,
51 @@ -948,8 +948,8 @@ static const struct imx477_mode supporte
53 .line_length_pix = 0x31c4,
57 + .left = IMX477_PIXEL_ARRAY_LEFT,
58 + .top = IMX477_PIXEL_ARRAY_TOP + 440,
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.
68 + .left = IMX477_PIXEL_ARRAY_LEFT + 4,
69 + .top = IMX477_PIXEL_ARRAY_TOP,
73 @@ -1696,6 +1696,7 @@ static int imx477_get_selection(struct v
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;