MLK-16693-1: mipi_csi: Add enum framesize ioctl
authorGuoniu.Zhou <guoniu.zhou@nxp.com>
Thu, 2 Nov 2017 03:18:08 +0000 (11:18 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
Enum framesize include VIDIOC_ENUM_FRAMESIZES and
VIDIOC_ENUM_FRAMEINTERVALS cmd.

Reviewed-by: Robby Cai <robby.cai@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit 78c5a9e1c44770ea10db3d1e3b7508662c9ac88b)

drivers/media/platform/imx8/max9286.c

index 57a9b07..a1acc96 100644 (file)
@@ -2615,6 +2615,26 @@ static int max9286_enum_framesizes(struct v4l2_subdev *sd,
        fse->min_height = fse->max_height;
        return 0;
 }
+static int max9286_enum_frame_interval(struct v4l2_subdev *sd,
+                                  struct v4l2_subdev_pad_config *cfg,
+                                  struct v4l2_subdev_frame_interval_enum *fie)
+{
+       if (fie->index < 0 || fie->index > 8)
+               return -EINVAL;
+
+       if (fie->width == 0 || fie->height == 0 ||
+           fie->code == 0) {
+               pr_warning("Please assign pixel format, width and height.\n");
+               return -EINVAL;
+       }
+
+       fie->interval.numerator = 1;
+
+        /* TODO Reserved to extension */
+
+       fie->interval.denominator = 30;
+       return 0;
+}
 
 static int max9286_get_fmt(struct v4l2_subdev *sd,
                           struct v4l2_subdev_pad_config *cfg,
@@ -2694,6 +2714,7 @@ static int max9286_link_setup(struct media_entity *entity,
 static const struct v4l2_subdev_pad_ops max9286_pad_ops = {
        .enum_mbus_code         = max9286_enum_mbus_code,
        .enum_frame_size        = max9286_enum_framesizes,
+       .enum_frame_interval    = max9286_enum_frame_interval,
        .get_fmt                = max9286_get_fmt,
        .set_fmt                = max9286_set_fmt,
        .get_frame_desc         = max9286_get_frame_desc,