Re: [PATCH 06/13] drm/i915: Use skl_cdclk_decimal() on bxt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 11 May 2016, ville.syrjala@xxxxxxxxxxxxxxx wrote:
> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>
> Both SKL and BXT need to fill in the "decimal" cdclk frequency into
> the CDCLK_CTL register. SKL uses a small helper to do the kHz->"decimal"
> conversion, whereas BXT has it open-coded. Use the helper on BXT too.
>
> While at it, change it to round to closest rather than down. It doesn't
> actually matter with the frequencies we have to deal with, but it seems
> like the right thing to do.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx>

> ---
>  drivers/gpu/drm/i915/intel_display.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index fd55112f266d..9564719b53e3 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -5340,6 +5340,12 @@ static void intel_update_cdclk(struct drm_device *dev)
>  		intel_update_max_cdclk(dev);
>  }
>  
> +/* convert from kHz to .1 fixpoint MHz with -1MHz offset */
> +static int skl_cdclk_decimal(int cdclk)
> +{
> +	return DIV_ROUND_CLOSEST(cdclk - 1000, 500);
> +}
> +
>  static void broxton_set_cdclk(struct drm_i915_private *dev_priv, int frequency)
>  {
>  	uint32_t divider;
> @@ -5439,8 +5445,7 @@ static void broxton_set_cdclk(struct drm_i915_private *dev_priv, int frequency)
>  			val |= BXT_CDCLK_SSA_PRECHARGE_ENABLE;
>  
>  		val &= ~CDCLK_FREQ_DECIMAL_MASK;
> -		/* convert from kHz to .1 fixpoint MHz with -1MHz offset */
> -		val |= (frequency - 1000) / 500;
> +		val |= skl_cdclk_decimal(frequency);
>  		I915_WRITE(CDCLK_CTL, val);
>  	}
>  
> @@ -5540,11 +5545,6 @@ static const struct skl_cdclk_entry {
>  	{ .freq = 675000, .vco = 8100 },
>  };
>  
> -static unsigned int skl_cdclk_decimal(unsigned int freq)
> -{
> -	return (freq - 1000) / 500;
> -}
> -
>  static unsigned int skl_cdclk_get_vco(unsigned int freq)
>  {
>  	unsigned int i;

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux