From: Madhav Chauhan <madhav.chauhan@xxxxxxxxx> Driver needs payload/header credits for sending any command and data over DSI link. These credits are released once command or data sent to link. This patch adds functions to wait for releasing of payload and header credits. Signed-off-by: Madhav Chauhan <madhav.chauhan@xxxxxxxxx> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> --- drivers/gpu/drm/i915/icl_dsi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c index 0393fed98a6f..5fe024dfbdb0 100644 --- a/drivers/gpu/drm/i915/icl_dsi.c +++ b/drivers/gpu/drm/i915/icl_dsi.c @@ -28,6 +28,30 @@ #include <drm/drm_mipi_dsi.h> #include "intel_dsi.h" +static void __attribute__((unused)) wait_for_dsi_hdr_credit_release( + struct intel_dsi *intel_dsi, + enum transcoder dsi_trans) +{ + struct drm_i915_private *dev_priv = to_i915(intel_dsi->base.base.dev); + + if (wait_for_us(((I915_READ(DSI_CMD_TXCTL(dsi_trans)) & + FREE_HEADER_CREDIT_MASK) >> FREE_HEADER_CREDIT_SHIFT) + == MAX_HEADER_CREDIT, 100)) + DRM_ERROR("DSI header credits not released\n"); +} + +static void __attribute__((unused)) wait_for_dsi_payload_credit_release( + struct intel_dsi *intel_dsi, + enum transcoder dsi_trans) +{ + struct drm_i915_private *dev_priv = to_i915(intel_dsi->base.base.dev); + + if (wait_for_us((I915_READ(DSI_CMD_TXCTL(dsi_trans)) & + FREE_PLOAD_CREDIT_MASK) == MAX_PLOAD_CREDIT, + 100)) + DRM_ERROR("DSI payload credits not released\n"); +} + static enum transcoder dsi_port_to_transcoder(enum port port) { if (port == PORT_A) -- 2.11.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx