diff mbox series

drm/i915/dsi: Get trail_cnt by division of tclk_trail_ns and tlpx_ns

Message ID 20211228072603.15347-1-william.tseng@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/dsi: Get trail_cnt by division of tclk_trail_ns and tlpx_ns | expand

Commit Message

William Tseng Dec. 28, 2021, 7:26 a.m. UTC
This change is to avoid over-specification of the TEOT timing
parameter, which is derived from calculating the value of
trail_cnt.  It is used to configure the dphy timing, CLK_TRAIL
for clock lane and HS_TRAIL for data lane (refer to the bspec
dphy timing).

trail_cnt is derived from DIV_ROUND_UP calculation but it may
cause TEOT parameter is larger than the maximum allowed value.

This is an example in the case of data lane dphy timing.
Supposed that TCLK-TRAIL, THS-TRAIL and THS-EXIT have the
minimum values, i.e., 60, 60 and 100 in ns. If SW is
overriding the HW default, the TEOT value becomes 150 ns,
approximately calculated by the following formula.

  tclk_trail_ns = max(60, 60)
  trail_cnt = DIV_ROUND_UP(tclk_trail_ns, 50)
  trail_cnt*50 + DIV_ROUND_UP(100, 50)*50/2,

where 50 is LP Escape Clock time in ns (i.e., tlpx_ns).

The TEOT value 150 ns is larger than the maximum value,
around 136 ns if UI is 1.8ns, (105 ns + 12*UI, defined by MIPI
DPHY specification).

However, the TEOT value will meet the specification if trail_cnt
is derived by the division of tclk_trail_ns and tlpx_ns.

The timing change is made for both data lane and clock lane.

Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Vandita Kulkarni <vandita.kulkarni@intel.com>
Cc: Lee Shawn C <shawn.c.lee@intel.com>
Cc: Cooper Chiou <cooper.chiou@intel.com>
Signed-off-by: William Tseng <william.tseng@intel.com>
---
 drivers/gpu/drm/i915/display/icl_dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c
index 71fbdcddd31f..5806c1fc2b97 100644
--- a/drivers/gpu/drm/i915/display/icl_dsi.c
+++ b/drivers/gpu/drm/i915/display/icl_dsi.c
@@ -1893,7 +1893,7 @@  static void icl_dphy_param_init(struct intel_dsi *intel_dsi)
 	}
 
 	/* trail cnt in escape clocks*/
-	trail_cnt = DIV_ROUND_UP(tclk_trail_ns, tlpx_ns);
+	trail_cnt = tclk_trail_ns > tlpx_ns ? tclk_trail_ns / tlpx_ns : 1;
 	if (trail_cnt > ICL_TRAIL_CNT_MAX) {
 		drm_dbg_kms(&dev_priv->drm, "trail_cnt out of range (%d)\n",
 			    trail_cnt);