aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkash Goel <akash.goel@intel.com>2015-02-26 05:39:47 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-02-26 08:29:21 -0500
commitbc4d91f699d8529682be34e9f61be87679982f9b (patch)
tree29a84c24658b797866e82b55e07b7f1cc65cd771
parentb4f2bf4c02b27f31e68cbd00fa7ef868061ac2eb (diff)
drm/i915: Removed the read of RP_STATE_CAP from sysfs/debugfs functions
The frequency values(Rp0, Rp1, Rpn) reported by RP_STATE_CAP register are stored, initially by the Driver, inside the dev_priv->rps structure. Since these values are expected to remain same throughout, there is no real need to read this register, on dynamic basis, from certain debugfs/sysfs functions and the values can be instead retrieved from the dev_priv->rps structure when needed. For the i915_frequency_info debugfs interface, the frequency values from the RP_STATE_CAP register only should be used, to indicate the actual Hw state, since it is principally used for the debugging purpose. v2: Reverted the changes in i915_frequency_info function, to continue report back the frequency values, as per the actual Hw state (Chris) Signed-off-by: Akash Goel <akash.goel@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c32
-rw-r--r--drivers/gpu/drm/i915/i915_sysfs.c39
2 files changed, 17 insertions, 54 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 843b471090f3..81e27d417130 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -4180,7 +4180,7 @@ i915_max_freq_set(void *data, u64 val)
4180{ 4180{
4181 struct drm_device *dev = data; 4181 struct drm_device *dev = data;
4182 struct drm_i915_private *dev_priv = dev->dev_private; 4182 struct drm_i915_private *dev_priv = dev->dev_private;
4183 u32 rp_state_cap, hw_max, hw_min; 4183 u32 hw_max, hw_min;
4184 int ret; 4184 int ret;
4185 4185
4186 if (INTEL_INFO(dev)->gen < 6) 4186 if (INTEL_INFO(dev)->gen < 6)
@@ -4197,18 +4197,10 @@ i915_max_freq_set(void *data, u64 val)
4197 /* 4197 /*
4198 * Turbo will still be enabled, but won't go above the set value. 4198 * Turbo will still be enabled, but won't go above the set value.
4199 */ 4199 */
4200 if (IS_VALLEYVIEW(dev)) { 4200 val = intel_freq_opcode(dev_priv, val);
4201 val = intel_freq_opcode(dev_priv, val);
4202 4201
4203 hw_max = dev_priv->rps.max_freq; 4202 hw_max = dev_priv->rps.max_freq;
4204 hw_min = dev_priv->rps.min_freq; 4203 hw_min = dev_priv->rps.min_freq;
4205 } else {
4206 val = intel_freq_opcode(dev_priv, val);
4207
4208 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
4209 hw_max = dev_priv->rps.max_freq;
4210 hw_min = (rp_state_cap >> 16) & 0xff;
4211 }
4212 4204
4213 if (val < hw_min || val > hw_max || val < dev_priv->rps.min_freq_softlimit) { 4205 if (val < hw_min || val > hw_max || val < dev_priv->rps.min_freq_softlimit) {
4214 mutex_unlock(&dev_priv->rps.hw_lock); 4206 mutex_unlock(&dev_priv->rps.hw_lock);
@@ -4255,7 +4247,7 @@ i915_min_freq_set(void *data, u64 val)
4255{ 4247{
4256 struct drm_device *dev = data; 4248 struct drm_device *dev = data;
4257 struct drm_i915_private *dev_priv = dev->dev_private; 4249 struct drm_i915_private *dev_priv = dev->dev_private;
4258 u32 rp_state_cap, hw_max, hw_min; 4250 u32 hw_max, hw_min;
4259 int ret; 4251 int ret;
4260 4252
4261 if (INTEL_INFO(dev)->gen < 6) 4253 if (INTEL_INFO(dev)->gen < 6)
@@ -4272,18 +4264,10 @@ i915_min_freq_set(void *data, u64 val)
4272 /* 4264 /*
4273 * Turbo will still be enabled, but won't go below the set value. 4265 * Turbo will still be enabled, but won't go below the set value.
4274 */ 4266 */
4275 if (IS_VALLEYVIEW(dev)) { 4267 val = intel_freq_opcode(dev_priv, val);
4276 val = intel_freq_opcode(dev_priv, val);
4277 4268
4278 hw_max = dev_priv->rps.max_freq; 4269 hw_max = dev_priv->rps.max_freq;
4279 hw_min = dev_priv->rps.min_freq; 4270 hw_min = dev_priv->rps.min_freq;
4280 } else {
4281 val = intel_freq_opcode(dev_priv, val);
4282
4283 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
4284 hw_max = dev_priv->rps.max_freq;
4285 hw_min = (rp_state_cap >> 16) & 0xff;
4286 }
4287 4271
4288 if (val < hw_min || val > hw_max || val > dev_priv->rps.max_freq_softlimit) { 4272 if (val < hw_min || val > hw_max || val > dev_priv->rps.max_freq_softlimit) {
4289 mutex_unlock(&dev_priv->rps.hw_lock); 4273 mutex_unlock(&dev_priv->rps.hw_lock);
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index cdc9da001484..186ab95056b0 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -487,38 +487,17 @@ static ssize_t gt_rp_mhz_show(struct device *kdev, struct device_attribute *attr
487 struct drm_minor *minor = dev_to_drm_minor(kdev); 487 struct drm_minor *minor = dev_to_drm_minor(kdev);
488 struct drm_device *dev = minor->dev; 488 struct drm_device *dev = minor->dev;
489 struct drm_i915_private *dev_priv = dev->dev_private; 489 struct drm_i915_private *dev_priv = dev->dev_private;
490 u32 val, rp_state_cap; 490 u32 val;
491 ssize_t ret;
492
493 ret = mutex_lock_interruptible(&dev->struct_mutex);
494 if (ret)
495 return ret;
496 intel_runtime_pm_get(dev_priv);
497 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
498 intel_runtime_pm_put(dev_priv);
499 mutex_unlock(&dev->struct_mutex);
500 491
501 if (attr == &dev_attr_gt_RP0_freq_mhz) { 492 if (attr == &dev_attr_gt_RP0_freq_mhz)
502 if (IS_VALLEYVIEW(dev)) 493 val = intel_gpu_freq(dev_priv, dev_priv->rps.rp0_freq);
503 val = intel_gpu_freq(dev_priv, dev_priv->rps.rp0_freq); 494 else if (attr == &dev_attr_gt_RP1_freq_mhz)
504 else 495 val = intel_gpu_freq(dev_priv, dev_priv->rps.rp1_freq);
505 val = intel_gpu_freq(dev_priv, 496 else if (attr == &dev_attr_gt_RPn_freq_mhz)
506 ((rp_state_cap & 0x0000ff) >> 0)); 497 val = intel_gpu_freq(dev_priv, dev_priv->rps.min_freq);
507 } else if (attr == &dev_attr_gt_RP1_freq_mhz) { 498 else
508 if (IS_VALLEYVIEW(dev))
509 val = intel_gpu_freq(dev_priv, dev_priv->rps.rp1_freq);
510 else
511 val = intel_gpu_freq(dev_priv,
512 ((rp_state_cap & 0x00ff00) >> 8));
513 } else if (attr == &dev_attr_gt_RPn_freq_mhz) {
514 if (IS_VALLEYVIEW(dev))
515 val = intel_gpu_freq(dev_priv, dev_priv->rps.min_freq);
516 else
517 val = intel_gpu_freq(dev_priv,
518 ((rp_state_cap & 0xff0000) >> 16));
519 } else {
520 BUG(); 499 BUG();
521 } 500
522 return snprintf(buf, PAGE_SIZE, "%d\n", val); 501 return snprintf(buf, PAGE_SIZE, "%d\n", val);
523} 502}
524 503