]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: rzg2l-cru: Add vidioc_enum_framesizes()
authorDaniel Scally <dan.scally+renesas@ideasonboard.com>
Wed, 25 Jun 2025 09:20:28 +0000 (10:20 +0100)
committerHans Verkuil <hverkuil@xs4all.nl>
Thu, 3 Jul 2025 07:04:14 +0000 (09:04 +0200)
Add a callback to implement the VIDIOC_ENUM_FRAMESIZES ioctl for the
CRU driver.

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20250625-rzg2l-cru-v6-2-a9099ed26c14@ideasonboard.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c

index ab35caf97c51a378305e9a5bbf3d4e33c69f1efc..042a6bd4469794d2137755da012febfe7e2a8fa8 100644 (file)
@@ -1029,6 +1029,31 @@ static int rzg2l_cru_enum_fmt_vid_cap(struct file *file, void *priv,
        return 0;
 }
 
+static int rzg2l_cru_enum_framesizes(struct file *file, void *fh,
+                                    struct v4l2_frmsizeenum *fsize)
+{
+       struct rzg2l_cru_dev *cru = video_drvdata(file);
+       const struct rzg2l_cru_info *info = cru->info;
+       const struct rzg2l_cru_ip_format *fmt;
+
+       if (fsize->index)
+               return -EINVAL;
+
+       fmt = rzg2l_cru_ip_format_to_fmt(fsize->pixel_format);
+       if (!fmt)
+               return -EINVAL;
+
+       fsize->type = V4L2_FRMIVAL_TYPE_CONTINUOUS;
+       fsize->stepwise.min_width = RZG2L_CRU_MIN_INPUT_WIDTH;
+       fsize->stepwise.max_width = info->max_width;
+       fsize->stepwise.step_width = 1;
+       fsize->stepwise.min_height = RZG2L_CRU_MIN_INPUT_HEIGHT;
+       fsize->stepwise.max_height = info->max_height;
+       fsize->stepwise.step_height = 1;
+
+       return 0;
+}
+
 static const struct v4l2_ioctl_ops rzg2l_cru_ioctl_ops = {
        .vidioc_querycap                = rzg2l_cru_querycap,
        .vidioc_try_fmt_vid_cap         = rzg2l_cru_try_fmt_vid_cap,
@@ -1045,6 +1070,7 @@ static const struct v4l2_ioctl_ops rzg2l_cru_ioctl_ops = {
        .vidioc_prepare_buf             = vb2_ioctl_prepare_buf,
        .vidioc_streamon                = vb2_ioctl_streamon,
        .vidioc_streamoff               = vb2_ioctl_streamoff,
+       .vidioc_enum_framesizes         = rzg2l_cru_enum_framesizes,
 };
 
 /* -----------------------------------------------------------------------------