public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 06/19] drm/i915: Move the SPLL enabling into hsw_crt_pre_enable
Date: Wed, 25 Jun 2014 22:01:51 +0300	[thread overview]
Message-ID: <1403722924-26738-7-git-send-email-imre.deak@intel.com> (raw)
In-Reply-To: <1403722924-26738-1-git-send-email-imre.deak@intel.com>

From: Daniel Vetter <daniel.vetter@ffwll.ch>

The call to intel_ddi_pll_enable in haswell_crtc_mode_set is the only
function that still touches the hardware state from the crtc mode_set
callback on hsw. Since the SPLL isn't ever shared we can easily take
it out into the hsw crt encoder functions.

Temporarily we'll loose a bit of WARN_ON coverage with this, but once
the WRPLLs are switched over that will be restored. For the SPLL
selection add a WARN in the hsw fdi link training code.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[imre: rebased on patchset version w/o pch/crt/fdi refactoring]
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/intel_crt.c | 13 +++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c | 19 +------------------
 2 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 8da5ef9..a4bdf257 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -137,6 +137,18 @@ static void hsw_crt_get_config(struct intel_encoder *encoder,
 	pipe_config->adjusted_mode.flags |= intel_crt_get_flags(encoder);
 }
 
+static void hsw_crt_pre_enable(struct intel_encoder *encoder)
+{
+	struct drm_device *dev = encoder->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	WARN(I915_READ(SPLL_CTL) & SPLL_PLL_ENABLE, "SPLL already enabled\n");
+	I915_WRITE(SPLL_CTL,
+		   SPLL_PLL_ENABLE | SPLL_PLL_FREQ_1350MHz | SPLL_PLL_SSC);
+	POSTING_READ(SPLL_CTL);
+	udelay(20);
+}
+
 /* Note: The caller is required to filter out dpms modes not supported by the
  * platform. */
 static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
@@ -860,6 +872,7 @@ void intel_crt_init(struct drm_device *dev)
 	if (HAS_DDI(dev)) {
 		crt->base.get_config = hsw_crt_get_config;
 		crt->base.get_hw_state = intel_ddi_get_hw_state;
+		crt->base.pre_enable = hsw_crt_pre_enable;
 	} else {
 		crt->base.get_config = intel_crt_get_config;
 		crt->base.get_hw_state = intel_crt_get_hw_state;
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 16c9163..accacb9 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -278,6 +278,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)
 
 	/* Configure Port Clock Select */
 	I915_WRITE(PORT_CLK_SEL(PORT_E), intel_crtc->ddi_pll_sel);
+	WARN_ON(intel_crtc->ddi_pll_sel != PORT_CLK_SEL_SPLL);
 
 	/* Start the training iterating through available voltages and emphasis,
 	 * testing each value twice. */
