diff options
author | Mika Kuoppala <mika.kuoppala@linux.intel.com> | 2017-03-15 17:42:59 +0200 |
---|---|---|
committer | Mika Kuoppala <mika.kuoppala@intel.com> | 2017-03-16 12:28:28 +0200 |
commit | 135bafa551de3e7a8fff29e80a714b44d7dfd778 (patch) | |
tree | 2a6e8ea59765a47422076ba4d0aedfdf178d9d25 /drivers/gpu/drm/i915/i915_sysfs.c | |
parent | 15c344f4d0cbebd6215c94d2011863b4aa302a02 (diff) | |
download | linux-135bafa551de3e7a8fff29e80a714b44d7dfd778.tar.bz2 |
drm/i915: Move residency calculation into intel_pm.c
Plan is to make generic residency calculation utility
function for usage outside of sysfs. As a first step
move residency calculation into intel_pm.c
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_sysfs.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_sysfs.c | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c index af0ac9f261fd..ab723e3403d3 100644 --- a/drivers/gpu/drm/i915/i915_sysfs.c +++ b/drivers/gpu/drm/i915/i915_sysfs.c @@ -42,32 +42,7 @@ static inline struct drm_i915_private *kdev_minor_to_i915(struct device *kdev) static u32 calc_residency(struct drm_i915_private *dev_priv, i915_reg_t reg) { - u64 raw_time; /* 32b value may overflow during fixed point math */ - u64 units = 128ULL, div = 100000ULL; - u32 ret; - - if (!intel_enable_rc6()) - return 0; - - intel_runtime_pm_get(dev_priv); - - /* On VLV and CHV, residency time is in CZ units rather than 1.28us */ - if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { - units = 1; - div = dev_priv->czclk_freq; - - if (I915_READ(VLV_COUNTER_CONTROL) & VLV_COUNT_RANGE_HIGH) - units <<= 8; - } else if (IS_GEN9_LP(dev_priv)) { - units = 1; - div = 1200; /* 833.33ns */ - } - - raw_time = I915_READ(reg) * units; - ret = DIV_ROUND_UP_ULL(raw_time, div); - - intel_runtime_pm_put(dev_priv); - return ret; + return intel_rc6_residency(dev_priv, reg); } static ssize_t |