MLK-16977-1 media: v4l_cap: implement S_FMT ioctl
authorRobby Cai <robby.cai@nxp.com>
Fri, 24 Nov 2017 10:39:13 +0000 (18:39 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
gsteamer uses S_FMT ioctl to set the resolution instead of using
S_PARM ioctl. The S_PARM ioctl depends on the capture mode which is
not in the common way.
This patch uses a common method to set the picture resulotion.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
drivers/media/platform/imx8/mxc-mipi-csi2_yav.c

index 4b1a5cd..ac9a8c4 100644 (file)
@@ -395,8 +395,13 @@ static int mipi_csi2_set_fmt(struct v4l2_subdev *sd,
                             struct v4l2_subdev_pad_config *cfg,
                             struct v4l2_subdev_format *fmt)
 {
-       /* TODO */
-       return 0;
+       struct mxc_mipi_csi2_dev *csi2dev = sd_to_mxc_mipi_csi2_dev(sd);
+       struct v4l2_subdev *sensor_sd = csi2dev->sensor_sd;
+
+       if (fmt->pad)
+               return -EINVAL;
+
+       return v4l2_subdev_call(sensor_sd, pad, set_fmt, NULL, fmt);
 }
 
 static int mipi_csis_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *a)