Commit 1ed36ecd authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: i2c: imx219: 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 imx219 driver.

The top/left crop coordinates of the TGT_CROP rectangle were set to
(0, 0) instead of (8, 8) 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.

[reword commit message, use macros for pixel offsets]

Fixes: e6d4ef7d ("media: i2c: imx219: Implement get_selection")
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarJacopo Mondi <jacopo@jmondi.org>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent f61eb7bc
...@@ -471,8 +471,8 @@ static const struct imx219_mode supported_modes[] = { ...@@ -471,8 +471,8 @@ static const struct imx219_mode supported_modes[] = {
.width = 3280, .width = 3280,
.height = 2464, .height = 2464,
.crop = { .crop = {
.left = 0, .left = IMX219_PIXEL_ARRAY_LEFT,
.top = 0, .top = IMX219_PIXEL_ARRAY_TOP,
.width = 3280, .width = 3280,
.height = 2464 .height = 2464
}, },
...@@ -487,8 +487,8 @@ static const struct imx219_mode supported_modes[] = { ...@@ -487,8 +487,8 @@ static const struct imx219_mode supported_modes[] = {
.width = 1920, .width = 1920,
.height = 1080, .height = 1080,
.crop = { .crop = {
.left = 680, .left = 688,
.top = 692, .top = 700,
.width = 1920, .width = 1920,
.height = 1080 .height = 1080
}, },
...@@ -503,8 +503,8 @@ static const struct imx219_mode supported_modes[] = { ...@@ -503,8 +503,8 @@ static const struct imx219_mode supported_modes[] = {
.width = 1640, .width = 1640,
.height = 1232, .height = 1232,
.crop = { .crop = {
.left = 0, .left = IMX219_PIXEL_ARRAY_LEFT,
.top = 0, .top = IMX219_PIXEL_ARRAY_TOP,
.width = 3280, .width = 3280,
.height = 2464 .height = 2464
}, },
...@@ -519,8 +519,8 @@ static const struct imx219_mode supported_modes[] = { ...@@ -519,8 +519,8 @@ static const struct imx219_mode supported_modes[] = {
.width = 640, .width = 640,
.height = 480, .height = 480,
.crop = { .crop = {
.left = 1000, .left = 1008,
.top = 752, .top = 760,
.width = 1280, .width = 1280,
.height = 960 .height = 960
}, },
...@@ -1006,6 +1006,7 @@ static int imx219_get_selection(struct v4l2_subdev *sd, ...@@ -1006,6 +1006,7 @@ static int imx219_get_selection(struct v4l2_subdev *sd,
return 0; return 0;
case V4L2_SEL_TGT_CROP_DEFAULT: case V4L2_SEL_TGT_CROP_DEFAULT:
case V4L2_SEL_TGT_CROP_BOUNDS:
sel->r.top = IMX219_PIXEL_ARRAY_TOP; sel->r.top = IMX219_PIXEL_ARRAY_TOP;
sel->r.left = IMX219_PIXEL_ARRAY_LEFT; sel->r.left = IMX219_PIXEL_ARRAY_LEFT;
sel->r.width = IMX219_PIXEL_ARRAY_WIDTH; sel->r.width = IMX219_PIXEL_ARRAY_WIDTH;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment