The same paradigm can be used all around.

Certain places will need to special case "if (port == PORT_A)" in the
loop, some other places will need to have some other special
cases. However the idea should be future compatible.

Signed-off-by: Jani Nikula <jani.nik...@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi_cmd.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c 
b/drivers/gpu/drm/i915/intel_dsi_cmd.c
index 004fa918ca03..4fda8e3ded58 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c
@@ -395,7 +395,7 @@ int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool 
hs)
        struct drm_device *dev = encoder->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
-       enum port port = intel_dsi_pipe_to_port(intel_crtc->pipe);
+       enum port port;
        u32 mask;
 
        /* XXX: pipe, hs */
@@ -404,18 +404,20 @@ int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, 
bool hs)
        else
                cmd |= DPI_LP_MODE;
 
-       /* clear bit */
-       I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT);
+       for_each_dsi_port(port, intel_dsi->ports) {
+               /* clear bit */
+               I915_WRITE(MIPI_INTR_STAT(port), SPL_PKT_SENT_INTERRUPT);
 
-       /* XXX: old code skips write if control unchanged */
-       if (cmd == I915_READ(MIPI_DPI_CONTROL(port)))
-               DRM_ERROR("Same special packet %02x twice in a row.\n", cmd);
+               /* XXX: old code skips write if control unchanged */
+               if (cmd == I915_READ(MIPI_DPI_CONTROL(port)))
+                       DRM_ERROR("Same special packet %02x twice in a row.\n", 
cmd);
 
-       I915_WRITE(MIPI_DPI_CONTROL(port), cmd);
+               I915_WRITE(MIPI_DPI_CONTROL(port), cmd);
 
-       mask = SPL_PKT_SENT_INTERRUPT;
-       if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 100))
-               DRM_ERROR("Video mode command 0x%08x send failed.\n", cmd);
+               mask = SPL_PKT_SENT_INTERRUPT;
+               if (wait_for((I915_READ(MIPI_INTR_STAT(port)) & mask) == mask, 
100))
+                       DRM_ERROR("Video mode command 0x%08x send failed.\n", 
cmd);
+       }
 
        return 0;
 }
-- 
2.1.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to