All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 24/36] drm/i915: fork lpt version of ironlake_{en, dis}able_pch_transcoder
Date: Wed, 31 Oct 2012 18:12:43 -0200	[thread overview]
Message-ID: <1351714375-15284-25-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1351714375-15284-1-git-send-email-przanoni@gmail.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

For now the new functions are just copies. Differences will be added
later.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 77 +++++++++++++++++++++++++++++++++++-
 1 file changed, 75 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 50c8848..066eb27 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1721,6 +1721,57 @@ static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv,
 		DRM_ERROR("failed to enable transcoder %d\n", pipe);
 }
 
+static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv,
+				      enum pipe pipe)
+{
+	int reg;
+	u32 val, pipeconf_val;
+	struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+
+	/* PCH only available on ILK+ */
+	BUG_ON(dev_priv->info->gen < 5);
+
+	/* Make sure PCH DPLL is enabled */
+	assert_pch_pll_enabled(dev_priv,
+			       to_intel_crtc(crtc)->pch_pll,
+			       to_intel_crtc(crtc));
+
+	/* FDI must be feeding us bits for PCH ports */
+	assert_fdi_tx_enabled(dev_priv, pipe);
+	assert_fdi_rx_enabled(dev_priv, pipe);
+
+	if (IS_HASWELL(dev_priv->dev) && pipe > 0) {
+		DRM_ERROR("Attempting to enable transcoder on Haswell with pipe > 0\n");
+		return;
+	}
+	reg = TRANSCONF(pipe);
+	val = I915_READ(reg);
+	pipeconf_val = I915_READ(PIPECONF(pipe));
+
+	if (HAS_PCH_IBX(dev_priv->dev)) {
+		/*
+		 * make the BPC in transcoder be consistent with
+		 * that in pipeconf reg.
+		 */
+		val &= ~PIPE_BPC_MASK;
+		val |= pipeconf_val & PIPE_BPC_MASK;
+	}
+
+	val &= ~TRANS_INTERLACE_MASK;
+	if ((pipeconf_val & PIPECONF_INTERLACE_MASK) == PIPECONF_INTERLACED_ILK)
+		if (HAS_PCH_IBX(dev_priv->dev) &&
+		    intel_pipe_has_type(crtc, INTEL_OUTPUT_SDVO))
+			val |= TRANS_LEGACY_INTERLACED_ILK;
+		else
+			val |= TRANS_INTERLACED;
+	else
+		val |= TRANS_PROGRESSIVE;
+
+	I915_WRITE(reg, val | TRANS_ENABLE);
+	if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100))
+		DRM_ERROR("failed to enable transcoder %d\n", pipe);
+}
+
 static void ironlake_disable_pch_transcoder(struct drm_i915_private *dev_priv,
 					    enum pipe pipe)
 {
@@ -1743,6 +1794,28 @@ static void ironlake_disable_pch_transcoder(struct drm_i915_private *dev_priv,
 		DRM_ERROR("failed to disable transcoder %d\n", pipe);
 }
 
+static void lpt_disable_pch_transcoder(struct drm_i915_private *dev_priv,
+				       enum pipe pipe)
+{
+	int reg;
+	u32 val;
+
+	/* FDI relies on the transcoder */
+	assert_fdi_tx_disabled(dev_priv, pipe);
+	assert_fdi_rx_disabled(dev_priv, pipe);
+
+	/* Ports must be off as well */
+	assert_pch_ports_disabled(dev_priv, pipe);
+
+	reg = TRANSCONF(pipe);
+	val = I915_READ(reg);
+	val &= ~TRANS_ENABLE;
+	I915_WRITE(reg, val);
+	/* wait for PCH transcoder off, transcoder state */
+	if (wait_for((I915_READ(reg) & TRANS_STATE_ENABLE) == 0, 50))
+		DRM_ERROR("failed to disable transcoder %d\n", pipe);
+}
+
 /**
  * intel_enable_pipe - enable a pipe, asserting requirements
  * @dev_priv: i915 private structure
@@ -3154,7 +3227,7 @@ static void lpt_pch_enable(struct drm_crtc *crtc)
 	I915_WRITE(_TRANS_VSYNC_A,  I915_READ(VSYNC(cpu_transcoder)));
 	I915_WRITE(_TRANS_VSYNCSHIFT_A, I915_READ(VSYNCSHIFT(cpu_transcoder)));
 
-	ironlake_enable_pch_transcoder(dev_priv, intel_crtc->pipe);
+	lpt_enable_pch_transcoder(dev_priv, intel_crtc->pipe);
 }
 
 static void intel_put_pch_pll(struct intel_crtc *intel_crtc)
@@ -3548,7 +3621,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
 			encoder->post_disable(encoder);
 
 	if (is_pch_port) {
-		ironlake_disable_pch_transcoder(dev_priv, pipe);
+		lpt_disable_pch_transcoder(dev_priv, pipe);
 		intel_disable_pch_pll(intel_crtc);
 		intel_ddi_fdi_disable(crtc);
 	}
-- 
1.7.11.4

  parent reply	other threads:[~2012-10-31 20:13 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 20:12 [PATCH 00/36] Haswell VGA fixes Paulo Zanoni
2012-10-31 20:12 ` [PATCH 01/36] drm/i915: don't set ADPA pipe select on LPT Paulo Zanoni
2012-10-31 20:12 ` [PATCH 02/36] drm/i915: use intel_ddi_get_hw_state on CRT encoder too Paulo Zanoni
2012-10-31 20:12 ` [PATCH 03/36] drm/i915: add lpt_pch_enable Paulo Zanoni
2012-10-31 20:12 ` [PATCH 04/36] drm/i915: remove Haswell/LPT bits from ironlake_pch_enable Paulo Zanoni
2012-10-31 20:12 ` [PATCH 05/36] drm/i915: remove ironlake bits from lpt_pch_enable Paulo Zanoni
2012-10-31 20:12 ` [PATCH 06/36] drm/i915: train Haswell FDI at the right time Paulo Zanoni
2012-11-01 15:07   ` Daniel Vetter
2012-10-31 20:12 ` [PATCH 07/36] drm/i915: use the right FDI_RX_CTL register on Haswell Paulo Zanoni
2012-11-01 15:09   ` Daniel Vetter
2012-11-01 16:47     ` Paulo Zanoni
2012-10-31 20:12 ` [PATCH 08/36] drm/i915: set the correct number of FDI lanes " Paulo Zanoni
2012-10-31 20:12 ` [PATCH 09/36] drm/i915: don't rely on DDI_BUF_CTL previous values Paulo Zanoni
2012-10-31 20:12 ` [PATCH 10/36] drm/i915: program the FDI RX TUSIZE register on hsw_fdi_link_train Paulo Zanoni
2012-11-01 15:13   ` Daniel Vetter
2012-10-31 20:12 ` [PATCH 11/36] drm/i915: properly program FDI_RX_MISC pwrdn lane values on HSW Paulo Zanoni
2012-11-01 15:15   ` Daniel Vetter
2012-10-31 20:12 ` [PATCH 12/36] drm/i915: wait only 35us for the FDI link training Paulo Zanoni
2012-10-31 20:12 ` [PATCH 13/36] drm/i915: remove an useless indentation level on hsw_fdi_link_train Paulo Zanoni
2012-10-31 20:12 ` [PATCH 14/36] drm/i915: disable FDI_RX_ENABLE, not FDI_RX_PLL_ENABLE Paulo Zanoni
2012-10-31 20:12 ` [PATCH 15/36] drm/i915: change Haswell FDI link training error messages Paulo Zanoni
2012-10-31 20:12 ` [PATCH 16/36] drm/i915: try each voltage twice at hsw_fdi_link_train Paulo Zanoni
2012-11-01 15:16   ` Daniel Vetter
2012-10-31 20:12 ` [PATCH 17/36] drm/i915: fix Haswell FDI link disable path Paulo Zanoni
2012-10-31 20:12 ` [PATCH 18/36] drm/i915: don't write FDI_RX_TUSIZE on lpt_pch_enable Paulo Zanoni
2012-11-01 15:21   ` Daniel Vetter
2012-10-31 20:12 ` [PATCH 19/36] drm/i915: rename intel_enable_pch_pll to ironlake_enable_pch_pll Paulo Zanoni
2012-11-01 15:40   ` Daniel Vetter
2012-10-31 20:12 ` [PATCH 20/36] drm/i915: don't call ironlake_enable_pch_pll on lpt_pch_enable Paulo Zanoni
2012-10-31 20:12 ` [PATCH 21/36] drm/i915: don't assert_panel_unlocked on LPT Paulo Zanoni
2012-10-31 20:12 ` [PATCH 22/36] drm/i915: use the CPU and PCH transcoders on lpt_pch_enable Paulo Zanoni
2012-10-31 20:12 ` [PATCH 23/36] drm/i915: rename intel_{en, dis}able_transcoder Paulo Zanoni
2012-10-31 20:12 ` Paulo Zanoni [this message]
2012-10-31 20:12 ` [PATCH 25/36] drm/i915: remove Haswell code from ironlake_enable_pch_transcoder Paulo Zanoni
2012-10-31 20:12 ` [PATCH 26/36] drm/i915: remove IBX code from lpt_enable_pch_transcoder Paulo Zanoni
2012-10-31 20:12 ` [PATCH 27/36] drm/i915: don't assert_pch_pll_enabled on lpt_enable_pch_transcoder Paulo Zanoni
2012-11-01 16:07   ` Daniel Vetter
2012-10-31 20:12 ` [PATCH 28/36] drm/i915: use CPU and PCH transcoders " Paulo Zanoni
2012-10-31 20:12 ` [PATCH 29/36] drm/i915: use PIPECONF_INTERLACE_MASK_HSW " Paulo Zanoni
2012-11-01 16:16   ` Daniel Vetter
2012-11-01 16:53     ` Paulo Zanoni
2012-11-01 19:59       ` Daniel Vetter
2012-10-31 20:12 ` [PATCH 30/36] drm/i915: don't rely on previous values when setting LPT TRANSCONF Paulo Zanoni
2012-10-31 20:12 ` [PATCH 31/36] drm/i915: don't assert_pch_ports_disabled on LPT Paulo Zanoni
2012-11-01 16:21   ` Daniel Vetter
2012-10-31 20:12 ` [PATCH 32/36] drm/i915: use CPU and PCH transcoders on lpt_disable_pch_transcoder Paulo Zanoni
2012-10-31 20:12 ` [PATCH 33/36] drm/i915: implement timing override workarounds on LPT Paulo Zanoni
2012-10-31 20:12 ` [PATCH 34/36] drm/i915: don't intel_disable_pch_pll on Haswell/LPT Paulo Zanoni
2012-10-31 20:12 ` [PATCH 35/36] drm/i915: don't limit Haswell CRT encoder to pipe A Paulo Zanoni
2012-10-31 20:12 ` [PATCH 36/36] drm/i915: don't assert disabled FDI before disabling the FDI Paulo Zanoni
2012-11-01 21:09   ` Daniel Vetter

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=1351714375-15284-25-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /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.