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 02/19] drm/i915: Remove spll_refcount for hsw
Date: Wed, 25 Jun 2014 22:01:47 +0300	[thread overview]
Message-ID: <1403722924-26738-3-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>

SPLL would be a reference clock we could potentially share,
especially if we want to use the SSC mode. But currently we
don't, so let's rip out this complexity for a simpler conversion
to the new display pll framework.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_drv.h  |  1 -
 drivers/gpu/drm/i915/intel_ddi.c | 41 +++++++++++++---------------------------
 2 files changed, 13 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8cea596..bdc578b 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -229,7 +229,6 @@ void intel_link_compute_m_n(int bpp, int nlanes,
 			    struct intel_link_m_n *m_n);
 
 struct intel_ddi_plls {
-	int spll_refcount;
 	int wrpll1_refcount;
 	int wrpll2_refcount;
 };
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index ded6013..9f02281 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -394,14 +394,11 @@ void intel_ddi_put_crtc_pll(struct drm_crtc *crtc)
 
 	switch (intel_crtc->ddi_pll_sel) {
 	case PORT_CLK_SEL_SPLL:
-		plls->spll_refcount--;
-		if (plls->spll_refcount == 0) {
-			DRM_DEBUG_KMS("Disabling SPLL\n");
-			val = I915_READ(SPLL_CTL);
-			WARN_ON(!(val & SPLL_PLL_ENABLE));
-			I915_WRITE(SPLL_CTL, val & ~SPLL_PLL_ENABLE);
-			POSTING_READ(SPLL_CTL);
-		}
+		DRM_DEBUG_KMS("Disabling SPLL\n");
+		val = I915_READ(SPLL_CTL);
+		WARN_ON(!(val & SPLL_PLL_ENABLE));
+		I915_WRITE(SPLL_CTL, val & ~SPLL_PLL_ENABLE);
+		POSTING_READ(SPLL_CTL);
 		break;
 	case PORT_CLK_SEL_WRPLL1:
 		plls->wrpll1_refcount--;
@@ -425,7 +422,6 @@ void intel_ddi_put_crtc_pll(struct drm_crtc *crtc)
 		break;
 	}
 
-	WARN(plls->spll_refcount < 0, "Invalid SPLL refcount\n");
 	WARN(plls->wrpll1_refcount < 0, "Invalid WRPLL1 refcount\n");
 	WARN(plls->wrpll2_refcount < 0, "Invalid WRPLL2 refcount\n");
 
@@ -821,16 +817,9 @@ bool intel_ddi_pll_select(struct intel_crtc *intel_crtc)
 		}
 
 	} else if (type == INTEL_OUTPUT_ANALOG) {
-		if (plls->spll_refcount == 0) {
-			DRM_DEBUG_KMS("Using SPLL on pipe %c\n",
-				      pipe_name(pipe));
-			plls->spll_refcount++;
-			intel_crtc->ddi_pll_sel = PORT_CLK_SEL_SPLL;
-		} else {
-			DRM_ERROR("SPLL already in use\n");
-			return false;
-		}
-
+		DRM_DEBUG_KMS("Using SPLL on pipe %c\n",
+			      pipe_name(pipe));
+		intel_crtc->ddi_pll_sel = PORT_CLK_SEL_SPLL;
 	} else {
 		WARN(1, "Invalid DDI encoder type %d\n", type);
 		return false;
@@ -869,13 +858,13 @@ void intel_ddi_pll_enable(struct intel_crtc *crtc)
 		return;
 
 	case PORT_CLK_SEL_SPLL:
-		pll_name = "SPLL";
-		reg = SPLL_CTL;
-		refcount = plls->spll_refcount;
 		new_val = SPLL_PLL_ENABLE | SPLL_PLL_FREQ_1350MHz |
 			  SPLL_PLL_SSC;
-		break;
-
+		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) {
@@ -1186,7 +1175,6 @@ void intel_ddi_setup_hw_pll_state(struct drm_device *dev)
 	enum pipe pipe;
 	struct intel_crtc *intel_crtc;
 
-	dev_priv->ddi_plls.spll_refcount = 0;
 	dev_priv->ddi_plls.wrpll1_refcount = 0;
 	dev_priv->ddi_plls.wrpll2_refcount = 0;
 
@@ -1203,9 +1191,6 @@ void intel_ddi_setup_hw_pll_state(struct drm_device *dev)
 								 pipe);
 
 		switch (intel_crtc->ddi_pll_sel) {
-		case PORT_CLK_SEL_SPLL:
-			dev_priv->ddi_plls.spll_refcount++;
-			break;
 		case PORT_CLK_SEL_WRPLL1:
 			dev_priv->ddi_plls.wrpll1_refcount++;
 			break;
-- 
1.8.4

  parent reply	other threads:[~2014-06-25 19:03 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 ` Imre Deak [this message]
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 ` [PATCH 06/19] drm/i915: Move the SPLL enabling into hsw_crt_pre_enable Imre Deak
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-3-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