[v7,21/23] drm/i915/icl: Wait for header/payload credits release

Submitted by Jani Nikula on Oct. 15, 2018, 2:28 p.m.

Details

Message ID 15cf8ea619676c4a1bb496daf58fd0fe61789c0a.1539613303.git.jani.nikula@intel.com
State New
Headers show
Series "drm/i915/icl: dsi enabling" ( rev: 2 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Jani Nikula Oct. 15, 2018, 2:28 p.m.
From: Madhav Chauhan <madhav.chauhan@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@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/icl_dsi.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Patch hide | download patch | download mbox

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)