MLK-17371 gpu: imx: dpu: framegen: Use better timeout value to wait for ENSTS
authorLiu Ying <victor.liu@nxp.com>
Fri, 12 Jan 2018 09:42:21 +0000 (17:42 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:52:51 +0000 (14:52 -0500)
commit94d6eca5bf23dd5750e33591df24f43610b093a4
tree9c9dfd8b4cf534a650011c3eca287f7a8c91a777
parent9c032d0220e701ac7dc3e35bc2518be3a2bc40c5
MLK-17371 gpu: imx: dpu: framegen: Use better timeout value to wait for ENSTS

The DPU spec tells us that we need to wait for all pending frames to
be completed when a display stream is disabled.  It turns out
that the hardcoded 60-microsecond timeout value is not enough for
some low refresh rate video modes, e.g., 1920x1080@24, which makes
the display stream be disabled incorrectly(leave the hardware an
incorrect machine status).  The SoC design indicates that there are
two pending frames to complete in the worst case.  This patch waits
for at most three frame duration(which is enough for sure) so that
the hardware may flush out all the pending frames.  In case the clock
subsystem provides us a pixel clock with wrong rate and causes the
timeout value be unreasonably long, we truncate it to wait for at
most three seconds.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
drivers/gpu/drm/imx/dpu/dpu-crtc.c
drivers/gpu/imx/dpu/dpu-framegen.c
include/video/dpu.h