@@ -848,23 +849,6 @@ void intel_ddi_pll_enable(struct intel_crtc *crtc)
 	BUILD_BUG_ON(enable_bit != WRPLL_PLL_ENABLE);
 
 	switch (crtc->ddi_pll_sel) {
-	case PORT_CLK_SEL_LCPLL_2700:
-	case PORT_CLK_SEL_LCPLL_1350:
-	case PORT_CLK_SEL_LCPLL_810:
-		/*
-		 * LCPLL should always be enabled at this point of the mode set
-		 * sequence, so nothing to do.
-		 */
-		return;
-
-	case PORT_CLK_SEL_SPLL:
-		new_val = SPLL_PLL_ENABLE | SPLL_PLL_FREQ_1350MHz |
-			  SPLL_PLL_SSC;
-		WARN(I915_READ(SPLL_CTL) & enable_bit, "SPLL already enabled\n");
-		I915_WRITE(SPLL_CTL, new_val);
-		POSTING_READ(SPLL_CTL);
-		udelay(20);
-		return;
 	case PORT_CLK_SEL_WRPLL1:
 	case PORT_CLK_SEL_WRPLL2:
 		if (crtc->ddi_pll_sel == PORT_CLK_SEL_WRPLL1) {
@@ -889,7 +873,6 @@ void intel_ddi_pll_enable(struct intel_crtc *crtc)
 		WARN(1, "Bad selected pll: PORT_CLK_SEL_NONE\n");
 		return;
 	default:
-		WARN(1, "Bad selected pll: 0x%08x\n", crtc->ddi_pll_sel);
 		return;
 	}
 
-- 
1.8.4

  parent reply	other threads:[~2014-06-25 19:02 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25 19:01 [PATCH 00/19] ddi: respin of runtime PM for DPMS Imre Deak
2014-06-25 19:01 ` [PATCH 01/19] drm/i915: Check hw state in assert_can_disable_lcpll Imre Deak
2014-06-30 20:59   ` Paulo Zanoni
2014-06-25 19:01 ` [PATCH 02/19] drm/i915: Remove spll_refcount for hsw Imre Deak
2014-06-25 19:01 ` [PATCH 03/19] drm/i915: Clean up WRPLL/SPLL #defines Imre Deak
2014-06-25 19:01 ` [PATCH 04/19] drm/i915: ddi: move pch setup after encoder->pre_enable Imre Deak
2014-06-25 19:01 ` [PATCH 05/19] drm/i915: ddi: move pch cleanup before encoder->post_disable Imre Deak
2014-06-25 19:01 ` Imre Deak [this message]
2014-06-25 19:01 ` [PATCH 07/19] drm/i915: Move SPLL disabling into hsw_crt_post_disable Imre Deak
2014-06-25 19:01 ` [PATCH 08/19] drm/i915: Add a debugfs file for the shared dpll state Imre Deak
2014-06-25 19:01 ` [PATCH 09/19] drm/i915: Move ddi_pll_sel into the pipe config Imre Deak
2014-06-25 19:01 ` [PATCH 10/19] drm/i915: State readout and cross-checking for ddi_pll_sel Imre Deak
2014-06-25 19:01 ` [PATCH 11/19] drm/i915: Precompute static ddi_pll_sel values in encoders Imre Deak
2014-07-02 17:17   ` Paulo Zanoni
2014-07-04 14:26   ` [PATCH 10.5/19] drm/i915: BDW also has special-purpose DP DDI clocks Paulo Zanoni
2014-07-04 14:26     ` [PATCH 11/19] drm/i915: Precompute static ddi_pll_sel values in encoders Paulo Zanoni
2014-07-04 14:30     ` [PATCH 10.5/19] drm/i915: BDW also has special-purpose DP DDI clocks Damien Lespiau
2014-06-25 19:01 ` [PATCH 12/19] drm/i915: Basic shared dpll support for WRPLLs Imre Deak
2014-06-25 19:01 ` [PATCH 13/19] drm/i915: Document that the pll->mode_set hook is optional Imre Deak
2014-06-25 19:01 ` [PATCH 14/19] drm/i915: State readout support for WRPLLs Imre Deak
2014-07-04 14:27   ` [PATCH 13.5/19] drm/i915: add POWER_DOMAIN_PLLS Paulo Zanoni
2014-07-04 14:27     ` [PATCH 14/19] drm/i915: State readout support for WRPLLs Paulo Zanoni
2014-07-10 14:35       ` Damien Lespiau
2014-07-10 14:33     ` [PATCH 13.5/19] drm/i915: add POWER_DOMAIN_PLLS Damien Lespiau
2014-06-25 19:02 ` [PATCH 15/19] drm/i915: ->disable hook for WRPLLs Imre Deak
2014-06-25 19:02 ` [PATCH 16/19] drm/i915: ->enable " Imre Deak
2014-06-25 19:02 ` [PATCH 17/19] drm/i915: Switch to common shared dpll framework " Imre Deak
2014-06-25 19:02 ` [PATCH 18/19] drm/i915: Only touch WRPLL hw state in enable/disable hooks Imre Deak
2014-06-25 19:02 ` [PATCH 19/19] drm/i915: ddi: enable runtime pm during dpms Imre Deak
2014-07-01 21:33 ` [PATCH 00/19] ddi: respin of runtime PM for DPMS Paulo Zanoni
2014-07-10 20:15   ` Daniel Vetter
2014-07-11 15:51     ` Daniel Vetter
2014-07-04 14:30 ` [PATCH 20/19] drm/i915: don't skip shared DPLL assertion on LPT Paulo Zanoni
2014-07-10 14:40   ` Damien Lespiau

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=1403722924-26738-7-git-send-email-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --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