All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Tomeu Vizoso <tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"Terje Bergström"
	<tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	"David Airlie" <airlied-cv59FeDIM0c@public.gmane.org>,
	"Stephen Warren"
	<swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	"Alexandre Courbot"
	<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v6 09/12] drm/tegra: Reset the SOR on probe
Date: Tue, 24 Mar 2015 11:24:49 +0100	[thread overview]
Message-ID: <20150324102447.GA18115@ulmo.nvidia.com> (raw)
In-Reply-To: <1426672363-30667-10-git-send-email-tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2702 bytes --]

On Wed, Mar 18, 2015 at 10:52:24AM +0100, Tomeu Vizoso wrote:
> As there isn't a way for the firmware on the Nyan chromebooks to hand
> over the display to the kernel.

Perhaps this should be more explicit. I'm assuming this somehow breaks
on Nyan for you because we try to reprogram the SOR from an already
initialized state and that doesn't actually work? Your current commit
message doesn't make this sound like a fix for an actual problem.

> Signed-off-by: Tomeu Vizoso <tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
> Acked-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> Reviewed-by: Alexandre Courbot <acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/gpu/drm/tegra/sor.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
> index 2afe478..e6caacc 100644
> --- a/drivers/gpu/drm/tegra/sor.c
> +++ b/drivers/gpu/drm/tegra/sor.c
> @@ -1458,6 +1458,20 @@ static int tegra_sor_probe(struct platform_device *pdev)
>  
>  	mutex_init(&sor->lock);
>  
> +	err = reset_control_assert(sor->rst);
> +	if (err < 0) {
> +		dev_err(&pdev->dev, "failed to assert SOR reset: %d\n", err);
> +		return err;
> +	}
> +
> +	msleep(20);
> +
> +	err = reset_control_deassert(sor->rst);
> +	if (err < 0) {
> +		dev_err(&pdev->dev, "failed to deassert SOR reset: %d\n", err);
> +		return err;
> +	}

If you do this in ->probe() there's a potentially long time where the
screen will remain black. A better location for this is probably in the
tegra_sor_init() function. That puts it closer to where the output is
reinitialized and potentially reduces the time where no display is
available.

Also it is a more logical place for this code, since the clocks are also
enabled in tegra_sor_init(). Technically resets on Tegra are synchronous
and therefore the reset should happen across the clk_prepare_enable()
call of the primary module clock. So I'd expect something like this:

	err = reset_control_assert(sor->rst);
	...

	err = clk_prepare_enable(sor->clk);
	...

	/* sleep */

	err = reset_control_deassert(sor->rst);
	...

Where sleep can probably be significantly shorter than 20 ms. I think
the documentation says that 2 us are typically enough. That said, I'm
fine with leaving in 20 ms, it shouldn't matter much in the overall
boot-time.

Also, since this will need to be revisited once we have proper hand-over
from firmware to kernel, do you mind adding a comment along these lines:

	/*
	 * XXX: Remove this reset once proper hand-over from firmware to
	 * kernel is possible.
	 */

?

Thanks,
Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: linux-tegra@vger.kernel.org,
	"Terje Bergström" <tbergstrom@nvidia.com>,
	"David Airlie" <airlied@linux.ie>,
	"Stephen Warren" <swarren@wwwdotorg.org>,
	"Alexandre Courbot" <gnurou@gmail.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 09/12] drm/tegra: Reset the SOR on probe
Date: Tue, 24 Mar 2015 11:24:49 +0100	[thread overview]
Message-ID: <20150324102447.GA18115@ulmo.nvidia.com> (raw)
In-Reply-To: <1426672363-30667-10-git-send-email-tomeu.vizoso@collabora.com>

