All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/icl: use ranges for voltage level lookup
Date: Fri, 7 Jun 2019 15:26:15 +0300	[thread overview]
Message-ID: <20190607122615.GX5942@intel.com> (raw)
In-Reply-To: <20190607034919.16557-1-lucas.demarchi@intel.com>

On Thu, Jun 06, 2019 at 08:49:19PM -0700, Lucas De Marchi wrote:
> Spec shows voltage level 0 as 307.2, 312, or lower and suggests to use
> range checks. Prepare for having other frequencies in these ranges by
> not comparing the exact frequency.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_cdclk.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_cdclk.c b/drivers/gpu/drm/i915/intel_cdclk.c
> index 6988c6cbc362..b175a2926caf 100644
> --- a/drivers/gpu/drm/i915/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/intel_cdclk.c
> @@ -1865,21 +1865,18 @@ static void icl_set_cdclk(struct drm_i915_private *dev_priv,
>  
>  static u8 icl_calc_voltage_level(int cdclk)
>  {
> -	switch (cdclk) {
> -	case 50000:
> -	case 307200:
> -	case 312000:
> +	if (cdclk <= 312000)
>  		return 0;
> -	case 556800:
> -	case 552000:
> +
> +	if (cdclk <= 556800)
>  		return 1;
> -	default:
> -		MISSING_CASE(cdclk);
> -		/* fall through */
> -	case 652800:
> -	case 648000:
> +
> +	if (cdclk <= 652800)
>  		return 2;
> -	}
> +
> +	MISSING_CASE(cdclk);
> +
> +	return 2;

Every other function in the same file does it the other way around.
Would be nice to keep it consistent.

if (cdclk > big)
	return a;
else if (cdclk > notsobig)
	return b;
else
	return c;


>  }
>  
>  static void icl_get_cdclk(struct drm_i915_private *dev_priv,
> -- 
> 2.21.0

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-06-07 12:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-07  3:49 [PATCH] drm/i915/icl: use ranges for voltage level lookup Lucas De Marchi
2019-06-07  4:34 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-06-07 12:26 ` Ville Syrjälä [this message]
2019-06-09 10:25 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190607122615.GX5942@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.