diff options
author | Marek Vasut <marex@denx.de> | 2022-06-19 01:31:58 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-07-15 15:23:08 +0100 |
commit | 3193ceeae48ad778a059d66f6ab4299fc498f9d4 (patch) | |
tree | 8396f1522bcbb72d39c1fe190a5a0767d8122d62 /drivers/media/i2c | |
parent | f076057f0107c3ef890bfad8d6658387504e7f11 (diff) |
media: mt9p031: Implement crop bounds get selection
Implement V4L2_SEL_TGT_CROP_BOUNDS query in get_selection subdev op
for this sensor. This is required e.g. to bind it to STM32MP15x DCMI.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefan Riedmueller <s.riedmueller@phytec.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/mt9p031.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index 214474cb4d97..1fd4dc6e4726 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c @@ -623,12 +623,22 @@ static int mt9p031_get_selection(struct v4l2_subdev *subdev, { struct mt9p031 *mt9p031 = to_mt9p031(subdev); - if (sel->target != V4L2_SEL_TGT_CROP) - return -EINVAL; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + sel->r.left = MT9P031_COLUMN_START_MIN; + sel->r.top = MT9P031_ROW_START_MIN; + sel->r.width = MT9P031_WINDOW_WIDTH_MAX; + sel->r.height = MT9P031_WINDOW_HEIGHT_MAX; + return 0; - sel->r = *__mt9p031_get_pad_crop(mt9p031, sd_state, sel->pad, - sel->which); - return 0; + case V4L2_SEL_TGT_CROP: + sel->r = *__mt9p031_get_pad_crop(mt9p031, sd_state, + sel->pad, sel->which); + return 0; + + default: + return -EINVAL; + } } static int mt9p031_set_selection(struct v4l2_subdev *subdev, |