Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3011569ybi; Mon, 17 Jun 2019 14:39:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzwEcdC5aJUhcaBUu6HC35v2AaF6f24RDOhcL7dIBPqZTWjdVI+8iCFbWlg7/QzFRHTNEp X-Received: by 2002:a17:902:26c:: with SMTP id 99mr113238295plc.215.1560807540487; Mon, 17 Jun 2019 14:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560807540; cv=none; d=google.com; s=arc-20160816; b=Rm3PbyYsZSBXht/BLno6QAvdst5yiNcATrLVhogZ5B74LAq5RsEPWkoAKkTK2o5v6V 0R5kKJ2/RHmdwbtTOZgHM+KXaGq3+JAGG9X2O51nEDfT4vVNycOcw+Y5ZQ0OBbgJNPDG CBdX5amTsaUGVThJ0VXhGRZ628oOxmlVUwFohn8DH6WEvVoLdJnEynd6FAPLhX/Tk+V6 uC44HXVxI6b7SRYgt/oi+6W4YblD4eNZTTcaig7CKIHmW/1TC2XAPuGXkKfMviOESq/D OgJBYX6besj0DOAfy5TFnGet0O/CggeKBZuczZIt+Mj/RiKoGnbPomDUhh5doTOrRSki CIHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tN2wwtAHW3bZD4+WwtlGeSyESg8itR08eRQP3UDPGTY=; b=X9/+uU5HJ8vHtFk5XJnp+/briGhXqyCgCTwN6oTODdTfP6hyPxvkNdiWnIw9UbUfgh tegKRZ8rN9JzHIdGZ03c8yOJLX+xFt5Dwz7nB5SwqlPx0mbd8SJHPP3WZqXLpvwvIDkM 5GqXgWiL7SOocue3eW2kC9rO1CUlTD7ThFn31qv4n3SCQBShSprfL44or81LS+pELy7X TcOZPb9HBdKwXNCiIUfJ/2Un+vGqLPsFedmZ1ZFMpAtM+Ovt6uQ9H2WsMCjyJDeCBNsp izcSX0E6M3RejsONGtpXzyt/0IlmMCVjOFPQDQivHAJOsYbT+NZ8tpZgWL8/DMxBDpdC GMhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="dD/KEKgK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v97si397490pjb.23.2019.06.17.14.38.45; Mon, 17 Jun 2019 14:39:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="dD/KEKgK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728982AbfFQVh1 (ORCPT + 99 others); Mon, 17 Jun 2019 17:37:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:44138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725497AbfFQVUF (ORCPT ); Mon, 17 Jun 2019 17:20:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A4F620861; Mon, 17 Jun 2019 21:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806403; bh=6n+foonixuc31PF4ZuMbKS89R8pdNFk0aCM+W91tW0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dD/KEKgKln2W6R1wwhfIS+Ly5K7JCqjI+hEI8yu7yOH9HhwjX7nn5kleBnvLcB4/+ atCjuNGoxzVSuOyjw1NDBz1CAS8OiyPr3058I4Rntb3dhiV8zJD4l41johQ8ZfD8pc v3/uOH2yDGmO7IEZABudCaXy6EE8QC5kcGOWi7HU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Hans de Goede , Jani Nikula Subject: [PATCH 5.1 039/115] drm/i915/dsi: Use a fuzzy check for burst mode clock check Date: Mon, 17 Jun 2019 23:08:59 +0200 Message-Id: <20190617210802.013103791@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190617210759.929316339@linuxfoundation.org> References: <20190617210759.929316339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede commit f9a99131ce18d9dddcaa14ec2c436e42f0bbee5e upstream. Prior to this commit we fail to init the DSI panel on the GPD MicroPC: https://www.indiegogo.com/projects/gpd-micropc-6-inch-handheld-industry-laptop#/ The problem is intel_dsi_vbt_init() failing with the following error: *ERROR* Burst mode freq is less than computed The pclk in the VBT panel modeline is 70000, together with 24 bpp and 4 lines this results in a bitrate value of 70000 * 24 / 4 = 420000. But the target_burst_mode_freq in the VBT is 418000. This commit works around this problem by adding an intel_fuzzy_clock_check when target_burst_mode_freq < bitrate and setting target_burst_mode_freq to bitrate when that checks succeeds, fixing the panel not working. Cc: stable@vger.kernel.org Reviewed-by: Ville Syrjälä Signed-off-by: Hans de Goede Link: https://patchwork.freedesktop.org/patch/msgid/20190524174028.21659-2-hdegoede@redhat.com (cherry picked from commit 2c1c55252647abd989b94f725b190c700312d053) Signed-off-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_display.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_dsi_vbt.c | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -11757,7 +11757,7 @@ encoder_retry: return 0; } -static bool intel_fuzzy_clock_check(int clock1, int clock2) +bool intel_fuzzy_clock_check(int clock1, int clock2) { int diff; --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1707,6 +1707,7 @@ int vlv_force_pll_on(struct drm_i915_pri const struct dpll *dpll); void vlv_force_pll_off(struct drm_i915_private *dev_priv, enum pipe pipe); int lpt_get_iclkip(struct drm_i915_private *dev_priv); +bool intel_fuzzy_clock_check(int clock1, int clock2); /* modesetting asserts */ void assert_panel_unlocked(struct drm_i915_private *dev_priv, --- a/drivers/gpu/drm/i915/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c @@ -871,6 +871,17 @@ bool intel_dsi_vbt_init(struct intel_dsi if (mipi_config->target_burst_mode_freq) { u32 bitrate = intel_dsi_bitrate(intel_dsi); + /* + * Sometimes the VBT contains a slightly lower clock, + * then the bitrate we have calculated, in this case + * just replace it with the calculated bitrate. + */ + if (mipi_config->target_burst_mode_freq < bitrate && + intel_fuzzy_clock_check( + mipi_config->target_burst_mode_freq, + bitrate)) + mipi_config->target_burst_mode_freq = bitrate; + if (mipi_config->target_burst_mode_freq < bitrate) { DRM_ERROR("Burst mode freq is less than computed\n"); return false;