]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/i915/dsi: Use a fuzzy check for burst mode clock check
authorHans de Goede <hdegoede@redhat.com>
Fri, 24 May 2019 17:40:27 +0000 (19:40 +0200)
committerJani Nikula <jani.nikula@intel.com>
Wed, 12 Jun 2019 07:41:55 +0000 (10:41 +0300)
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ä <ville.syrjala@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190524174028.21659-2-hdegoede@redhat.com
(cherry picked from commit 2c1c55252647abd989b94f725b190c700312d053)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_dsi_vbt.c

index 5098228f1302d5bcd4818a80727b417a5423b747..ceb78f44f087da04418f445fcad36c8e0f4cd2cd 100644 (file)
@@ -11942,7 +11942,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;
 
index a38b9cff5cd0e9960f44e23ffdf88875386aaa48..e85cd377a6527aaa51f43e7f44cfaad24c06911a 100644 (file)
@@ -1742,6 +1742,7 @@ int vlv_force_pll_on(struct drm_i915_private *dev_priv, enum pipe pipe,
                     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,
index 3074448446bc889f63b3fba62613cc995bc7df48..4b8e48db18430188ae9da802ee2894148e389f6e 100644 (file)
@@ -853,6 +853,17 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
                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;