Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 4/5] drm/i915: rip out dp port enabling cludges^Wchecks
Date: Thu,  6 Sep 2012 22:15:43 +0200	[thread overview]
Message-ID: <1346962544-7439-5-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1346962544-7439-1-git-send-email-daniel.vetter@ffwll.ch>

These have been added because dp links are fiddle things and don't
like it when we try to re-train an enabled output (or disable a
disabled output harder). And because the crtc helper code is
ridiculously bad add tracking the modeset state.

But with the new code in place it is simply a bug to disable a disabled
encoder or to enable an enabled encoder again. Hence convert these to
WARNs (and bail out for safety), but flatten all conditionals in the
code itself.

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_dp.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 7c746d1..07f9521 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1333,15 +1333,15 @@ static void intel_enable_dp(struct intel_encoder *encoder)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t dp_reg = I915_READ(intel_dp->output_reg);
 
+	if (WARN_ON(dp_reg & DP_PORT_EN))
+		return;
+
 	ironlake_edp_panel_vdd_on(intel_dp);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
-	if (!(dp_reg & DP_PORT_EN)) {
-		intel_dp_start_link_train(intel_dp);
-		ironlake_edp_panel_on(intel_dp);
-		ironlake_edp_panel_vdd_off(intel_dp, true);
-		intel_dp_complete_link_train(intel_dp);
-	} else
-		ironlake_edp_panel_vdd_off(intel_dp, false);
+	intel_dp_start_link_train(intel_dp);
+	ironlake_edp_panel_on(intel_dp);
+	ironlake_edp_panel_vdd_off(intel_dp, true);
+	intel_dp_complete_link_train(intel_dp);
 	ironlake_edp_backlight_on(intel_dp);
 }
 
@@ -1913,7 +1913,7 @@ intel_dp_link_down(struct intel_dp *intel_dp)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	uint32_t DP = intel_dp->DP;
 
-	if ((I915_READ(intel_dp->output_reg) & DP_PORT_EN) == 0)
+	if (WARN_ON((I915_READ(intel_dp->output_reg) & DP_PORT_EN) == 0))
 		return;
 
 	DRM_DEBUG_KMS("\n");
-- 
1.7.11.2

  parent reply	other threads:[~2012-09-06 21:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06 20:15 [PATCH 0/5] cpu edp fixes Daniel Vetter
2012-09-06 20:15 ` [PATCH 1/5] drm/i915: add encoder->pre_enable/post_disable Daniel Vetter
2012-09-12 13:48   ` Paulo Zanoni
2012-09-06 20:15 ` [PATCH 2/5] drm/i915: clean up the cpu edp pll special case Daniel Vetter
2012-09-12 21:00   ` Paulo Zanoni
2012-09-13 15:23     ` Daniel Vetter
2012-09-06 20:15 ` [PATCH 3/5] drm/i915: robustify edp_pll_on/off Daniel Vetter
2012-09-13 17:46   ` Paulo Zanoni
2012-09-13 19:22     ` Daniel Vetter
2012-09-13 19:27     ` Daniel Vetter
2012-09-06 20:15 ` Daniel Vetter [this message]
2012-09-13 18:27   ` [PATCH 4/5] drm/i915: rip out dp port enabling cludges^Wchecks Paulo Zanoni
2012-09-06 20:15 ` [PATCH 5/5] drm/i915: disable the cpu edp port after the cpu pipe Daniel Vetter
2012-09-13 19:11   ` Paulo Zanoni
2012-09-13 19:17     ` Daniel Vetter
2012-09-13 19:43       ` Paulo Zanoni
2012-09-13 21:12         ` 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=1346962544-7439-5-git-send-email-daniel.vetter@ffwll.ch \
    --to=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