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: Wed, 5 Aug 2020 19:57:54 +0300 [thread overview]
Message-ID: <1c12e40e-de7f-0599-a941-82760b4c7668@gmail.com> (raw)
In-Reply-To: <6eede805-80fd-016f-22f8-b6d25f6587af@nvidia.com>
05.08.2020 19:50, Sowjanya Komatineni пишет:
>
> On 8/5/20 9:47 AM, Dmitry Osipenko wrote:
>> 05.08.2020 19:33, Sowjanya Komatineni пишет:
>>> On 8/5/20 7:19 AM, Dmitry Osipenko wrote:
>>>> 05.08.2020 17:05, Dmitry Osipenko пишет:
>>>>> 05.08.2020 16:46, Thierry Reding пишет:
>>>>>> On Mon, Aug 03, 2020 at 08:42:24AM -0700, Sowjanya Komatineni wrote:
>>>>>>> With the split of MIPI calibration into tegra_mipi_calibrate() and
>>>>>>> tegra_mipi_wait(), MIPI clock is not kept enabled till the
>>>>>>> calibration
>>>>>>> is done.
>>>>>>>
>>>>>>> So, this patch skips disabling MIPI clock after triggering start of
>>>>>>> calibration and disables it only after waiting for done status from
>>>>>>> the calibration logic.
>>>>>>>
>>>>>>> This patch renames tegra_mipi_calibrate() as
>>>>>>> tegra_mipi_start_calibration()
>>>>>>> and tegra_mipi_wait() as tegra_mipi_finish_calibration() to be
>>>>>>> inline
>>>>>>> with their usage.
>>>>>>>
>>>>>>> As MIPI clock is left enabled and in case of any failures with CSI
>>>>>>> input
>>>>>>> streaming tegra_mipi_finish_calibration() will not get invoked.
>>>>>>> So added new API tegra_mipi_cancel_calibration() which disables
>>>>>>> MIPI clock
>>>>>>> and consumer drivers can call this in such cases.
>>>>>>>
>>>>>>> Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
>>>>>>> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
>>>>>>> ---
>>>>>>> drivers/gpu/drm/tegra/dsi.c | 4 ++--
>>>>>>> drivers/gpu/host1x/mipi.c | 19 ++++++++++---------
>>>>>>> include/linux/host1x.h | 5 +++--
>>>>>>> 3 files changed, 15 insertions(+), 13 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/gpu/drm/tegra/dsi.c
>>>>>>> b/drivers/gpu/drm/tegra/dsi.c
>>>>>>> index 3820e8d..a7864e9 100644
>>>>>>> --- a/drivers/gpu/drm/tegra/dsi.c
>>>>>>> +++ b/drivers/gpu/drm/tegra/dsi.c
>>>>>>> @@ -694,11 +694,11 @@ static int tegra_dsi_pad_calibrate(struct
>>>>>>> tegra_dsi *dsi)
>>>>>>> DSI_PAD_PREEMP_PD(0x03) | DSI_PAD_PREEMP_PU(0x3);
>>>>>>> tegra_dsi_writel(dsi, value, DSI_PAD_CONTROL_3);
>>>>>>> - err = tegra_mipi_calibrate(dsi->mipi);
>>>>>>> + err = tegra_mipi_start_calibration(dsi->mipi);
>>>>>>> if (err < 0)
>>>>>>> return err;
>>>>>>> - return tegra_mipi_wait(dsi->mipi);
>>>>>>> + return tegra_mipi_finish_calibration(dsi->mipi);
>>>>>>> }
>>>>>>> static void tegra_dsi_set_timeout(struct tegra_dsi *dsi,
>>>>>>> unsigned long bclk,
>>>>>>> diff --git a/drivers/gpu/host1x/mipi.c b/drivers/gpu/host1x/mipi.c
>>>>>>> index e606464..b15ab6e 100644
>>>>>>> --- a/drivers/gpu/host1x/mipi.c
>>>>>>> +++ b/drivers/gpu/host1x/mipi.c
>>>>>>> @@ -293,17 +293,19 @@ int tegra_mipi_disable(struct
>>>>>>> tegra_mipi_device *dev)
>>>>>>> }
>>>>>>> EXPORT_SYMBOL(tegra_mipi_disable);
>>>>>>> -int tegra_mipi_wait(struct tegra_mipi_device *device)
>>>>>>> +void tegra_mipi_cancel_calibration(struct tegra_mipi_device
>>>>>>> *device)
>>>>>>> +{
>>>>>>> + clk_disable(device->mipi->clk);
>>>>>> Do we need to do anything with the MIPI_CAL_CTRL and MIPI_CAL_STATUS
>>>>>> registers here? We don't clear the START bit in the former when the
>>>>>> calibration has successfully finished, but I suspect that's because
>>>>>> the bit is self-clearing. But I wonder if we still need to clear it
>>>>>> upon cancellation to make sure the calibration does indeed stop.
>>>>> Apparently there is no way to explicitly stop calibration other
>>>>> than to
>>>>> reset MIPI calibration block, but Sowjanya says this is unnecessary.
>>>>>
>>>>> Perhaps having a fixed delay before disabling clock could be enough to
>>>>> ensure that calibration is stopped before the clock is disabled?
>>>>>
>>>> Actually, there is a MIPI_CAL_ACTIVE bit in the status register. Maybe
>>>> it needs to be polled until it's unset?
>>> Confirmed with HW design team during this patch update.
>>>
>>> SW does not need to clear START bit and only write 1 takes effect to
>>> that bit.
>>>
>>> Also, no need to have delay or do any other register settings unclear as
>>> its FSM and there's nothing to get stuck.
>>>
>>> Also it goes thru small finite set of codes and by the time sensor
>>> programming happens for enabling streaming FSM will finish its
>>> calibration sequence much early and it will only wait for pads LP-11.
>>>
>>> So, during cancel we only need disable MIPI clock.
>>>
>> But there is no guarantee that cancel_calibration() couldn't be invoked
>> in the middle of the calibration process, hence FSM could freeze in an
>> intermediate state if it's running on the disabled MIPI clock, this
>> doesn't sound good.
> Actual calibration logic uses UART_FST_CAL clock which is always enabled
What enables the UART_FST_CAL clock? I don't see this clock used anywhere.
next prev parent reply other threads:[~2020-08-05 19:48 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 [this message]
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
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=1c12e40e-de7f-0599-a941-82760b4c7668@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).