[-- Attachment #1: Type: text/plain, Size: 2618 bytes --]

On Wed, Mar 18, 2015 at 10:52:24AM +0100, Tomeu Vizoso wrote:
> As there isn't a way for the firmware on the Nyan chromebooks to hand
> over the display to the kernel.

Perhaps this should be more explicit. I'm assuming this somehow breaks
on Nyan for you because we try to reprogram the SOR from an already
initialized state and that doesn't actually work? Your current commit
message doesn't make this sound like a fix for an actual problem.

> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Acked-by: Stephen Warren <swarren@nvidia.com>
> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
>  drivers/gpu/drm/tegra/sor.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
> index 2afe478..e6caacc 100644
> --- a/drivers/gpu/drm/tegra/sor.c
> +++ b/drivers/gpu/drm/tegra/sor.c
> @@ -1458,6 +1458,20 @@ static int tegra_sor_probe(struct platform_device *pdev)
>  
>  	mutex_init(&sor->lock);
>  
> +	err = reset_control_assert(sor->rst);
> +	if (err < 0) {
> +		dev_err(&pdev->dev, "failed to assert SOR reset: %d\n", err);
> +		return err;
> +	}
> +
> +	msleep(20);
> +
> +	err = reset_control_deassert(sor->rst);
> +	if (err < 0) {
> +		dev_err(&pdev->dev, "failed to deassert SOR reset: %d\n", err);
> +		return err;
> +	}

If you do this in ->probe() there's a potentially long time where the
screen will remain black. A better location for this is probably in the
tegra_sor_init() function. That puts it closer to where the output is
reinitialized and potentially reduces the time where no display is
available.

Also it is a more logical place for this code, since the clocks are also
enabled in tegra_sor_init(). Technically resets on Tegra are synchronous
and therefore the reset should happen across the clk_prepare_enable()
call of the primary module clock. So I'd expect something like this:

	err = reset_control_assert(sor->rst);
	...

	err = clk_prepare_enable(sor->clk);
	...

	/* sleep */

	err = reset_control_deassert(sor->rst);
	...

Where sleep can probably be significantly shorter than 20 ms. I think
the documentation says that 2 us are typically enough. That said, I'm
fine with leaving in 20 ms, it shouldn't matter much in the overall
boot-time.

Also, since this will need to be revisited once we have proper hand-over
from firmware to kernel, do you mind adding a comment along these lines:

	/*
	 * XXX: Remove this reset once proper hand-over from firmware to
	 * kernel is possible.
	 */

?

Thanks,
Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2015-03-24 10:24 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18  9:52 [PATCH v6 00/12] Improvements to Tegra-based Chromebook support Tomeu Vizoso
2015-03-18  9:52 ` Tomeu Vizoso
2015-03-18  9:52 ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 01/12] ARM: tegra: Change model of sound card in Nyan Big Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 02/12] ARM: tegra: Move out nyan-generic parts out from the nyan-big DT Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 03/12] drm/panel: add support for Samsung LTN140AT29 panel Tomeu Vizoso
2015-03-24 10:27   ` Thierry Reding
2015-03-18  9:52 ` [PATCH v6 04/12] ARM: tegra: Add DTS for the nyan-blaze board Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 05/12] ARM: tegra: Add node for trackpad in Nyan boards Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 06/12] ARM: tegra: Use pwrseq-simple for the wifi in Nyan Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
     [not found] ` <1426672363-30667-1-git-send-email-tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2015-03-18  9:52   ` [PATCH v6 07/12] ARM: tegra: Use the generated pinmux data Tomeu Vizoso
2015-03-18  9:52     ` Tomeu Vizoso
2015-03-18  9:52     ` Tomeu Vizoso
2015-03-18  9:52   ` [PATCH v6 08/12] ARM: tegra: Set spi-max-frequency property to flash node Tomeu Vizoso
2015-03-18  9:52     ` Tomeu Vizoso
2015-03-18  9:52     ` Tomeu Vizoso
2015-03-18  9:52   ` [PATCH v6 09/12] drm/tegra: Reset the SOR on probe Tomeu Vizoso
2015-03-18  9:52     ` Tomeu Vizoso
     [not found]     ` <1426672363-30667-10-git-send-email-tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2015-03-24 10:24       ` Thierry Reding [this message]
2015-03-24 10:24         ` Thierry Reding
     [not found]         ` <20150324102447.GA18115-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2015-03-25  8:59           ` [PATCH] drm/tegra: Reset the SOR during initialization Tomeu Vizoso
2015-03-25  8:59             ` Tomeu Vizoso
     [not found]             ` <1427273979-394-1-git-send-email-tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2015-03-26  9:24               ` Dmitry Osipenko
2015-03-26  9:24                 ` Dmitry Osipenko
2015-03-24 10:28   ` [PATCH v6 00/12] Improvements to Tegra-based Chromebook support Thierry Reding
2015-03-24 10:28     ` Thierry Reding
2015-03-24 10:28     ` Thierry Reding
2015-03-18  9:52 ` [PATCH v6 10/12] soc/tegra: pmc: move to using a restart handler Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-24 10:26   ` Thierry Reding
2015-03-24 10:26     ` Thierry Reding
2015-03-18  9:52 ` [PATCH v6 11/12] ARM: tegra: Add gpio-restart node Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 12/12] ARM: tegra: The WiFi card is kept powered during suspend Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 13/13] HACK: Hide RPMB partitions Tomeu Vizoso
     [not found]   ` <1426672363-30667-14-git-send-email-tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2015-03-18  9:55     ` Tomeu Vizoso
2015-03-18  9:55       ` Tomeu Vizoso

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=20150324102447.GA18115@ulmo.nvidia.com \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.