From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/3] drm/i915/vlv: update czclk freq if needed for high bandwidth modes
Date: Mon, 28 Oct 2013 13:46:39 -0700 [thread overview]
Message-ID: <1382993199-19121-3-git-send-email-jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <1382993199-19121-1-git-send-email-jbarnes@virtuousgeek.org>
Needed to support large panel resolutions.
Tested-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
drivers/gpu/drm/i915/i915_reg.h | 2 ++
drivers/gpu/drm/i915/intel_display.c | 64 ++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 6a6eb8b..89109c4 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -1447,6 +1447,8 @@
#define CZCLK_FREQ_MASK 0xf
#define GMBUSFREQ_VLV (VLV_DISPLAY_BASE + 0x6510)
+#define CZCLK_CDCLK_FREQ_RATIO (VLV_DISPLAY_BASE + 0x6508)
+
/*
* Palette regs
*/
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 152d6a8..1bf811a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3851,6 +3851,67 @@ static void i9xx_pfit_enable(struct intel_crtc *crtc)
I915_WRITE(BCLRPAT(crtc->pipe), 0);
}
+static void valleyview_adjust_czclk(struct drm_device *dev, bool up)
+{
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ u32 val, divider;
+
+ switch (dev_priv->mem_freq) {
+ default:
+ case 800:
+ if (up)
+ divider = 3;
+ else
+ divider = 4;
+ break;
+ case 1066:
+ if (up)
+ divider = 7;
+ else
+ divider = 9;
+ break;
+ case 1333:
+ if (up)
+ divider = 9;
+ else
+ divider = 11;
+ break;
+ }
+
+ /* adjust czclk ratio */
+ mutex_lock(&dev_priv->dpio_lock);
+ val = vlv_cck_read(dev_priv, 0x6b);
+ val &= ~0xf;
+ val |= divider;
+ vlv_cck_write(dev_priv, 0x6b, val);
+
+ /* adjust self-refresh exit latency value */
+ val = vlv_bunit_read(dev_priv, 0x11);
+ val &= ~0x7f;
+ if (up)
+ val |= 0x12;
+ else
+ val |= 0xc;
+ vlv_bunit_write(dev_priv, 0x11, val);
+ mutex_unlock(&dev_priv->dpio_lock);
+}
+
+static void valleyview_modeset_global_resources(struct drm_device *dev)
+{
+ struct intel_crtc *crtc;
+ bool need_czclk_increase = false;
+
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) {
+ if (!crtc->base.enabled)
+ continue;
+
+ if (crtc->config.adjusted_mode.clock >= 3600)
+ need_czclk_increase = true;
+ }
+
+ valleyview_adjust_czclk(dev, need_czclk_increase);
+}
+
static void valleyview_crtc_enable(struct drm_crtc *crtc)
{
struct drm_device *dev = crtc->dev;
@@ -10218,6 +10279,9 @@ static void intel_init_display(struct drm_device *dev)
}
} else if (IS_G4X(dev)) {
dev_priv->display.write_eld = g4x_write_eld;
+ } else if (IS_VALLEYVIEW(dev)) {
+ dev_priv->display.modeset_global_resources =
+ valleyview_modeset_global_resources;
}
/* Default just returns -ENODEV to indicate unsupported */
--
1.8.3.1
next prev parent reply other threads:[~2013-10-28 20:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-28 20:46 [PATCH 1/3] drm/i915: add bunit read/write routines Jesse Barnes
2013-10-28 20:46 ` [PATCH 2/3] drm/i915: move VLV DDR freq fetch into init_clock_gating Jesse Barnes
2013-10-28 20:46 ` Jesse Barnes [this message]
2013-10-29 7:37 ` [PATCH 3/3] drm/i915/vlv: update czclk freq if needed for high bandwidth modes Daniel Vetter
-- strict thread matches above, loose matches on Subject: below --
2013-10-28 18:14 [PATCH 1/3] drm/i915: add bunit read/write routines Jesse Barnes
2013-10-28 18:14 ` [PATCH 3/3] drm/i915/vlv: update czclk freq if needed for high bandwidth modes Jesse Barnes
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=1382993199-19121-3-git-send-email-jbarnes@virtuousgeek.org \
--to=jbarnes@virtuousgeek.org \
--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 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).