[PATCH 5/5] drm/i915/display: Plug squash to cdclk atomic changes

Anusha Srivatsa anusha.srivatsa at intel.com
Wed Aug 31 17:54:34 UTC 2022


Signed-off-by: Anusha Srivatsa <anusha.srivatsa at intel.com>
---
 drivers/gpu/drm/i915/display/intel_cdclk.c | 12 ++++++++++--
 drivers/gpu/drm/i915/display/intel_cdclk.h | 16 ++++++++--------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
index 6126babbd926..dfc8a1d9b92f 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -1709,6 +1709,7 @@ static void bxt_set_cdclk(struct drm_i915_private *i915,
 			  const struct intel_cdclk_config *cdclk_config,
 			  enum pipe pipe)
 {
+	enum cdclk_sequence cdclk_transition = cdclk_config->steps->action;
 	int cdclk = cdclk_config->cdclk;
 	int vco = cdclk_config->vco;
 	u32 val;
@@ -1763,7 +1764,7 @@ static void bxt_set_cdclk(struct drm_i915_private *i915,
 	else
 		clock = cdclk;
 
-	if (has_cdclk_squasher(i915))
+	if (cdclk_transition == CDCLK_SQUASH_ONLY)
 		dg2_prog_squash_ctl(i915, waveform);
 
 	val = bxt_cdclk_cd2x_div_sel(i915, clock, vco) |
@@ -1977,8 +1978,9 @@ static bool intel_cdclk_can_crawl(struct drm_i915_private *dev_priv,
 
 static bool intel_cdclk_can_squash(struct drm_i915_private *dev_priv,
 				   const struct intel_cdclk_config *a,
-				   const struct intel_cdclk_config *b)
+				   struct intel_cdclk_config *b)
 {
+	struct cdclk_step *cdclk_transition = b->steps;
 	/*
 	 * FIXME should store a bit more state in intel_cdclk_config
 	 * to differentiate squasher vs. cd2x divider properly. For
@@ -1988,6 +1990,12 @@ static bool intel_cdclk_can_squash(struct drm_i915_private *dev_priv,
 	if (!has_cdclk_squasher(dev_priv))
 		return false;
 
+	if (a->cdclk != b->cdclk && a->vco != 0 &&
+	    a->vco == b->vco &&	a->ref == b->ref) {
+		cdclk_transition->action = CDCLK_SQUASH_ONLY;
+		cdclk_transition->cdclk = b->cdclk;
+	}
+
 	return a->cdclk != b->cdclk &&
 		a->vco != 0 &&
 		a->vco == b->vco &&
diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.h b/drivers/gpu/drm/i915/display/intel_cdclk.h
index 1edd105a0840..3869f93e8ad2 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.h
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.h
@@ -17,6 +17,14 @@ struct drm_i915_private;
 struct intel_atomic_state;
 struct intel_crtc_state;
 
+enum cdclk_sequence {
+	CDCLK_INVALID_ACTION = -1,
+
+	CDCLK_SQUASH_ONLY = 0,
+	CDCLK_CRAWL_ONLY,
+	CDCLK_LEGACY,
+};
+
 struct intel_cdclk_config {
 	unsigned int cdclk, vco, ref, bypass;
 	u8 voltage_level;
@@ -26,14 +34,6 @@ struct intel_cdclk_config {
 	} steps[MAX_CDCLK_ACTIONS];
 };
 
-enum cdclk_sequence {
-	CDCLK_INVALID_ACTION = -1,
-
-	CDCLK_SQUASH_ONLY = 0,
-	CDCLK_CRAWL_ONLY,
-	CDCLK_LEGACY,
-};
-
 struct intel_cdclk_state {
 	struct intel_global_state base;
 
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list