Hi Sakari, Thank you for the patch. On Tue, Apr 16, 2024 at 10:33:16PM +0300, Sakari Ailus wrote: > Add support for the G_SELECTION IOCTL in the ov2740 driver. We need to first define and document how G_SELECTION should behave for raw sensors. > Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> > --- > drivers/media/i2c/ov2740.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c > index e37d824291fe..6e355e986b88 100644 > --- a/drivers/media/i2c/ov2740.c > +++ b/drivers/media/i2c/ov2740.c > @@ -23,6 +23,11 @@ > #define OV2740_DATA_LANES 2 > #define OV2740_RGB_DEPTH 10 > > +#define OV2740_DUMMY_LINES_PRE 8U > +#define OV2740_DUMMY_LINES_POST 8U > +#define OV2740_ACTIVE_WIDTH 1932U > +#define OV2740_ACTIVE_HEIGHT 1092U > + > #define OV2740_REG_CHIP_ID 0x300a > #define OV2740_CHIP_ID 0x2740 > > @@ -1114,6 +1119,31 @@ static int ov2740_set_format(struct v4l2_subdev *sd, > fmt->pad, fmt->stream); > } > > +static int ov2740_get_selection(struct v4l2_subdev *sd, > + struct v4l2_subdev_state *state, > + struct v4l2_subdev_selection *sel) > +{ > + switch (sel->target) { > + case V4L2_SEL_TGT_NATIVE_SIZE: > + case V4L2_SEL_TGT_CROP_BOUNDS: > + sel->r.top = 0; > + sel->r.left = 0; > + sel->r.width = OV2740_ACTIVE_WIDTH; > + sel->r.height = OV2740_DUMMY_LINES_PRE + OV2740_ACTIVE_HEIGHT + > + OV2740_DUMMY_LINES_POST; > + return 0; > + case V4L2_SEL_TGT_CROP: > + case V4L2_SEL_TGT_CROP_DEFAULT: > + sel->r.top = OV2740_DUMMY_LINES_PRE; > + sel->r.left = 0; > + sel->r.width = OV2740_ACTIVE_WIDTH; > + sel->r.height = OV2740_ACTIVE_HEIGHT; > + return 0; > + } > + > + return -EINVAL; > +} > + > static int ov2740_enum_mbus_code(struct v4l2_subdev *sd, > struct v4l2_subdev_state *sd_state, > struct v4l2_subdev_mbus_code_enum *code) > @@ -1222,6 +1252,7 @@ static const struct v4l2_subdev_video_ops ov2740_video_ops = { > static const struct v4l2_subdev_pad_ops ov2740_pad_ops = { > .get_fmt = v4l2_subdev_get_fmt, > .set_fmt = ov2740_set_format, > + .get_selection = ov2740_get_selection, > .enum_mbus_code = ov2740_enum_mbus_code, > .enum_frame_size = ov2740_enum_frame_size, > .enable_streams = ov2740_enable_streams, -- Regards, Laurent Pinchart