devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Sowjanya Komatineni <skomatineni@nvidia.com>,
	Thierry Reding <thierry.reding@gmail.com>
Cc: jonathanh@nvidia.com, frankc@nvidia.com, hverkuil@xs4all.nl,
	sakari.ailus@iki.fi, robh+dt@kernel.org,
	helen.koike@collabora.com, gregkh@linuxfoundation.org,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 08/10] gpu: host1x: mipi: Keep MIPI clock enabled till calibration is done
Date: Thu, 6 Aug 2020 16:32:13 +0300	[thread overview]
Message-ID: <4025a458-fa78-924d-c84f-166f82df0f8e@gmail.com> (raw)
In-Reply-To: <fde2431a-0585-ac32-ac25-73e198aaa948@nvidia.com>

06.08.2020 03:47, Sowjanya Komatineni пишет:
> 
> On 8/5/20 11:06 AM, Sowjanya Komatineni wrote:
>>
>> On 8/5/20 10:46 AM, Sowjanya Komatineni wrote:
>>>
>>> On 8/5/20 10:34 AM, Dmitry Osipenko wrote:
>>>> 05.08.2020 20:29, Sowjanya Komatineni пишет:
>>>> ...
>>>>> UART_FST_MIPI_CAL is the clock used for calibration logic which is FSM
>>>>> that goes thru sequence codes and when done waits for pads to be in
>>>>> LP-11 to apply results.
>>>>>
>>>>> MIPI_CLK is controller gate clock which is also need to be kept
>>>>> enabled
>>>>> as incase if it sees LP-11 it updates registers so its recommended to
>>>>> have this clock enabled.
>>>>>
>>>>> We can cancel_calibration() in CSI only when csi/sensor stream on
>>>>> fails
>>>>> and in which case there will be no LP-11 so we can unconditionally
>>>>> disable MIPI_CLK.
>>>>>
>>>> There is no guarantee that the fail comes before the LP-11. For
>>>> example,
>>>> some odd camera driver may have a complicated enable sequence which may
>>>> fail after enabling the hardware streaming.
>>>
>>> MIPI_CLK to keep enable is for calibration logic to update results,
>>> but like I said calibration logic uses UART_FST_MIPI_CAL clock. So
>>> even in case if fail happens from sensor after having pads in LP-11
>>> then, calibration logic will still be running but result update will
>>> not happen with clock disabled. But HW will not stuck as this is
>>> confirmed from HW designer.
>>
>> If LP-11 happens from sensor stream (followed by fail) and by that
>> time if calibration FSM is done and if calibration logic sees LP-11
>> then results will be applied to pads.
>>
>> We did start of calibration before CSI stream so by the time we do
>> sensor stream enable, calibration logic might have done with FSM and
>> waiting for LP-11
>>
>> Also if we see any special case, we always can use
>> finish_calibration() instead of cancel_calibration() as well.

Why not to do it right now?

Then the code could look like this:

src_subdev = tegra_channel_get_remote_source_subdev(chan);
ret = v4l2_subdev_call(src_subdev, video, s_stream, true);
err = tegra_mipi_finish_calibration(csi_chan->mipi);

if (ret < 0 && ret != -ENOIOCTLCMD)
	goto err_disable_csi_stream;

if (err < 0)
	dev_warn(csi_chan->csi->dev,
		 "MIPI calibration failed: %d\n", err);

>> finish_calibration() has extra 250ms wait time polling done bit and we
>> can ignore its return code during fail pathway.
>>
> Confirmed from HW designer, calibration FSM to finish takes worst case
> 72uS so by the time it gets to sensor stream it will be done its
> sequence and will be waiting for DONE bit.
> 
> So disabling MIPI CAL clock on sensor stream fails is safe.


72us is quite a lot of time, what will happen if LP-11 happens before
FSM finished calibration?

