Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 10/13] drm/i915: fetch PCH PLL state at init time
Date: Tue,  2 Apr 2013 10:03:54 -0700	[thread overview]
Message-ID: <1364922237-3620-11-git-send-email-jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <1364922237-3620-1-git-send-email-jbarnes@virtuousgeek.org>

We need to properly track PCH PLL sharing configs, and generally set up
PCH PLL state at init time as part of the state readout process.

I-told-you-so-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c |   51 ++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8b55427..208dde4 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6915,6 +6915,54 @@ static int ironlake_crtc_clock_get(struct drm_crtc *crtc)
 	return clock;
 }
 
+static bool ironlake_crtc_pll_get(struct drm_crtc *crtc)
+{
+	struct drm_i915_private *dev_priv = crtc->dev->dev_private;
+	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+	u32 dpll_sel;
+
+	if (HAS_PCH_IBX(dev_priv->dev))
+		intel_crtc->pch_pll = &dev_priv->pch_plls[intel_crtc->pipe];
+
+	if (HAS_PCH_CPT(dev_priv->dev)) {
+		dpll_sel = I915_READ(PCH_DPLL_SEL);
+
+		switch (intel_crtc->pipe) {
+		case PIPE_A:
+			if ((dpll_sel & TRANSA_DPLL_ENABLE) &&
+			    (dpll_sel & TRANSA_DPLLB_SEL))
+				intel_crtc->pch_pll = &dev_priv->pch_plls[1];
+			else if (dpll_sel & TRANSA_DPLL_ENABLE)
+				intel_crtc->pch_pll = &dev_priv->pch_plls[0];
+			break;
+		case PIPE_B:
+			if ((dpll_sel & TRANSB_DPLL_ENABLE) &&
+			    (dpll_sel & TRANSB_DPLLB_SEL))
+				intel_crtc->pch_pll = &dev_priv->pch_plls[1];
+			else if (dpll_sel & TRANSB_DPLL_ENABLE)
+				intel_crtc->pch_pll = &dev_priv->pch_plls[0];
+			break;
+		case PIPE_C:
+			if ((dpll_sel & TRANSC_DPLL_ENABLE) &&
+			    (dpll_sel & TRANSC_DPLLB_SEL))
+				intel_crtc->pch_pll = &dev_priv->pch_plls[1];
+			else if (dpll_sel & TRANSC_DPLL_ENABLE)
+				intel_crtc->pch_pll = &dev_priv->pch_plls[0];
+			break;
+		default:
+			break;
+		}
+	}
+
+	if (intel_crtc->pch_pll) {
+		intel_crtc->pch_pll->refcount++;
+		intel_crtc->pch_pll->active = 1;
+		return true;
+	}
+
+	return false;
+}
+
 static bool ironlake_crtc_get_mode(struct drm_crtc *crtc,
 				   struct drm_display_mode *mode)
 {
@@ -6943,6 +6991,9 @@ static bool ironlake_crtc_get_mode(struct drm_crtc *crtc,
 
 	mode->clock = ironlake_crtc_clock_get(crtc);
 
+	if (!ironlake_crtc_pll_get(crtc))
+		return false;
+
 	drm_mode_set_name(mode);
 
 	return true;
-- 
1.7.9.5

  parent reply	other threads:[~2013-04-02 17:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-02 17:03 Updated fastboot bits Jesse Barnes
2013-04-02 17:03 ` [PATCH 01/13] drm/i915: Skip modifying PCH DREF if not changing clock sources Jesse Barnes
2013-04-02 17:03 ` [PATCH 02/13] drm/i915: Split the framebuffer_info creation into a separate routine Jesse Barnes
2013-04-02 17:13   ` Chris Wilson
2013-04-02 17:03 ` [PATCH 03/13] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v3 Jesse Barnes
2013-04-02 18:24   ` Daniel Vetter
2013-04-02 17:03 ` [PATCH 04/13] drm/i915: Retrieve the current mode upon KMS takeover v2 Jesse Barnes
2013-04-02 17:03 ` [PATCH 05/13] drm/i915: Only preserve the BIOS modes if they are the preferred ones Jesse Barnes
2013-04-02 17:03 ` [PATCH 06/13] drm/i915: Validate that the framebuffer accommodates the current mode Jesse Barnes
2013-04-02 17:03 ` [PATCH 07/13] drm/i915: check panel fit status at update_plane time v2 Jesse Barnes
2013-04-02 17:58   ` Daniel Vetter
2013-04-02 18:00     ` Jesse Barnes
2013-04-02 17:03 ` [PATCH 08/13] drm/i915: treat no fb -> fb as simple flip instead of full mode set Jesse Barnes
2013-04-02 17:03 ` [PATCH 09/13] drm/i915: add debug messages for mode_valid checks Jesse Barnes
2013-04-02 17:03 ` Jesse Barnes [this message]
2013-04-02 17:03 ` [PATCH 11/13] drm/i915: fix DDI get_hw_state return value Jesse Barnes
2013-04-02 17:03 ` [PATCH 12/13] drm/i915: fix DP " Jesse Barnes
2013-04-02 18:11   ` Daniel Vetter
2013-04-03 23:15     ` Daniel Vetter
2013-04-03 23:18       ` Daniel Vetter
2013-04-04  0:12       ` Jesse Barnes
2013-04-04  7:56         ` Daniel Vetter
2013-04-04 16:42           ` Jesse Barnes
2013-04-02 17:03 ` [PATCH 13/13] drm/i915: drop check for invalid pipe after fetching current hw state Jesse Barnes

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=1364922237-3620-11-git-send-email-jbarnes@virtuousgeek.org \
    --to=jbarnes@virtuousgeek.org \
    --cc=intel-gfx@lists.freedesktop.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