From patchwork Thu Jul 26 18:49:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1245531 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id A48EE3FDD9 for ; Thu, 26 Jul 2012 20:57:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 681BCA0F06 for ; Thu, 26 Jul 2012 13:57:42 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 460119EC4F for ; Thu, 26 Jul 2012 12:57:49 -0700 (PDT) Received: by mail-wg0-f43.google.com with SMTP id dr1so1724686wgb.12 for ; Thu, 26 Jul 2012 12:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=96oNL6C7GCC4onHh8aHjlGxhFUp+IWx/4oYQPgXbyhU=; b=Py2YaXreX02b5ZpgpR01v9jQDiQmNilaslEw0fZDlHjJZJjwDPOiqSqpm9ym40JG9b i4xY5M3w9FqpfbGGdGjGkSPxWKs/9ynlaFA9JDVt7is7ccB/XDSoNRdS53GE2aiKpUOc ENs0ZIRdM7vRc/QEYGPo+0obxpnSfhmm+9pio= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=96oNL6C7GCC4onHh8aHjlGxhFUp+IWx/4oYQPgXbyhU=; b=JACaYU/wIQQnbNnxvYe5/NMzesq28u4d5e2W8+PhUY//4DRgUgUqerLMCe3CHP/y8L W1G9DVptiWptynOHfT0Of/299oA2aoKgUO36h/ilJBAf0Wxy0b1KakMbK3JTRmJgj7Vw 6qDom8nNL6LR28e309QvL5PWH2/RnBpLp1+JtxI+1e8MENAP+c5ddvkRi2T3sgQUFjv0 nZMsJGOXAn4IzrA33sZTIaltppTWZB6sgOAztTJj38fqBO+f1SpHKCixX3RWilvdje57 ScwEhYIbqa5a2ENaRCF4oI8smAuBdAFlT306zPKFJWrMA0boRwiCnIbzn/TUs3JVB/KW O6DA== Received: by 10.216.7.70 with SMTP id 48mr23482weo.40.1343332668754; Thu, 26 Jul 2012 12:57:48 -0700 (PDT) Received: from wespe.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id fr4sm391403wib.8.2012.07.26.12.57.47 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Jul 2012 12:57:48 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Thu, 26 Jul 2012 20:49:39 +0200 Message-Id: <1343328581-2324-75-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1343328581-2324-1-git-send-email-daniel.vetter@ffwll.ch> References: <1343328581-2324-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQkMvl2oDBckDgvjFd2OEOlJH31B56nyl2LdxLt00JwBoAMe/svUGcf+5+teOTODcjyOUfyA Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 74/76] drm/i915: rip out dp port enabling cludges^Wchecks X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org 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 disable 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 disable 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 --- 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 b0ca02e..d825fa9 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");