intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 09/12] drm/i915/cdclk: use i9xx_fsb_freq() for rawclk_freq initialization
Date: Wed, 5 Jun 2024 13:31:53 +0300	[thread overview]
Message-ID: <ZmA-mcwUW7r50rIT@intel.com> (raw)
In-Reply-To: <83e668584c898e445552275a09cc4fa55d68f62a.1716906179.git.jani.nikula@intel.com>

On Tue, May 28, 2024 at 05:24:58PM +0300, Jani Nikula wrote:
> Instead of duplicating the CLKCFG parsing, reuse i9xx_fsb_freq() to
> figure out rawclk_freq where applicable.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_cdclk.c | 46 ++--------------------
>  1 file changed, 3 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index b78154c82a71..c731c489c925 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -23,6 +23,7 @@
>  
>  #include <linux/time.h>
>  
> +#include "soc/intel_dram.h"
>  #include "hsw_ips.h"
>  #include "i915_reg.h"
>  #include "intel_atomic.h"
> @@ -3529,10 +3530,8 @@ static int vlv_hrawclk(struct drm_i915_private *dev_priv)
>  				      CCK_DISPLAY_REF_CLOCK_CONTROL);
>  }
>  
> -static int i9xx_hrawclk(struct drm_i915_private *dev_priv)
> +static int i9xx_hrawclk(struct drm_i915_private *i915)
>  {
> -	u32 clkcfg;
> -
>  	/*
>  	 * hrawclock is 1/4 the FSB frequency
>  	 *
> @@ -3543,46 +3542,7 @@ static int i9xx_hrawclk(struct drm_i915_private *dev_priv)
>  	 * don't know which registers have that information,
>  	 * and all the relevant docs have gone to bit heaven :(
>  	 */

^ the note about the actual clock vs. straps should probably be moved
into i9xx_fsb_freq() as a followup.

> -	clkcfg = intel_de_read(dev_priv, CLKCFG) & CLKCFG_FSB_MASK;
> -
> -	if (IS_MOBILE(dev_priv)) {
> -		switch (clkcfg) {
> -		case CLKCFG_FSB_400:
> -			return 100000;
> -		case CLKCFG_FSB_533:
> -			return 133333;
> -		case CLKCFG_FSB_667:
> -			return 166667;
> -		case CLKCFG_FSB_800:
> -			return 200000;
> -		case CLKCFG_FSB_1067:
> -			return 266667;
> -		case CLKCFG_FSB_1333:
> -			return 333333;
> -		default:
> -			MISSING_CASE(clkcfg);
> -			return 133333;
> -		}
> -	} else {
> -		switch (clkcfg) {
> -		case CLKCFG_FSB_400_ALT:
> -			return 100000;
> -		case CLKCFG_FSB_533:
> -			return 133333;
> -		case CLKCFG_FSB_667:
> -			return 166667;
> -		case CLKCFG_FSB_800:
> -			return 200000;
> -		case CLKCFG_FSB_1067_ALT:
> -			return 266667;
> -		case CLKCFG_FSB_1333_ALT:
> -			return 333333;
> -		case CLKCFG_FSB_1600_ALT:
> -			return 400000;
> -		default:
> -			return 133333;
> -		}
> -	}
> +	return DIV_ROUND_CLOSEST(i9xx_fsb_freq(i915), 4);
>  }
>  
>  /**
> -- 
> 2.39.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2024-06-05 10:31 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28 14:24 [PATCH 00/12] drm/i915: mem/fsb/rawclk freq cleanups Jani Nikula
2024-05-28 14:24 ` [PATCH 01/12] drm/i915/wm: rename intel_get_cxsr_latency -> pnv_get_cxsr_latency Jani Nikula
2024-05-29 20:53   ` Matt Roper
2024-05-28 14:24 ` [PATCH 02/12] drm/i915/wm: clarify logging on not finding CxSR latency config Jani Nikula
2024-05-29 21:00   ` Matt Roper
2024-05-30  6:59     ` Jani Nikula
2024-05-28 14:24 ` [PATCH 03/12] drm/i915/dram: separate fsb freq detection from mem freq Jani Nikula
2024-05-29 21:08   ` Matt Roper
2024-05-28 14:24 ` [PATCH 04/12] drm/i915/dram: split out pnv DDR3 detection Jani Nikula
2024-05-29 21:12   ` Matt Roper
2024-05-28 14:24 ` [PATCH 05/12] drm/i915/dram: rearrange mem freq init Jani Nikula
2024-05-29 21:13   ` Matt Roper
2024-05-28 14:24 ` [PATCH 06/12] drm/i915: convert fsb_freq and mem_freq to kHz Jani Nikula
2024-05-29 21:16   ` Matt Roper
2024-05-30  7:01     ` Jani Nikula
2024-06-05 10:12   ` Ville Syrjälä
2024-06-05 12:42     ` Jani Nikula
2024-05-28 14:24 ` [PATCH 07/12] drm/i915: extend the fsb_freq initialization to more platforms Jani Nikula
2024-05-29 21:39   ` Matt Roper
2024-05-30  7:14     ` Jani Nikula
2024-06-04 11:46       ` Jani Nikula
2024-06-05 10:18         ` Ville Syrjälä
2024-06-05 10:24   ` Ville Syrjälä
2024-06-06 10:37     ` Jani Nikula
2024-05-28 14:24 ` [PATCH 08/12] drm/i915: use i9xx_fsb_freq() for GT clock frequency Jani Nikula
2024-05-28 14:24 ` [PATCH 09/12] drm/i915/cdclk: use i9xx_fsb_freq() for rawclk_freq initialization Jani Nikula
2024-06-05 10:31   ` Ville Syrjälä [this message]
2024-05-28 14:24 ` [PATCH 10/12] drm/i915: move rawclk init to intel_cdclk_init() Jani Nikula
2024-05-29 10:26   ` Jani Nikula
2024-05-28 14:25 ` [PATCH 11/12] drm/i915: move rawclk from runtime to display runtime info Jani Nikula
2024-05-28 14:25 ` [PATCH 12/12] drm/xe/display: drop unused rawclk_freq and RUNTIME_INFO() Jani Nikula
2024-05-28 16:22 ` ✗ Fi.CI.SPARSE: warning for drm/i915: mem/fsb/rawclk freq cleanups Patchwork
2024-05-28 16:30 ` ✓ Fi.CI.BAT: success " Patchwork
2024-05-29 10:08 ` ✗ Fi.CI.IGT: failure " 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=ZmA-mcwUW7r50rIT@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).