All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 11/19] drm/i915: Precompute static ddi_pll_sel values in encoders
Date: Fri,  4 Jul 2014 11:26:04 -0300	[thread overview]
Message-ID: <1404483964-4140-2-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1404483964-4140-1-git-send-email-przanoni@gmail.com>

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

This way only the dynamic WRPLL selection for hdmi ddi mode is
done in intel_ddi_pll_select.

v2: Don't clobber the precomputed values when selecting clocks fro
hdmi encoders.
v3 (from Paulo): Rebase on top of the s/IS_HASWELL/HAS_DDI/ patch.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_crt.c |  4 +++-
 drivers/gpu/drm/i915/intel_ddi.c | 34 +++-------------------------------
 drivers/gpu/drm/i915/intel_dp.c  | 23 ++++++++++++++++++++---
 3 files changed, 26 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 76ffa2c..88db4b6 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -315,8 +315,10 @@ static bool intel_crt_compute_config(struct intel_encoder *encoder,
 		pipe_config->pipe_bpp = 24;
 
 	/* FDI must always be 2.7 GHz */
-	if (HAS_DDI(dev))
+	if (HAS_DDI(dev)) {
+		pipe_config->ddi_pll_sel = PORT_CLK_SEL_SPLL;
 		pipe_config->port_clock = 135000 * 2;
+	}
 
 	return true;
 }
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 5356e3e..6e976ba 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -403,6 +403,7 @@ void intel_ddi_put_crtc_pll(struct drm_crtc *crtc)
 			I915_WRITE(WRPLL_CTL1, val & ~WRPLL_PLL_ENABLE);
 			POSTING_READ(WRPLL_CTL1);
 		}
+		intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_NONE;
 		break;
 	case PORT_CLK_SEL_WRPLL2:
 		plls->wrpll2_refcount--;
@@ -413,13 +414,12 @@ void intel_ddi_put_crtc_pll(struct drm_crtc *crtc)
 			I915_WRITE(WRPLL_CTL2, val & ~WRPLL_PLL_ENABLE);
 			POSTING_READ(WRPLL_CTL2);
 		}
+		intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_NONE;
 		break;
 	}
 
 	WARN(plls->wrpll1_refcount < 0, "Invalid WRPLL1 refcount\n");
 	WARN(plls->wrpll2_refcount < 0, "Invalid WRPLL2 refcount\n");
-
-	intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_NONE;
 }
 
 #define LC_FREQ 2700
@@ -739,7 +739,6 @@ bool intel_ddi_pll_select(struct intel_crtc *intel_crtc)
 {
 	struct drm_crtc *crtc = &intel_crtc->base;
 	struct intel_encoder *intel_encoder = intel_ddi_get_crtc_encoder(crtc);
-	struct drm_encoder *encoder = &intel_encoder->base;
 	struct drm_i915_private *dev_priv = crtc->dev->dev_private;
 	struct intel_ddi_plls *plls = &dev_priv->ddi_plls;
 	int type = intel_encoder->type;
@@ -748,26 +747,7 @@ bool intel_ddi_pll_select(struct intel_crtc *intel_crtc)
 
 	intel_ddi_put_crtc_pll(crtc);
 
-	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
-
-		switch (intel_dp->link_bw) {
-		case DP_LINK_BW_1_62:
-			intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_LCPLL_810;
-			break;
-		case DP_LINK_BW_2_7:
-			intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_LCPLL_1350;
-			break;
-		case DP_LINK_BW_5_4:
-			intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_LCPLL_2700;
-			break;
-		default:
-			DRM_ERROR("Link bandwidth %d unsupported\n",
-				  intel_dp->link_bw);
-			return false;
-		}
-
-	} else if (type == INTEL_OUTPUT_HDMI) {
+	if (type == INTEL_OUTPUT_HDMI) {
 		uint32_t reg, val;
 		unsigned p, n2, r2;
 
@@ -808,14 +788,6 @@ bool intel_ddi_pll_select(struct intel_crtc *intel_crtc)
 			plls->wrpll2_refcount++;
 			intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_WRPLL2;
 		}
-
-	} else if (type == INTEL_OUTPUT_ANALOG) {
-		DRM_DEBUG_KMS("Using SPLL on pipe %c\n",
-			      pipe_name(pipe));
-		intel_crtc->config.ddi_pll_sel = PORT_CLK_SEL_SPLL;
-	} else {
-		WARN(1, "Invalid DDI encoder type %d\n", type);
-		return false;
 	}
 
 	return true;
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index aedce65..69db121 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -746,6 +746,22 @@ intel_dp_connector_unregister(struct intel_connector *intel_connector)
 }
 
 static void
+hsw_dp_set_ddi_pll_sel(struct intel_crtc_config *pipe_config, int link_bw)
+{
+	switch (link_bw) {
+	case DP_LINK_BW_1_62:
+		pipe_config->ddi_pll_sel = PORT_CLK_SEL_LCPLL_810;
+		break;
+	case DP_LINK_BW_2_7:
+		pipe_config->ddi_pll_sel = PORT_CLK_SEL_LCPLL_1350;
+		break;
+	case DP_LINK_BW_5_4:
+		pipe_config->ddi_pll_sel = PORT_CLK_SEL_LCPLL_2700;
+		break;
+	}
+}
+
+static void
 intel_dp_set_clock(struct intel_encoder *encoder,
 		   struct intel_crtc_config *pipe_config, int link_bw)
 {
@@ -756,8 +772,6 @@ intel_dp_set_clock(struct intel_encoder *encoder,
 	if (IS_G4X(dev)) {
 		divisor = gen4_dpll;
 		count = ARRAY_SIZE(gen4_dpll);
-	} else if (HAS_DDI(dev)) {
-		/* Haswell has special-purpose DP DDI clocks. */
 	} else if (HAS_PCH_SPLIT(dev)) {
 		divisor = pch_dpll;
 		count = ARRAY_SIZE(pch_dpll);
@@ -928,7 +942,10 @@ found:
 				&pipe_config->dp_m2_n2);
 	}
 
-	intel_dp_set_clock(encoder, pipe_config, intel_dp->link_bw);
+	if (HAS_DDI(dev))
+		hsw_dp_set_ddi_pll_sel(pipe_config, intel_dp->link_bw);
+	else
+		intel_dp_set_clock(encoder, pipe_config, intel_dp->link_bw);
 
 	return true;
 }
-- 
2.0.0

  reply	other threads:[~2014-07-04 14:26 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 ` [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     ` Paulo Zanoni [this message]
2014-07-04 14:30     ` 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=1404483964-4140-2-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.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 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.