All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 6/9] drm/i915: make intel_ddi_get_cdclk_freq return values in KHz
Date: Fri,  3 May 2013 17:23:42 -0300	[thread overview]
Message-ID: <1367612625-4823-7-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1367612625-4823-1-git-send-email-przanoni@gmail.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

With this, that 338 can finally become the correct 337500.

Due to the change we need to adjust the intel_dp_aux_ch function to
set the correct value, so adjust the division and also use
DIV_ROUND_CLOSEST instead of the old "round down" behavior because the
spec says the value "should be programmed to get as close as possible
to the ideal rate of 2MHz".

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c |   10 +++++-----
 drivers/gpu/drm/i915/intel_dp.c  |    3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 21fb852..e5b1b63 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1335,14 +1335,14 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
 {
 	if (I915_READ(HSW_FUSE_STRAP) & HSW_CDCLK_LIMIT)
-		return 450;
+		return 450000;
 	else if ((I915_READ(LCPLL_CTL) & LCPLL_CLK_FREQ_MASK) ==
 		 LCPLL_CLK_FREQ_450)
-		return 450;
+		return 450000;
 	else if (IS_ULT(dev_priv->dev))
-		return 338;
+		return 337500;
 	else
-		return 540;
+		return 540000;
 }
 
 void intel_ddi_pll_init(struct drm_device *dev)
@@ -1355,7 +1355,7 @@ void intel_ddi_pll_init(struct drm_device *dev)
 	 * Don't even try to turn it on.
 	 */
 
-	DRM_DEBUG_KMS("CDCLK running at %dMHz\n",
+	DRM_DEBUG_KMS("CDCLK running at %dKHz\n",
 		      intel_ddi_get_cdclk_freq(dev_priv));
 
 	if (val & LCPLL_CD_SOURCE_FCLK)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index a293523..3df1383 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -346,7 +346,8 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
 	 */
 	if (is_cpu_edp(intel_dp)) {
 		if (HAS_DDI(dev))
-			aux_clock_divider = intel_ddi_get_cdclk_freq(dev_priv) >> 1;
+			aux_clock_divider = DIV_ROUND_CLOSEST(
+				intel_ddi_get_cdclk_freq(dev_priv), 2000);
 		else if (IS_VALLEYVIEW(dev))
 			aux_clock_divider = 100;
 		else if (IS_GEN6(dev) || IS_GEN7(dev))
-- 
1.7.10.4

  parent reply	other threads:[~2013-05-03 20:24 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03 20:23 [PATCH 0/9] Haswell watermarks, round 1 Paulo Zanoni
2013-05-03 20:23 ` [PATCH 1/9] drm/i915: ILK, SNB and IVB don't have linetime watermarks Paulo Zanoni
2013-05-20 13:41   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 2/9] drm/i915: fix linetime_watermarks code Paulo Zanoni
2013-05-05  7:19   ` Chris Wilson
2013-05-06 13:13     ` Paulo Zanoni
2013-05-06 13:43       ` Chris Wilson
2013-05-09 19:55         ` [PATCH 2/9] drm/i915: remove intel_update_linetime_watermarks Paulo Zanoni
2013-05-20 13:48           ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 3/9] drm/i915: use the mode->htotal to calculate linetime watermarks Paulo Zanoni
2013-05-20 13:42   ` Ville Syrjälä
2013-05-21  9:26   ` Daniel Vetter
2013-05-21 14:33     ` Paulo Zanoni
2013-05-21 14:59       ` Daniel Vetter
2013-05-03 20:23 ` [PATCH 4/9] drm/i915: fix haswell linetime watermarks calculation Paulo Zanoni
2013-05-20 13:53   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 5/9] drm/i915: use the correct clock when calculating linetime watermarks Paulo Zanoni
2013-05-20 14:00   ` Ville Syrjälä
2013-05-21  9:35   ` Daniel Vetter
2013-05-03 20:23 ` Paulo Zanoni [this message]
2013-05-05  7:20   ` [PATCH 6/9] drm/i915: make intel_ddi_get_cdclk_freq return values in KHz Chris Wilson
2013-05-06 13:53     ` Paulo Zanoni
2013-05-20 14:11   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 7/9] drm/i915: set the IPS linetime watermark Paulo Zanoni
2013-05-20 14:05   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 8/9] drm/i915: MCH_SSKPD is a 64 bit register on Haswell Paulo Zanoni
2013-05-20 13:38   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 9/9] drm/i915: set FORCE_ARB_IDLE_PLANES workaround Paulo Zanoni
2013-05-20 13:37   ` Ville Syrjälä
2013-05-21 10:01   ` Daniel Vetter
2013-05-21 13:27     ` Paulo Zanoni
2013-05-23 10:36       ` Ville Syrjälä
2013-05-23 10:51         ` Daniel Vetter

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=1367612625-4823-7-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@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.