From f783acad10b5a01ca8de5cacd944468373b835d7 Mon Sep 17 00:00:00 2001 From: Mika Kuoppala Date: Mon, 7 Jul 2014 18:45:15 +0300 Subject: [PATCH] i915/drm/chv: calculate rc6 residency correctly The register for cz count is different from vlv. Signed-off-by: Mika Kuoppala --- drivers/gpu/drm/i915/i915_reg.h | 2 +- drivers/gpu/drm/i915/i915_sysfs.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 8debe61..76420d4 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -2327,7 +2327,7 @@ enum punit_power_well { /* Same as Haswell, but 72064 bytes now. */ #define GEN8_CXT_TOTAL_SIZE (18 * PAGE_SIZE) - +#define CHV_CLK_CTL1 0x101100 #define VLV_CLK_CTL2 0x101104 #define CLK_CTL2_CZCOUNT_30NS_SHIFT 28 diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c index 86ce39a..6e520a4 100644 --- a/drivers/gpu/drm/i915/i915_sysfs.c +++ b/drivers/gpu/drm/i915/i915_sysfs.c @@ -51,8 +51,13 @@ static u32 calc_residency(struct drm_device *dev, const u32 reg) if (IS_VALLEYVIEW(dev)) { u32 clkctl2; - clkctl2 = I915_READ(VLV_CLK_CTL2) >> - CLK_CTL2_CZCOUNT_30NS_SHIFT; + if (IS_CHERRYVIEW(dev)) + clkctl2 = I915_READ(CHV_CLK_CTL1) >> + 28; + else + clkctl2 = I915_READ(VLV_CLK_CTL2) >> + CLK_CTL2_CZCOUNT_30NS_SHIFT; + if (!clkctl2) { WARN(!clkctl2, "bogus CZ count value"); ret = 0; -- 1.7.9.5