drm/i915/ddi: Align timeout for DDI_BUF_CTL active with Bspec
authorAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Wed, 7 Dec 2022 14:54:36 +0000 (20:24 +0530)
committerImre Deak <imre.deak@intel.com>
Wed, 21 Dec 2022 17:38:17 +0000 (19:38 +0200)
For Gen12+ wait for 1ms for Combo Phy and 3ms for TC Phy for
DDI_BUF_CTL to be active for TC phy. (Bspec:49190)

v2: Minor refactoring for better readability.

v3: Rebased and retained the order of checking platforms. (Imre)

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221207145436.1510625-1-ankit.k.nautiyal@intel.com
drivers/gpu/drm/i915/display/intel_ddi.c

index 69595cbb276651fc406bff1c09034c8bac464e5b..f2fb0e6e62593180ff90f911b6288b9b54e7df2b 100644 (file)
@@ -185,6 +185,8 @@ void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,
 static void intel_wait_ddi_buf_active(struct drm_i915_private *dev_priv,
                                      enum port port)
 {
+       enum phy phy = intel_port_to_phy(dev_priv, port);
+       int timeout_us;
        int ret;
 
        /* Wait > 518 usecs for DDI_BUF_CTL to be non idle */
@@ -193,8 +195,19 @@ static void intel_wait_ddi_buf_active(struct drm_i915_private *dev_priv,
                return;
        }
 
+       if (IS_DG2(dev_priv)) {
+               timeout_us = 1200;
+       } else if (DISPLAY_VER(dev_priv) >= 12) {
+               if (intel_phy_is_tc(dev_priv, phy))
+                       timeout_us = 3000;
+               else
+                       timeout_us = 1000;
+       } else {
+               timeout_us = 500;
+       }
+
        ret = _wait_for(!(intel_de_read(dev_priv, DDI_BUF_CTL(port)) &
-                         DDI_BUF_IS_IDLE), IS_DG2(dev_priv) ? 1200 : 500, 10, 10);
+                         DDI_BUF_IS_IDLE), timeout_us, 10, 10);
 
        if (ret)
                drm_err(&dev_priv->drm, "Timeout waiting for DDI BUF %c to get active\n",