linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sowjanya Komatineni <skomatineni@nvidia.com>
To: Dmitry Osipenko <digetx@gmail.com>, <thierry.reding@gmail.com>,
	<jonathanh@nvidia.com>, <frankc@nvidia.com>, <hverkuil@xs4all.nl>,
	<sakari.ailus@iki.fi>, <robh+dt@kernel.org>,
	<helen.koike@collabora.com>
Cc: <sboyd@kernel.org>, <gregkh@linuxfoundation.org>,
	<linux-media@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-i2c@vger.kernel.org>
Subject: Re: [RFC PATCH v6 09/10] media: tegra-video: Add CSI MIPI pads calibration
Date: Fri, 31 Jul 2020 08:46:36 -0700	[thread overview]
Message-ID: <f483329d-b5fe-fda5-e235-b8edb5fce440@nvidia.com> (raw)
In-Reply-To: <3ac158c4-7df7-e3c1-f0e1-33e7ef017762@gmail.com>


On 7/31/20 4:39 AM, Dmitry Osipenko wrote:
> 31.07.2020 12:02, Sowjanya Komatineni пишет:
> ...
>> @@ -249,13 +249,47 @@ static int tegra_csi_enable_stream(struct v4l2_subdev *subdev)
>>   		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;
>> +		}
> What would happen if CSI stream is enabled and then immediately disabled
> without enabling camera sensor?

Nothing will happen as during stream enable csi receiver is kept ready.

But actual capture will not happen during that point.

>
>> +	}
>> +
> ...
>>   static int tegra_channel_enable_stream(struct tegra_vi_channel *chan)
>>   {
>>   	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);
> Is it possible to move the start_calibration() here?

I think we can do start here as well I guess but currently I am 
following steps order as per design document.

This is the reason I have updated in above comment as well.

>
>>   	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;
>>   }
>>   
>>

  reply	other threads:[~2020-07-31 15:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-31  9:02 [RFC PATCH v6 00/10] Support for Tegra video capture from external sensor Sowjanya Komatineni
2020-07-31  9:02 ` [RFC PATCH v6 01/10] media: tegra-video: Fix channel format alignment Sowjanya Komatineni
2020-07-31  9:02 ` [RFC PATCH v6 02/10] media: tegra-video: Enable TPG based on kernel config Sowjanya Komatineni
2020-07-31  9:02 ` [RFC PATCH v6 03/10] media: tegra-video: Update format lookup to offset based Sowjanya Komatineni
2020-07-31  9:02 ` [RFC PATCH v6 04/10] dt-bindings: tegra: Update VI and CSI bindings with port info Sowjanya Komatineni
2020-07-31  9:02 ` [RFC PATCH v6 05/10] media: tegra-video: Separate CSI stream enable and disable implementations Sowjanya Komatineni
2020-07-31 12:06   ` Dmitry Osipenko
2020-07-31  9:02 ` [RFC PATCH v6 06/10] media: tegra-video: Add support for external sensor capture Sowjanya Komatineni
2020-07-31  9:02 ` [RFC PATCH v6 07/10] media: tegra-video: Add support for selection ioctl ops Sowjanya Komatineni
2020-07-31  9:02 ` [RFC PATCH v6 08/10] gpu: host1x: mipi: Keep MIPI clock enabled till calibration is done Sowjanya Komatineni
2020-07-31  9:02 ` [RFC PATCH v6 09/10] media: tegra-video: Add CSI MIPI pads calibration Sowjanya Komatineni
2020-07-31 11:39   ` Dmitry Osipenko
2020-07-31 15:46     ` Sowjanya Komatineni [this message]
2020-07-31 16:14       ` Dmitry Osipenko
2020-07-31 16:29         ` Sowjanya Komatineni
2020-07-31 20:42           ` Dmitry Osipenko
2020-07-31 21:03             ` Sowjanya Komatineni
2020-07-31  9:02 ` [RFC PATCH v6 10/10] media: tegra-video: Compute settle times based on the clock rate Sowjanya Komatineni
2020-07-31 13:40 ` [RFC PATCH v6 00/10] Support for Tegra video capture from external sensor Wolfram Sang
2020-07-31 15:49   ` Sowjanya Komatineni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f483329d-b5fe-fda5-e235-b8edb5fce440@nvidia.com \
    --to=skomatineni@nvidia.com \
    --cc=devicetree@vger.kernel.org \
    --cc=digetx@gmail.com \
    --cc=frankc@nvidia.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=helen.koike@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jonathanh@nvidia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=sboyd@kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).