linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Sowjanya Komatineni <skomatineni@nvidia.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
Subject: Re: [RFC PATCH v6 09/10] media: tegra-video: Add CSI MIPI pads calibration
Date: Fri, 31 Jul 2020 23:42:29 +0300	[thread overview]
Message-ID: <7d904a86-3189-7ef8-a7b9-1a84564f9278@gmail.com> (raw)
In-Reply-To: <ace047fe-8a1a-666a-b91b-9d63b1d68567@nvidia.com>

31.07.2020 19:29, Sowjanya Komatineni пишет:
> 
> On 7/31/20 9:14 AM, Dmitry Osipenko wrote:
>> 31.07.2020 18:46, Sowjanya Komatineni пишет:
>>> 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.
>> Could you please show how the full call chain looks like? It's not clear
>> to me what keeps CSI stream "ready".
> 
> VI is the main video input (video device) and on streaming it starts
> stream of CSI subdev prior to stream of Sensor.
> 
> HW path, sensor stream (CSI TX) -> CSI stream (RX)
> 
> During CSI stream on, CSI PHY receiver is enabled to start receiving the
> data but internally capture assembled to active state will happen only
> when Tegra VI single shot is issues where VI thru pixel parser gets
> captures data into the memory

Alright, I see now.

Will be great if you could change this hunk:

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

to look like this:

{
  err = v4l2_subdev_call(src_subdev, video, s_stream, true);
  if (err < 0 && err != -ENOIOCTLCMD)
    goto err_disable_csi_stream;
...
  return 0;

err_disable_csi_stream:
  tegra_mipi_cancel_calibration(csi_chan->mipi);

  v4l2_subdev_call(csi_subdev, video, s_stream, false);

  return err;
}


It should make code a bit easier to read and follow.

Otherwise this patch looks good to me, thanks.

  reply	other threads:[~2020-07-31 20:42 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
2020-07-31 16:14       ` Dmitry Osipenko
2020-07-31 16:29         ` Sowjanya Komatineni
2020-07-31 20:42           ` Dmitry Osipenko [this message]
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=7d904a86-3189-7ef8-a7b9-1a84564f9278@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=sboyd@kernel.org \
    --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).