diff mbox series

[4/6] drm/i915/display: Embed the new struct steps for crawling

Message ID 20220917004404.414981-5-anusha.srivatsa@intel.com (mailing list archive)
State New, archived
Headers show
Series Introduce struct cdclk_step | expand

Commit Message

Srivatsa, Anusha Sept. 17, 2022, 12:44 a.m. UTC
Populate the new struct steps for crawl case.

Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
---
 drivers/gpu/drm/i915/display/intel_cdclk.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Jani Nikula Sept. 19, 2022, 9:28 a.m. UTC | #1
On Fri, 16 Sep 2022, Anusha Srivatsa <anusha.srivatsa@intel.com> wrote:
> Populate the new struct steps for crawl case.
>
> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_cdclk.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index d2e81134b6f2..bb5bbb1ad982 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -1951,8 +1951,9 @@ void intel_cdclk_uninit_hw(struct drm_i915_private *i915)
>  
>  static bool intel_cdclk_can_crawl(struct drm_i915_private *dev_priv,
>  				  const struct intel_cdclk_config *a,
> -				  const struct intel_cdclk_config *b)
> +				  struct intel_cdclk_config *b)

Same here, why are you dropping const?

>  {
> +	struct cdclk_step *cdclk_transition = b->steps;

Same here about naming.

>  	int a_div, b_div;
>  
>  	if (!HAS_CDCLK_CRAWL(dev_priv))
> @@ -1965,6 +1966,12 @@ static bool intel_cdclk_can_crawl(struct drm_i915_private *dev_priv,
>  	a_div = DIV_ROUND_CLOSEST(a->vco, a->cdclk);
>  	b_div = DIV_ROUND_CLOSEST(b->vco, b->cdclk);
>  
> +	if (a->vco != 0 && b->vco != 0 && a->vco != b->vco &&
> +	    a_div == b_div && a->ref == b->ref) {
> +		cdclk_transition->action = CDCLK_CRAWL_ONLY;
> +		cdclk_transition->cdclk = b->cdclk;
> +	}
> +
>  	return a->vco != 0 && b->vco != 0 &&
>  		a->vco != b->vco &&
>  		a_div == b_div &&
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
index d2e81134b6f2..bb5bbb1ad982 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -1951,8 +1951,9 @@  void intel_cdclk_uninit_hw(struct drm_i915_private *i915)
 
 static bool intel_cdclk_can_crawl(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;
 	int a_div, b_div;
 
 	if (!HAS_CDCLK_CRAWL(dev_priv))
@@ -1965,6 +1966,12 @@  static bool intel_cdclk_can_crawl(struct drm_i915_private *dev_priv,
 	a_div = DIV_ROUND_CLOSEST(a->vco, a->cdclk);
 	b_div = DIV_ROUND_CLOSEST(b->vco, b->cdclk);
 
+	if (a->vco != 0 && b->vco != 0 && a->vco != b->vco &&
+	    a_div == b_div && a->ref == b->ref) {
+		cdclk_transition->action = CDCLK_CRAWL_ONLY;
+		cdclk_transition->cdclk = b->cdclk;
+	}
+
 	return a->vco != 0 && b->vco != 0 &&
 		a->vco != b->vco &&
 		a_div == b_div &&