]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915: Rewrite mst suspend/resume in terms of encoders
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 5 Jul 2018 16:43:52 +0000 (19:43 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 13 Jul 2018 15:22:22 +0000 (18:22 +0300)
Rather than looping over all the ports and picking the encoder based on
the port, let's just loop over all the encoders instead. Gets rid of
some irq_port[] usage, which is a bit of an eye sore.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180705164357.28512-4-ville.syrjala@linux.intel.com
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_drv.h

index f059aa332323e06794dd7d8afc15a636f9399699..cfa7583cf408874c21a2e236492a134e6c53cf22 100644 (file)
@@ -1586,7 +1586,7 @@ static int i915_drm_suspend(struct drm_device *dev)
 
        intel_display_suspend(dev);
 
-       intel_dp_mst_suspend(dev);
+       intel_dp_mst_suspend(dev_priv);
 
        intel_runtime_pm_disable_interrupts(dev_priv);
        intel_hpd_cancel_work(dev_priv);
@@ -1751,7 +1751,7 @@ static int i915_drm_resume(struct drm_device *dev)
                dev_priv->display.hpd_irq_setup(dev_priv);
        spin_unlock_irq(&dev_priv->irq_lock);
 
-       intel_dp_mst_resume(dev);
+       intel_dp_mst_resume(dev_priv);
 
        intel_display_resume(dev);
 
index f4662b2fb7ab42893d6336af3f82ecc5dbaf1d84..18bcdab24baa50283e1fe1746211b860cdd63ba1 100644 (file)
@@ -6483,37 +6483,44 @@ err_connector_alloc:
        return false;
 }
 
-void intel_dp_mst_suspend(struct drm_device *dev)
+void intel_dp_mst_suspend(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
-       int i;
+       struct intel_encoder *encoder;
+
+       for_each_intel_encoder(&dev_priv->drm, encoder) {
+               struct intel_dp *intel_dp;
+
+               if (encoder->type != INTEL_OUTPUT_DDI)
+                       continue;
 
-       /* disable MST */
-       for (i = 0; i < I915_MAX_PORTS; i++) {
-               struct intel_digital_port *intel_dig_port = dev_priv->hotplug.irq_port[i];
+               intel_dp = enc_to_intel_dp(&encoder->base);
 
-               if (!intel_dig_port || !intel_dig_port->dp.can_mst)
+               if (!intel_dp->can_mst)
                        continue;
 
-               if (intel_dig_port->dp.is_mst)
-                       drm_dp_mst_topology_mgr_suspend(&intel_dig_port->dp.mst_mgr);
+               if (intel_dp->is_mst)
+                       drm_dp_mst_topology_mgr_suspend(&intel_dp->mst_mgr);
        }
 }
 
-void intel_dp_mst_resume(struct drm_device *dev)
+void intel_dp_mst_resume(struct drm_i915_private *dev_priv)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
-       int i;
+       struct intel_encoder *encoder;
 
-       for (i = 0; i < I915_MAX_PORTS; i++) {
-               struct intel_digital_port *intel_dig_port = dev_priv->hotplug.irq_port[i];
+       for_each_intel_encoder(&dev_priv->drm, encoder) {
+               struct intel_dp *intel_dp;
                int ret;
 
-               if (!intel_dig_port || !intel_dig_port->dp.can_mst)
+               if (encoder->type != INTEL_OUTPUT_DDI)
+                       continue;
+
+               intel_dp = enc_to_intel_dp(&encoder->base);
+
+               if (!intel_dp->can_mst)
                        continue;
 
-               ret = drm_dp_mst_topology_mgr_resume(&intel_dig_port->dp.mst_mgr);
+               ret = drm_dp_mst_topology_mgr_resume(&intel_dp->mst_mgr);
                if (ret)
-                       intel_dp_check_mst_status(&intel_dig_port->dp);
+                       intel_dp_check_mst_status(intel_dp);
        }
 }
index 987fbb2ef911ea43ff95b72dfdc2a4096d64e792..33c15fbc9cc104bea578b62f71a7ee809d16da45 100644 (file)
@@ -1698,8 +1698,8 @@ void intel_edp_backlight_off(const struct drm_connector_state *conn_state);
 void intel_edp_panel_vdd_on(struct intel_dp *intel_dp);
 void intel_edp_panel_on(struct intel_dp *intel_dp);
 void intel_edp_panel_off(struct intel_dp *intel_dp);
-void intel_dp_mst_suspend(struct drm_device *dev);
-void intel_dp_mst_resume(struct drm_device *dev);
+void intel_dp_mst_suspend(struct drm_i915_private *dev_priv);
+void intel_dp_mst_resume(struct drm_i915_private *dev_priv);
 int intel_dp_max_link_rate(struct intel_dp *intel_dp);
 int intel_dp_max_lane_count(struct intel_dp *intel_dp);
 int intel_dp_rate_select(struct intel_dp *intel_dp, int rate);