On Wed, 24 Sep 2014, Gaurav K Singh <gaurav.k.si...@intel.com> wrote:
> 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 |   35 
> ++++++++++++++++++++++------------
>  1 file changed, 23 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c 
> b/drivers/gpu/drm/i915/intel_dsi_cmd.c
> index eb698b1..a70656e 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);
>       enum pipe pipe = intel_crtc->pipe;
>       u32 mask;
> +     int count = 1;
>  
>       /* XXX: pipe, hs */
>       if (hs)
> @@ -401,18 +402,28 @@ 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(pipe), SPL_PKT_SENT_INTERRUPT);
> -
> -     /* XXX: old code skips write if control unchanged */
> -     if (cmd == I915_READ(MIPI_DPI_CONTROL(pipe)))
> -             DRM_ERROR("Same special packet %02x twice in a row.\n", cmd);
> -
> -     I915_WRITE(MIPI_DPI_CONTROL(pipe), cmd);
> -
> -     mask = SPL_PKT_SENT_INTERRUPT;
> -     if (wait_for((I915_READ(MIPI_INTR_STAT(pipe)) & mask) == mask, 100))
> -             DRM_ERROR("Video mode command 0x%08x send failed.\n", cmd);
> +     if (intel_dsi->dual_link)
> +             count = 2;
> +
> +     do {

Please never use a do-while when a regular for loop will do.

> +             /* clear bit */
> +             I915_WRITE(MIPI_INTR_STAT(pipe), SPL_PKT_SENT_INTERRUPT);
> +
> +             /* XXX: old code skips write if control unchanged */
> +             if (cmd == I915_READ(MIPI_DPI_CONTROL(pipe)))
> +                     DRM_ERROR("Same special packet %02x twice in a row.\n",
> +                                                                     cmd);
> +             I915_WRITE(MIPI_DPI_CONTROL(pipe), cmd);
> +
> +             mask = SPL_PKT_SENT_INTERRUPT;
> +             if (wait_for((I915_READ(MIPI_INTR_STAT(pipe)) & mask) ==
> +                                                             mask, 100))
> +                     DRM_ERROR("Video mode command 0x%08x send failed.\n",
> +                                                                     cmd);
> +             /* For Port C for dual link */
> +             if (intel_dsi->dual_link)
> +                     pipe = PIPE_B;
> +     } while (--count > 0);
>  
>       return 0;
>  }
> -- 
> 1.7.9.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to