From patchwork Tue Feb 12 17:06:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 2130101 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 A0A163FD4F for ; Tue, 12 Feb 2013 17:08:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 778EBE60A2 for ; Tue, 12 Feb 2013 09:08:06 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 05EC1E6422 for ; Tue, 12 Feb 2013 09:07:46 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 12 Feb 2013 09:06:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,650,1355126400"; d="scan'208";a="261595703" Received: from unknown (HELO localhost) ([10.252.120.94]) by orsmga001.jf.intel.com with ESMTP; 12 Feb 2013 09:07:43 -0800 From: Jani Nikula To: intel-gfx@lists.freedesktop.org, daniel@ffwll.ch Date: Tue, 12 Feb 2013 19:06:59 +0200 Message-Id: <1360688819-31968-1-git-send-email-jani.nikula@intel.com> X-Mailer: git-send-email 1.7.10.4 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Cc: jani.nikula@intel.com Subject: [Intel-gfx] [PATCH] drm/i915: move LVDS support check to output setup 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 Keep all the platform output selection in intel_output_setup(), and don't scatter it around. As a useful side effect, do not try to enable LVDS on HSW or VLV. Some checks are done in a slightly different order than before, and on some platforms VGA is now initialized before LVDS. Signed-off-by: Jani Nikula --- I took this out of the VLV series to give it the attention it needs. --- drivers/gpu/drm/i915/intel_display.c | 25 ++++++++++++++++++++----- drivers/gpu/drm/i915/intel_lvds.c | 24 ------------------------ 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index d75c6a0..a1fb320 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -8198,12 +8198,19 @@ static void intel_setup_outputs(struct drm_device *dev) struct drm_i915_private *dev_priv = dev->dev_private; struct intel_encoder *encoder; bool dpd_is_edp = false; - bool has_lvds; - has_lvds = intel_lvds_init(dev); - if (!has_lvds && !HAS_PCH_SPLIT(dev)) { - /* disable the panel fitter on everything but LVDS */ - I915_WRITE(PFIT_CONTROL, 0); + if (!HAS_PCH_SPLIT(dev)) { + bool has_lvds = false; + + /* Prior to PCH split LVDS was only attached to mobile products, + * except for the inglorious 830gm */ + if (IS_MOBILE(dev) && !IS_I830(dev)) + has_lvds = intel_lvds_init(dev); + + if (!has_lvds) { + /* disable the panel fitter on everything but LVDS */ + I915_WRITE(PFIT_CONTROL, 0); + } } if (!(HAS_DDI(dev) && (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES))) @@ -8230,6 +8237,14 @@ static void intel_setup_outputs(struct drm_device *dev) intel_ddi_init(dev, PORT_D); } else if (HAS_PCH_SPLIT(dev)) { int found; + + if (I915_READ(PCH_LVDS) & LVDS_DETECTED) { + if (dev_priv->edp.support) + DRM_DEBUG_KMS("disable LVDS for eDP support\n"); + else + intel_lvds_init(dev); + } + dpd_is_edp = intel_dpd_is_edp(dev); if (has_edp_a(dev)) diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 7e4ec63..3c76e91 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -1024,18 +1024,6 @@ static bool compute_is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder) return (val & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP; } -static bool intel_lvds_supported(struct drm_device *dev) -{ - /* With the introduction of the PCH we gained a dedicated - * LVDS presence pin, use it. */ - if (HAS_PCH_SPLIT(dev)) - return true; - - /* Otherwise LVDS was only attached to mobile products, - * except for the inglorious 830gm */ - return IS_MOBILE(dev) && !IS_I830(dev); -} - /** * intel_lvds_init - setup LVDS connectors on this device * @dev: drm device @@ -1060,9 +1048,6 @@ bool intel_lvds_init(struct drm_device *dev) int pipe; u8 pin; - if (!intel_lvds_supported(dev)) - return false; - /* Skip init on machines we know falsely report LVDS */ if (dmi_check_system(intel_no_lvds)) return false; @@ -1073,15 +1058,6 @@ bool intel_lvds_init(struct drm_device *dev) return false; } - if (HAS_PCH_SPLIT(dev)) { - if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0) - return false; - if (dev_priv->edp.support) { - DRM_DEBUG_KMS("disable LVDS for eDP support\n"); - return false; - } - } - lvds_encoder = kzalloc(sizeof(struct intel_lvds_encoder), GFP_KERNEL); if (!lvds_encoder) return false;