For dual link MIPI panels, SHUTDOWN packet needs to send to both Ports
A & C during MIPI encoder disabling sequence. Similarly, TURN ON packet
to be sent to both Ports during MIPI encoder enabling sequence.

v2: Address review comments by Jani
    - Used a for loop instead of do-while loop.

Signed-off-by: Gaurav K Singh <gaurav.k.si...@intel.com>
Signed-off-by: Shobhit Kumar <shobhit.ku...@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi_cmd.c |   34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c 
b/drivers/gpu/drm/i915/intel_dsi_cmd.c
index 9cfa832..aecc27c 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c
@@ -394,6 +394,7 @@ int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool 
hs)
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
        int port = PIPE_MAPPED_TO_MIPI_PORT(intel_crtc->pipe);
        u32 mask;
+       int count;
 
        /* XXX: pipe, hs */
        if (hs)
@@ -401,19 +402,26 @@ 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);
-
-       /* 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);
-
-       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);
-
+       for (count = 0; count < (intel_dsi->dual_link ? 2 : 1); count++) {
+               /* 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);
+
+               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);
+               /* For dual link */
+               if (intel_dsi->dual_link)
+                       port = PORT_B;
+       }
        return 0;
 }
 
-- 
1.7.9.5

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

Reply via email to