]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Introduce .set_idle_link_train() vfunc
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 20 Apr 2020 20:06:09 +0000 (23:06 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 24 Apr 2020 14:57:15 +0000 (17:57 +0300)
Relocate a bunch of DDI specific code from intel_dp.c to intel_ddi.c
by introducing a .set_idle_link_train() vfunc.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200420200610.31798-3-ville.syrjala@linux.intel.com
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
drivers/gpu/drm/i915/display/intel_ddi.c
drivers/gpu/drm/i915/display/intel_display_types.h
drivers/gpu/drm/i915/display/intel_dp.c

index 5460899602999627c54021b48ddbe3d2cb0718f0..ef2b1b752497931903ea63685523b095a5f90db3 100644 (file)
@@ -4018,6 +4018,34 @@ static void intel_ddi_set_link_train(struct intel_dp *intel_dp,
        intel_de_posting_read(dev_priv, DDI_BUF_CTL(port));
 }
 
+static void intel_ddi_set_idle_link_train(struct intel_dp *intel_dp)
+{
+       struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+       struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+       enum port port = encoder->port;
+       u32 val;
+
+       val = intel_de_read(dev_priv, intel_dp->regs.dp_tp_ctl);
+       val &= ~DP_TP_CTL_LINK_TRAIN_MASK;
+       val |= DP_TP_CTL_LINK_TRAIN_IDLE;
+       intel_de_write(dev_priv, intel_dp->regs.dp_tp_ctl, val);
+
+       /*
+        * Until TGL on PORT_A we can have only eDP in SST mode. There the only
+        * reason we need to set idle transmission mode is to work around a HW
+        * issue where we enable the pipe while not in idle link-training mode.
+        * In this case there is requirement to wait for a minimum number of
+        * idle patterns to be sent.
+        */
+       if (port == PORT_A && INTEL_GEN(dev_priv) < 12)
+               return;
+
+       if (intel_de_wait_for_set(dev_priv, intel_dp->regs.dp_tp_status,
+                                 DP_TP_STATUS_IDLE_DONE, 1))
+               drm_err(&dev_priv->drm,
+                       "Timed out waiting for DP idle patterns\n");
+}
+
 static bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
                                       enum transcoder cpu_transcoder)
 {
@@ -4463,6 +4491,7 @@ intel_ddi_init_dp_connector(struct intel_digital_port *intel_dig_port)
        intel_dig_port->dp.prepare_link_retrain =
                intel_ddi_prepare_link_retrain;
        intel_dig_port->dp.set_link_train = intel_ddi_set_link_train;
+       intel_dig_port->dp.set_idle_link_train = intel_ddi_set_idle_link_train;
 
        if (INTEL_GEN(dev_priv) >= 12)
                intel_dig_port->dp.set_signal_levels = tgl_set_signal_levels;
index baafd4a6ca2432b7d1a23e0153762da5e051fe87..e58e25779bd62bfdcc4fe10c9590d9ef4a6edab5 100644 (file)
@@ -1368,6 +1368,7 @@ struct intel_dp {
        /* This is called before a link training is starterd */
        void (*prepare_link_retrain)(struct intel_dp *intel_dp);
        void (*set_link_train)(struct intel_dp *intel_dp, u8 dp_train_pat);
+       void (*set_idle_link_train)(struct intel_dp *intel_dp);
        void (*set_signal_levels)(struct intel_dp *intel_dp);
 
        /* Displayport compliance testing */
index 6335b181be4bfd81233daaf85764c10ff7135236..6952b02950968504b903ed52beef3f3800a488ca 100644 (file)
@@ -4365,33 +4365,8 @@ intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,
 
 void intel_dp_set_idle_link_train(struct intel_dp *intel_dp)
 {
-       struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
-       struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
-       enum port port = intel_dig_port->base.port;
-       u32 val;
-
-       if (!HAS_DDI(dev_priv))
-               return;
-
-       val = intel_de_read(dev_priv, intel_dp->regs.dp_tp_ctl);
-       val &= ~DP_TP_CTL_LINK_TRAIN_MASK;
-       val |= DP_TP_CTL_LINK_TRAIN_IDLE;
-       intel_de_write(dev_priv, intel_dp->regs.dp_tp_ctl, val);
-
-       /*
-        * Until TGL on PORT_A we can have only eDP in SST mode. There the only
-        * reason we need to set idle transmission mode is to work around a HW
-        * issue where we enable the pipe while not in idle link-training mode.
-        * In this case there is requirement to wait for a minimum number of
-        * idle patterns to be sent.
-        */
-       if (port == PORT_A && INTEL_GEN(dev_priv) < 12)
-               return;
-
-       if (intel_de_wait_for_set(dev_priv, intel_dp->regs.dp_tp_status,
-                                 DP_TP_STATUS_IDLE_DONE, 1))
-               drm_err(&dev_priv->drm,
-                       "Timed out waiting for DP idle patterns\n");
+       if (intel_dp->set_idle_link_train)
+               intel_dp->set_idle_link_train(intel_dp);
 }
 
 static void