From patchwork Fri Aug 14 10:03:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 7013641 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 546849F373 for ; Fri, 14 Aug 2015 10:04:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8E6BA207C5 for ; Fri, 14 Aug 2015 10:04:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A44FE20788 for ; Fri, 14 Aug 2015 10:04:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 102346EF3C; Fri, 14 Aug 2015 03:04:07 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 942CA8A81D for ; Fri, 14 Aug 2015 03:04:05 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 14 Aug 2015 03:04:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,676,1432623600"; d="scan'208";a="783597301" Received: from sorvi.fi.intel.com ([10.237.72.58]) by fmsmga002.fm.intel.com with ESMTP; 14 Aug 2015 03:04:03 -0700 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Date: Fri, 14 Aug 2015 13:03:24 +0300 Message-Id: <1439546611-3191-5-git-send-email-mika.kahola@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439546611-3191-1-git-send-email-mika.kahola@intel.com> References: <1439546611-3191-1-git-send-email-mika.kahola@intel.com> Subject: [Intel-gfx] [PATCH v4 04/11] drm/i915: LVDS pixel clock check X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It is possible the we request to have a mode that has higher pixel clock than our HW can support. This patch checks if requested pixel clock is lower than the one supported by the HW. The requested mode is discarded if we cannot support the requested pixel clock. This patch applies to LVDS. V2: - removed computation for max pixel clock V3: - cleanup by removing unnecessary lines V4: - moved supported dotclock check from mode_valid() to intel_lvds_init() Signed-off-by: Mika Kahola --- drivers/gpu/drm/i915/intel_lvds.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 881b5d1..06b9d1b 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -1098,8 +1098,11 @@ void intel_lvds_init(struct drm_device *dev) drm_mode_debug_printmodeline(scan); fixed_mode = drm_mode_duplicate(dev, scan); - if (fixed_mode) - goto out; + if (fixed_mode) { + if (fixed_mode->clock <= dev_priv->max_dotclk_freq) + goto out; + } + fixed_mode = NULL; } } @@ -1111,8 +1114,10 @@ void intel_lvds_init(struct drm_device *dev) fixed_mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode); if (fixed_mode) { fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; - goto out; + if (fixed_mode->clock <= dev_priv->max_dotclk_freq) + goto out; } + fixed_mode = NULL; } /* @@ -1135,8 +1140,10 @@ void intel_lvds_init(struct drm_device *dev) DRM_DEBUG_KMS("using current (BIOS) mode: "); drm_mode_debug_printmodeline(fixed_mode); fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; - goto out; + if (fixed_mode->clock <= dev_priv->max_dotclk_freq) + goto out; } + fixed_mode = NULL; } /* If we still don't have a mode after all that, give up. */