All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kahola <mika.kahola@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v6 1/8] drm/i915: Cache current cdclk frequency in dev_priv
Date: Wed,  3 Jun 2015 15:45:07 +0300	[thread overview]
Message-ID: <1433335514-4156-2-git-send-email-mika.kahola@intel.com> (raw)
In-Reply-To: <1433335514-4156-1-git-send-email-mika.kahola@intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Rather that extracting the current cdclk freuqncy every time someone
wants to know it, cache the current value and use that. VLV/CHV already
stored a cached value there so just expand that to cover all platforms.

v2: Rebased to the latest
v3: Rebased to the latest
v4: Rebased to the latest
v5: Removed spurious call to 'intel_update_cdclk(dev)' based on
    Damien Lespiau's comment

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>

Author:    Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 16e159d..9cf1553 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5747,7 +5747,7 @@ static int valleyview_get_vco(struct drm_i915_private *dev_priv)
 	return vco_freq[hpll_freq] * 1000;
 }
 
-static void vlv_update_cdclk(struct drm_device *dev)
+static void intel_update_cdclk(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
@@ -5760,7 +5760,14 @@ static void vlv_update_cdclk(struct drm_device *dev)
 	 * BSpec erroneously claims we should aim for 4MHz, but
 	 * in fact 1MHz is the correct frequency.
 	 */
-	I915_WRITE(GMBUSFREQ_VLV, DIV_ROUND_UP(dev_priv->cdclk_freq, 1000));
+	if (IS_VALLEYVIEW(dev)) {
+		/*
+		 * Program the gmbus_freq based on the cdclk frequency.
+		 * BSpec erroneously claims we should aim for 4MHz, but
+		 * in fact 1MHz is the correct frequency.
+		 */
+		I915_WRITE(GMBUSFREQ_VLV, DIV_ROUND_UP(dev_priv->cdclk_freq, 1000));
+	}
 }
 
 /* Adjust CDclk dividers to allow high res or save power if possible */
@@ -5826,7 +5833,7 @@ static void valleyview_set_cdclk(struct drm_device *dev, int cdclk)
 
 	mutex_unlock(&dev_priv->sb_lock);
 
-	vlv_update_cdclk(dev);
+	intel_update_cdclk(dev);
 }
 
 static void cherryview_set_cdclk(struct drm_device *dev, int cdclk)
@@ -5867,7 +5874,7 @@ static void cherryview_set_cdclk(struct drm_device *dev, int cdclk)
 	}
 	mutex_unlock(&dev_priv->rps.hw_lock);
 
-	vlv_update_cdclk(dev);
+	intel_update_cdclk(dev);
 }
 
 static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv,
@@ -9479,6 +9486,7 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv)
 	}
 
 	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
+	intel_update_cdclk(dev_priv->dev);
 }
 
 /*
@@ -13273,6 +13281,8 @@ static void intel_shared_dpll_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
+	intel_update_cdclk(dev);
+
 	if (HAS_DDI(dev))
 		intel_ddi_pll_init(dev);
 	else if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
@@ -14848,13 +14858,9 @@ static void i915_disable_vga(struct drm_device *dev)
 
 void intel_modeset_init_hw(struct drm_device *dev)
 {
+	intel_update_cdclk(dev);
 	intel_prepare_ddi(dev);
-
-	if (IS_VALLEYVIEW(dev))
-		vlv_update_cdclk(dev);
-
 	intel_init_clock_gating(dev);
-
 	intel_enable_gt_powersave(dev);
 }
 
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-06-03 12:44 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-03 12:45 [PATCH v6 0/8] All sort of cdclk stuff Mika Kahola
2015-06-03 12:45 ` Mika Kahola [this message]
2015-06-03 12:45 ` [PATCH v6 2/8] drm/i915: Use cached cdclk value Mika Kahola
2015-06-15 11:54   ` Daniel Vetter
2015-06-15 12:14     ` Damien Lespiau
2015-06-15 12:40       ` Tvrtko Ursulin
2015-06-15 13:09         ` Damien Lespiau
2015-06-15 13:38           ` Tvrtko Ursulin
2015-06-15 12:21     ` Kahola, Mika
2015-06-15 13:05       ` Daniel Vetter
2015-06-15 13:15         ` Damien Lespiau
2015-06-15 21:24           ` Konduru, Chandra
2015-06-03 12:45 ` [PATCH v6 3/8] drm/i915: Unify ilk and hsw .get_aux_clock_divider Mika Kahola
2015-06-04 13:24   ` Jani Nikula
2015-06-04 15:17     ` Ville Syrjälä
2015-06-05  7:58       ` Jani Nikula
2015-06-03 12:45 ` [PATCH v6 4/8] drm/i915: Store max cdclk value in dev_priv Mika Kahola
2015-06-03 12:45 ` [PATCH v6 5/8] drm/i915: Don't enable IPS when pixel rate exceeds 95% Mika Kahola
2015-06-03 12:45 ` [PATCH v6 6/8] drm/i915: Add IS_BDW_ULX Mika Kahola
2015-06-03 12:45 ` [PATCH v6 7/8] drm/i915: BDW clock change support Mika Kahola
2015-06-16 13:01   ` Jani Nikula
2015-06-16 13:07     ` Jani Nikula
2015-06-29 11:24       ` Jani Nikula
2015-06-29 11:36         ` Mika Kahola
2015-06-29 11:42           ` Jani Nikula
2015-06-29 11:46             ` Ville Syrjälä
2015-06-29 15:52               ` Daniel Vetter
2015-10-06 10:13       ` [PATCH v6 7/8] drm/i915: BDW clock change support [regression] Daniel Vetter
2015-06-03 12:45 ` [PATCH v6 8/8] drm/i915: HSW cdclk support Mika Kahola
2015-06-04  7:51   ` shuang.he
2015-06-04 13:26   ` Jani Nikula
2015-06-04 12:26 ` [PATCH v6 0/8] All sort of cdclk stuff Damien Lespiau
2015-06-04 13:28   ` Jani Nikula

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=1433335514-4156-2-git-send-email-mika.kahola@intel.com \
    --to=mika.kahola@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.