]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - pending-5.1/drm-i915-dsi-use-a-fuzzy-check-for-burst-mode-clock-check.patch
move existing queues out of the way for the moment...
[thirdparty/kernel/stable-queue.git] / pending-5.1 / drm-i915-dsi-use-a-fuzzy-check-for-burst-mode-clock-check.patch
1 From f9a99131ce18d9dddcaa14ec2c436e42f0bbee5e Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <hdegoede@redhat.com>
3 Date: Fri, 24 May 2019 19:40:27 +0200
4 Subject: drm/i915/dsi: Use a fuzzy check for burst mode clock check
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Hans de Goede <hdegoede@redhat.com>
10
11 commit f9a99131ce18d9dddcaa14ec2c436e42f0bbee5e upstream.
12
13 Prior to this commit we fail to init the DSI panel on the GPD MicroPC:
14 https://www.indiegogo.com/projects/gpd-micropc-6-inch-handheld-industry-laptop#/
15
16 The problem is intel_dsi_vbt_init() failing with the following error:
17 *ERROR* Burst mode freq is less than computed
18
19 The pclk in the VBT panel modeline is 70000, together with 24 bpp and
20 4 lines this results in a bitrate value of 70000 * 24 / 4 = 420000.
21 But the target_burst_mode_freq in the VBT is 418000.
22
23 This commit works around this problem by adding an intel_fuzzy_clock_check
24 when target_burst_mode_freq < bitrate and setting target_burst_mode_freq to
25 bitrate when that checks succeeds, fixing the panel not working.
26
27 Cc: stable@vger.kernel.org
28 Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
29 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
30 Link: https://patchwork.freedesktop.org/patch/msgid/20190524174028.21659-2-hdegoede@redhat.com
31 (cherry picked from commit 2c1c55252647abd989b94f725b190c700312d053)
32 Signed-off-by: Jani Nikula <jani.nikula@intel.com>
33 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
34
35 ---
36 drivers/gpu/drm/i915/intel_display.c | 2 +-
37 drivers/gpu/drm/i915/intel_drv.h | 1 +
38 drivers/gpu/drm/i915/intel_dsi_vbt.c | 11 +++++++++++
39 3 files changed, 13 insertions(+), 1 deletion(-)
40
41 --- a/drivers/gpu/drm/i915/intel_display.c
42 +++ b/drivers/gpu/drm/i915/intel_display.c
43 @@ -11757,7 +11757,7 @@ encoder_retry:
44 return 0;
45 }
46
47 -static bool intel_fuzzy_clock_check(int clock1, int clock2)
48 +bool intel_fuzzy_clock_check(int clock1, int clock2)
49 {
50 int diff;
51
52 --- a/drivers/gpu/drm/i915/intel_drv.h
53 +++ b/drivers/gpu/drm/i915/intel_drv.h
54 @@ -1707,6 +1707,7 @@ int vlv_force_pll_on(struct drm_i915_pri
55 const struct dpll *dpll);
56 void vlv_force_pll_off(struct drm_i915_private *dev_priv, enum pipe pipe);
57 int lpt_get_iclkip(struct drm_i915_private *dev_priv);
58 +bool intel_fuzzy_clock_check(int clock1, int clock2);
59
60 /* modesetting asserts */
61 void assert_panel_unlocked(struct drm_i915_private *dev_priv,
62 --- a/drivers/gpu/drm/i915/intel_dsi_vbt.c
63 +++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c
64 @@ -871,6 +871,17 @@ bool intel_dsi_vbt_init(struct intel_dsi
65 if (mipi_config->target_burst_mode_freq) {
66 u32 bitrate = intel_dsi_bitrate(intel_dsi);
67
68 + /*
69 + * Sometimes the VBT contains a slightly lower clock,
70 + * then the bitrate we have calculated, in this case
71 + * just replace it with the calculated bitrate.
72 + */
73 + if (mipi_config->target_burst_mode_freq < bitrate &&
74 + intel_fuzzy_clock_check(
75 + mipi_config->target_burst_mode_freq,
76 + bitrate))
77 + mipi_config->target_burst_mode_freq = bitrate;
78 +
79 if (mipi_config->target_burst_mode_freq < bitrate) {
80 DRM_ERROR("Burst mode freq is less than computed\n");
81 return false;