Skip to content

Commit a80c030

Browse files
naushirpelwell
authored andcommitted
media: i2c: imx477: Selection compliance fixes
To comply with the intended usage of the V4L2 selection target when used to retrieve a sensor image properties, adjust the rectangles returned by the imx477 driver. The top/left crop coordinates of the TGT_CROP rectangle were set to (0, 0) instead of (8, 16) which is the offset from the larger physical pixel array rectangle. This was also a mismatch with the default values crop rectangle value, so this is corrected. Found with v4l2-compliance. While at it, add V4L2_SEL_TGT_CROP_BOUNDS support: CROP_DEFAULT and CROP_BOUNDS have the same size as the non-active pixels are not readable using the selection API. Found with v4l2-compliance. This commit mirrors 543790f done for the imx219 sensor. Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
1 parent ffb90a8 commit a80c030

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

‎drivers/media/i2c/imx477.c‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,8 @@ static const struct imx477_mode supported_modes_12bit[] = {
900900
.height = 3040,
901901
.line_length_pix = 0x5dc0,
902902
.crop = {
903-
.left = 0,
904-
.top = 0,
903+
.left = IMX477_PIXEL_ARRAY_LEFT,
904+
.top = IMX477_PIXEL_ARRAY_TOP,
905905
.width = 4056,
906906
.height = 3040,
907907
},
@@ -924,8 +924,8 @@ static const struct imx477_mode supported_modes_12bit[] = {
924924
.height = 1520,
925925
.line_length_pix = 0x31c4,
926926
.crop = {
927-
.left = 0,
928-
.top = 0,
927+
.left = IMX477_PIXEL_ARRAY_LEFT,
928+
.top = IMX477_PIXEL_ARRAY_TOP,
929929
.width = 4056,
930930
.height = 3040,
931931
},
@@ -948,8 +948,8 @@ static const struct imx477_mode supported_modes_12bit[] = {
948948
.height = 1080,
949949
.line_length_pix = 0x31c4,
950950
.crop = {
951-
.left = 0,
952-
.top = 440,
951+
.left = IMX477_PIXEL_ARRAY_LEFT,
952+
.top = IMX477_PIXEL_ARRAY_TOP + 440,
953953
.width = 4056,
954954
.height = 2600,
955955
},
@@ -983,8 +983,8 @@ static const struct imx477_mode supported_modes_10bit[] = {
983983
* rectangle once the driver is expanded to represent
984984
* its processing blocks with multiple subdevs.
985985
*/
986-
.left = 4,
987-
.top = 0,
986+
.left = IMX477_PIXEL_ARRAY_LEFT + 4,
987+
.top = IMX477_PIXEL_ARRAY_TOP,
988988
.width = 4052,
989989
.height = 3040,
990990
},
@@ -1696,6 +1696,7 @@ static int imx477_get_selection(struct v4l2_subdev *sd,
16961696
return 0;
16971697

16981698
case V4L2_SEL_TGT_CROP_DEFAULT:
1699+
case V4L2_SEL_TGT_CROP_BOUNDS:
16991700
sel->r.left = IMX477_PIXEL_ARRAY_LEFT;
17001701
sel->r.top = IMX477_PIXEL_ARRAY_TOP;
17011702
sel->r.width = IMX477_PIXEL_ARRAY_WIDTH;

0 commit comments

Comments
 (0)