devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Alexandre Courbot
	<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH 1/4] drm/tegra: dc: Don't disable display power partition
Date: Tue, 2 Aug 2016 11:34:26 +0100	[thread overview]
Message-ID: <1470134069-12178-2-git-send-email-jonathanh@nvidia.com> (raw)
In-Reply-To: <1470134069-12178-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Commit 33a8eb8d40ee ("drm/tegra: dc: Implement runtime PM") disables the
display power partition when probing and this causes the Tegra114
Dalmore to hang during boot.

The hang occurs when accessing the MIPI calibration registers (which are
accessed during the configuration of the DSI interface). Ideally the
MIPI driver should manage the power partition itself to ensure it is on
when needed. The problem is that the legacy PMC APIs used for managing
the power partitions do not support reference counting and so this
cannot be easily done currently. Long-term we will migrate devices to
use generic PM domains and such scenarios will be easy to support. For
now fix this by removing the code to turn off the display power
partition when probing the DC and always keep the DC on so that the
power partition is not turned off. This is consistent with how the power
partition was managed prior to this commit.

Please note that for earlier devices such as Tegra114 the MIPI
calibration logic is part of the display power partition, where as for
newer devices, such as Tegra124/210 it is part of the SOR power
partition. Hence, in the long-term is makes more sense to handle such
power partitions via the generic PM domain framework.

Fixes: 33a8eb8d40ee ("drm/tegra: dc: Implement runtime PM")

Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---

Please note that the hang is only seen on Tegra114 with v4.8 if the
patch "ARM: tegra: Correct polarity for Tegra114 PMIC interrupt" (2nd
patch in series) is applied without this patch. Without the fix for the
PMIC interrupt polarity the Palmas PMIC probe fails and the display
probe also fails because the regulators are not found.

 drivers/gpu/drm/tegra/dc.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 8495bd01b544..17bd80a745d6 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -1217,8 +1217,6 @@ static void tegra_crtc_disable(struct drm_crtc *crtc)
 
 	tegra_dc_stats_reset(&dc->stats);
 	drm_crtc_vblank_off(crtc);
-
-	pm_runtime_put_sync(dc->dev);
 }
 
 static void tegra_crtc_enable(struct drm_crtc *crtc)
@@ -1228,8 +1226,6 @@ static void tegra_crtc_enable(struct drm_crtc *crtc)
 	struct tegra_dc *dc = to_tegra_dc(crtc);
 	u32 value;
 
-	pm_runtime_get_sync(dc->dev);
-
 	/* initialize display controller */
 	if (dc->syncpt) {
 		u32 syncpt = host1x_syncpt_id(dc->syncpt);
@@ -1997,8 +1993,6 @@ static int tegra_dc_probe(struct platform_device *pdev)
 			dc->powergate = TEGRA_POWERGATE_DIS;
 		else
 			dc->powergate = TEGRA_POWERGATE_DISB;
-
-		tegra_powergate_power_off(dc->powergate);
 	}
 
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -2020,6 +2014,11 @@ static int tegra_dc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, dc);
 	pm_runtime_enable(&pdev->dev);
+	err = pm_runtime_get_sync(&pdev->dev);
+	if (err < 0) {
+		dev_err(&pdev->dev, "failed to enable device: %d\n", err);
+		goto rpm_disable;
+	}
 
 	INIT_LIST_HEAD(&dc->client.list);
 	dc->client.ops = &dc_client_ops;
@@ -2029,10 +2028,17 @@ static int tegra_dc_probe(struct platform_device *pdev)
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to register host1x client: %d\n",
 			err);
-		return err;
+		goto rpm_put;
 	}
 
 	return 0;
+
+rpm_put:
+	pm_runtime_put_sync(&pdev->dev);
+rpm_disable:
+	pm_runtime_disable(&pdev->dev);
+
+	return err;
 }
 
 static int tegra_dc_remove(struct platform_device *pdev)
@@ -2053,6 +2059,7 @@ static int tegra_dc_remove(struct platform_device *pdev)
 		return err;
 	}
 
+	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
 	return 0;
-- 
2.1.4

  parent reply	other threads:[~2016-08-02 10:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 10:34 [PATCH 0/4] Tegra fixes for v4.8-rc1 Jon Hunter
     [not found] ` <1470134069-12178-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-02 10:34   ` Jon Hunter [this message]
     [not found]     ` <1470134069-12178-2-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-12 13:46       ` [PATCH 1/4] drm/tegra: dc: Don't disable display power partition Thierry Reding
     [not found]         ` <20160812134622.GA25862-EkSeR96xj6Pcmrwk2tT4+A@public.gmane.org>
2016-08-12 15:02           ` Jon Hunter
     [not found]             ` <352741e6-a6ec-65cd-46ea-b734415e7c23-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-12 15:34               ` Thierry Reding
2016-08-02 10:34   ` [PATCH 2/4] ARM: tegra: Correct polarity for Tegra114 PMIC interrupt Jon Hunter
2016-08-02 10:34   ` [PATCH 3/4] clk: tegra: Correct bit width for PMC output clock mux Jon Hunter
     [not found]     ` <1470134069-12178-4-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-16 13:02       ` Thierry Reding
2016-08-16 13:03       ` Thierry Reding
2016-08-02 10:34   ` [PATCH 4/4] arm64: tegra: Add clock and reset names for audio powergate Jon Hunter
     [not found]     ` <1470134069-12178-5-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-02 14:18       ` Mark Rutland
2016-08-02 18:43         ` Jon Hunter
     [not found]           ` <4a793df3-3ac1-9300-62fd-cd628dc47879-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-16 13:06             ` Thierry Reding

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=1470134069-12178-2-git-send-email-jonathanh@nvidia.com \
    --to=jonathanh-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@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 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).