diff options
author | Guoniu.Zhou <guoniu.zhou@nxp.com> | 2018-10-30 14:58:48 +0800 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:34:58 +0800 |
commit | 713a43584a6fda0ce7fd2182fdfbb2fd83282554 (patch) | |
tree | eaad11bf22290124ea3e98f3ae0a684c59df2cf3 /drivers/media/platform/imx8/mxc-mipi-csi2.c | |
parent | b165e695ffdf710f92186c992bf7aa2ade37f22b (diff) |
MLK-20123-1: camera: add automatic selection mode for mipi ov5640
There is two methods to select different mode for camera sensor, one
is setting mode by VIDIOC_S_PARM ioctl and the other is automatic
selection through resolution. If resolution match one of camera sensor
supported, driver will select the corresponding mode. If not, driver
will select the max resolution supported by sensor and use ISI to
resize to the target resolution.
This patch is for mipi interface of ov5640 sensor
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit 4c560890906f7df33e68a65372f60778cb1406b7)
Diffstat (limited to 'drivers/media/platform/imx8/mxc-mipi-csi2.c')
-rw-r--r-- | drivers/media/platform/imx8/mxc-mipi-csi2.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/media/platform/imx8/mxc-mipi-csi2.c b/drivers/media/platform/imx8/mxc-mipi-csi2.c index 7bdd8a05973f..313ec77cd2cf 100644 --- a/drivers/media/platform/imx8/mxc-mipi-csi2.c +++ b/drivers/media/platform/imx8/mxc-mipi-csi2.c @@ -603,6 +603,30 @@ static int mipi_csi2_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { + struct mxc_mipi_csi2_dev *csi2dev = sd_to_mxc_mipi_csi2_dev(sd); + struct v4l2_subdev *sen_sd; + struct media_pad *source_pad; + int ret; + + /* Get remote source pad */ + source_pad = mxc_csi2_get_remote_sensor_pad(csi2dev); + if (source_pad == NULL) { + v4l2_err(&csi2dev->v4l2_dev, "%s, No remote pad found!\n", __func__); + return -EINVAL; + } + + /* Get remote source pad subdev */ + sen_sd = media_entity_to_v4l2_subdev(source_pad->entity); + if (sen_sd == NULL) { + v4l2_err(&csi2dev->v4l2_dev, "%s, No remote subdev found!\n", __func__); + return -EINVAL; + } + + fmt->pad = source_pad->index; + ret = v4l2_subdev_call(sen_sd, pad, set_fmt, NULL, fmt); + if (ret < 0 && ret != -ENOIOCTLCMD) + return -EINVAL; + return 0; } |