31.07.2020 12:02, Sowjanya Komatineni ÐÐÑÐÑ:
...
@@ -249,13 +249,47 @@ static int tegra_csi_enable_stream(struct v4l2_subdev *subdev)What would happen if CSI stream is enabled and then immediately disabled
return ret;
}
+ if (csi_chan->mipi) {
+ ret = tegra_mipi_enable(csi_chan->mipi);
+ if (ret < 0) {
+ dev_err(csi->dev,
+ "failed to enable MIPI pads: %d\n", ret);
+ goto rpm_put;
+ }
+
+ /*
+ * CSI MIPI pads PULLUP, PULLDN and TERM impedances need to
+ * be calibrated after power on.
+ * So, trigger the calibration start here and results will
+ * be latched and applied to the pads when link is in LP11
+ * state during start of sensor streaming.
+ */
+ ret = tegra_mipi_start_calibration(csi_chan->mipi);
+ if (ret < 0) {
+ dev_err(csi->dev,
+ "failed to start MIPI calibration: %d\n", ret);
+ goto disable_mipi;
+ }
without enabling camera sensor?
+ }...
+
static int tegra_channel_enable_stream(struct tegra_vi_channel *chan)Is it possible to move the start_calibration() here?
{
struct v4l2_subdev *csi_subdev, *src_subdev;
+ struct tegra_csi_channel *csi_chan;
int ret;
/*
@@ -206,13 +207,30 @@ static int tegra_channel_enable_stream(struct tegra_vi_channel *chan)
if (IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))
return 0;
+ csi_chan = v4l2_get_subdevdata(csi_subdev);
+ /*
+ * TRM has incorrectly documented to wait for done status from
+ * calibration logic after CSI interface power on.
+ * As per the design, calibration results are latched and applied
+ * to the pads only when the link is in LP11 state which will happen
+ * during the sensor stream-on.
+ * CSI subdev stream-on triggers start of MIPI pads calibration.
+ * Wait for calibration to finish here after sensor subdev stream-on
+ * and in case of sensor stream-on failure, cancel the calibration.
+ */
src_subdev = tegra_channel_get_remote_source_subdev(chan);
ret = v4l2_subdev_call(src_subdev, video, s_stream, true);
if (ret < 0 && ret != -ENOIOCTLCMD) {
+ tegra_mipi_cancel_calibration(csi_chan->mipi);
v4l2_subdev_call(csi_subdev, video, s_stream, false);
return ret;
}
+ ret = tegra_mipi_finish_calibration(csi_chan->mipi);
+ if (ret < 0)
+ dev_warn(csi_chan->csi->dev,
+ "MIPI calibration failed: %d\n", ret);
+
return 0;
}