Maybe the finish_calibration() needs to split into two parts:

 1. wait for CAL_STATUS_ACTIVE before enabling sensor
 2. wait for CAL_STATUS_DONE after enabling sensor

  reply	other threads:[~2020-08-06 17:24 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03 15:42 [PATCH v8 00/10] Support for Tegra video capture from external sensor Sowjanya Komatineni
2020-08-03 15:42 ` [PATCH v8 01/10] media: tegra-video: Fix channel format alignment Sowjanya Komatineni
2020-08-03 15:42 ` [PATCH v8 02/10] media: tegra-video: Enable TPG based on kernel config Sowjanya Komatineni
2020-08-03 15:42 ` [PATCH v8 03/10] media: tegra-video: Update format lookup to offset based Sowjanya Komatineni
2020-08-03 15:42 ` [PATCH v8 04/10] dt-bindings: tegra: Update VI and CSI bindings with port info Sowjanya Komatineni
2020-08-03 15:42 ` [PATCH v8 05/10] media: tegra-video: Separate CSI stream enable and disable implementations Sowjanya Komatineni
2020-08-03 15:42 ` [PATCH v8 06/10] media: tegra-video: Add support for external sensor capture Sowjanya Komatineni
2020-08-04  5:57   ` Dmitry Osipenko
2020-08-03 15:42 ` [PATCH v8 07/10] media: tegra-video: Add support for selection ioctl ops Sowjanya Komatineni
2020-08-03 15:42 ` [PATCH v8 08/10] gpu: host1x: mipi: Keep MIPI clock enabled till calibration is done Sowjanya Komatineni
2020-08-05 13:46   ` Thierry Reding
2020-08-05 14:05     ` Dmitry Osipenko
2020-08-05 14:19       ` Dmitry Osipenko
2020-08-05 16:33         ` Sowjanya Komatineni
2020-08-05 16:47           ` Dmitry Osipenko
2020-08-05 16:50             ` Sowjanya Komatineni
2020-08-05 16:57               ` Dmitry Osipenko
2020-08-05 17:04                 ` Sowjanya Komatineni
2020-08-05 17:23                   ` Dmitry Osipenko
2020-08-05 17:32                     ` Sowjanya Komatineni
2020-08-05 17:29                   ` Sowjanya Komatineni
2020-08-05 17:34                     ` Dmitry Osipenko
2020-08-05 17:46                       ` Sowjanya Komatineni
2020-08-05 18:06                         ` Sowjanya Komatineni
2020-08-06  0:47                           ` Sowjanya Komatineni
2020-08-06 13:32                             ` Dmitry Osipenko [this message]
2020-08-06 15:59                               ` Sowjanya Komatineni
2020-08-06 16:10                                 ` Dmitry Osipenko
2020-08-06 16:41                                   ` Sowjanya Komatineni
2020-08-06 16:45                                     ` Dmitry Osipenko
2020-08-06 16:51                                       ` Sowjanya Komatineni
2020-08-06 17:15                                         ` Dmitry Osipenko
2020-08-06 17:12                                     ` Sowjanya Komatineni
2020-08-06 17:27                                       ` Dmitry Osipenko
2020-08-06 17:44                                         ` Sowjanya Komatineni
2020-08-06 17:52                                           ` Sowjanya Komatineni
2020-08-06 18:01                                             ` Dmitry Osipenko
2020-08-06 18:07                                               ` Sowjanya Komatineni
2020-08-06 18:18                                                 ` Dmitry Osipenko
2020-08-06 18:44                                                   ` Sowjanya Komatineni
2020-08-06 18:51                                                     ` Sowjanya Komatineni
2020-08-06 16:13                                 ` Dmitry Osipenko
2020-08-06 16:37                                   ` Dmitry Osipenko
2020-08-06 16:42                                     ` Sowjanya Komatineni
2020-08-06 16:43                                       ` Sowjanya Komatineni
2020-08-03 15:42 ` [PATCH v8 09/10] media: tegra-video: Add CSI MIPI pads calibration Sowjanya Komatineni
2020-08-03 15:42 ` [PATCH v8 10/10] media: tegra-video: Compute settle times based on the clock rate 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=4025a458-fa78-924d-c84f-166f82df0f8e@gmail.com \
    --to=digetx@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frankc@nvidia.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=helen.koike@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jonathanh@nvidia.com \
    --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=skomatineni@nvidia.com \
    --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).