[Intel-gfx] [PATCH v7 21/23] drm/i915/icl: Wait for header/payload credits release

Jani Nikula jani.nikula at intel.com
Mon Oct 15 14:28:09 UTC 2018


From: Madhav Chauhan <madhav.chauhan at intel.com>

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 at intel.com>
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 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



More information about the Intel-gfx mailing list