aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c10
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h3
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c5
-rw-r--r--drivers/gpu/drm/i915/i915_sysfs.c10
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c53
5 files changed, 34 insertions, 47 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 211d4949a675..9af17fb4f8dc 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -4214,10 +4214,7 @@ i915_max_freq_set(void *data, u64 val)
4214 4214
4215 dev_priv->rps.max_freq_softlimit = val; 4215 dev_priv->rps.max_freq_softlimit = val;
4216 4216
4217 if (IS_VALLEYVIEW(dev)) 4217 intel_set_rps(dev, val);
4218 valleyview_set_rps(dev, val);
4219 else
4220 gen6_set_rps(dev, val);
4221 4218
4222 mutex_unlock(&dev_priv->rps.hw_lock); 4219 mutex_unlock(&dev_priv->rps.hw_lock);
4223 4220
@@ -4292,10 +4289,7 @@ i915_min_freq_set(void *data, u64 val)
4292 4289
4293 dev_priv->rps.min_freq_softlimit = val; 4290 dev_priv->rps.min_freq_softlimit = val;
4294 4291
4295 if (IS_VALLEYVIEW(dev)) 4292 intel_set_rps(dev, val);
4296 valleyview_set_rps(dev, val);
4297 else
4298 gen6_set_rps(dev, val);
4299 4293
4300 mutex_unlock(&dev_priv->rps.hw_lock); 4294 mutex_unlock(&dev_priv->rps.hw_lock);
4301 4295
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index d8b4d0a887f8..b6b02f39985d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3183,8 +3183,7 @@ extern void i915_redisable_vga(struct drm_device *dev);
3183extern void i915_redisable_vga_power_on(struct drm_device *dev); 3183extern void i915_redisable_vga_power_on(struct drm_device *dev);
3184extern bool ironlake_set_drps(struct drm_device *dev, u8 val); 3184extern bool ironlake_set_drps(struct drm_device *dev, u8 val);
3185extern void intel_init_pch_refclk(struct drm_device *dev); 3185extern void intel_init_pch_refclk(struct drm_device *dev);
3186extern void gen6_set_rps(struct drm_device *dev, u8 val); 3186extern void intel_set_rps(struct drm_device *dev, u8 val);
3187extern void valleyview_set_rps(struct drm_device *dev, u8 val);
3188extern void intel_set_memory_cxsr(struct drm_i915_private *dev_priv, 3187extern void intel_set_memory_cxsr(struct drm_i915_private *dev_priv,
3189 bool enable); 3188 bool enable);
3190extern void intel_detect_pch(struct drm_device *dev); 3189extern void intel_detect_pch(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 4145d95902f5..90731195ab52 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1243,10 +1243,7 @@ static void gen6_pm_rps_work(struct work_struct *work)
1243 1243
1244 dev_priv->rps.last_adj = new_delay - dev_priv->rps.cur_freq; 1244 dev_priv->rps.last_adj = new_delay - dev_priv->rps.cur_freq;
1245 1245
1246 if (IS_VALLEYVIEW(dev_priv->dev)) 1246 intel_set_rps(dev_priv->dev, new_delay);
1247 valleyview_set_rps(dev_priv->dev, new_delay);
1248 else
1249 gen6_set_rps(dev_priv->dev, new_delay);
1250 1247
1251 mutex_unlock(&dev_priv->rps.hw_lock); 1248 mutex_unlock(&dev_priv->rps.hw_lock);
1252} 1249}
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index 49f5ade0edb7..cdc9da001484 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -402,10 +402,7 @@ static ssize_t gt_max_freq_mhz_store(struct device *kdev,
402 /* We still need *_set_rps to process the new max_delay and 402 /* We still need *_set_rps to process the new max_delay and
403 * update the interrupt limits and PMINTRMSK even though 403 * update the interrupt limits and PMINTRMSK even though
404 * frequency request may be unchanged. */ 404 * frequency request may be unchanged. */
405 if (IS_VALLEYVIEW(dev)) 405 intel_set_rps(dev, val);
406 valleyview_set_rps(dev, val);
407 else
408 gen6_set_rps(dev, val);
409 406
410 mutex_unlock(&dev_priv->rps.hw_lock); 407 mutex_unlock(&dev_priv->rps.hw_lock);
411 408
@@ -464,10 +461,7 @@ static ssize_t gt_min_freq_mhz_store(struct device *kdev,
464 /* We still need *_set_rps to process the new min_delay and 461 /* We still need *_set_rps to process the new min_delay and
465 * update the interrupt limits and PMINTRMSK even though 462 * update the interrupt limits and PMINTRMSK even though
466 * frequency request may be unchanged. */ 463 * frequency request may be unchanged. */
467 if (IS_VALLEYVIEW(dev)) 464 intel_set_rps(dev, val);
468 valleyview_set_rps(dev, val);
469 else
470 gen6_set_rps(dev, val);
471 465
472 mutex_unlock(&dev_priv->rps.hw_lock); 466 mutex_unlock(&dev_priv->rps.hw_lock);
473 467
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 6ece663f3394..bebefe79f7ce 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3750,7 +3750,7 @@ static u32 gen6_rps_pm_mask(struct drm_i915_private *dev_priv, u8 val)
3750/* gen6_set_rps is called to update the frequency request, but should also be 3750/* gen6_set_rps is called to update the frequency request, but should also be
3751 * called when the range (min_delay and max_delay) is modified so that we can 3751 * called when the range (min_delay and max_delay) is modified so that we can
3752 * update the GEN6_RP_INTERRUPT_LIMITS register accordingly. */ 3752 * update the GEN6_RP_INTERRUPT_LIMITS register accordingly. */
3753void gen6_set_rps(struct drm_device *dev, u8 val) 3753static void gen6_set_rps(struct drm_device *dev, u8 val)
3754{ 3754{
3755 struct drm_i915_private *dev_priv = dev->dev_private; 3755 struct drm_i915_private *dev_priv = dev->dev_private;
3756 3756
@@ -3786,6 +3786,27 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
3786 trace_intel_gpu_freq_change(val * 50); 3786 trace_intel_gpu_freq_change(val * 50);
3787} 3787}
3788 3788
3789static void valleyview_set_rps(struct drm_device *dev, u8 val)
3790{
3791 struct drm_i915_private *dev_priv = dev->dev_private;
3792
3793 WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
3794 WARN_ON(val > dev_priv->rps.max_freq_softlimit);
3795 WARN_ON(val < dev_priv->rps.min_freq_softlimit);
3796
3797 if (WARN_ONCE(IS_CHERRYVIEW(dev) && (val & 1),
3798 "Odd GPU freq value\n"))
3799 val &= ~1;
3800
3801 if (val != dev_priv->rps.cur_freq)
3802 vlv_punit_write(dev_priv, PUNIT_REG_GPU_FREQ_REQ, val);
3803
3804 I915_WRITE(GEN6_PMINTRMSK, gen6_rps_pm_mask(dev_priv, val));
3805
3806 dev_priv->rps.cur_freq = val;
3807 trace_intel_gpu_freq_change(intel_gpu_freq(dev_priv, val));
3808}
3809
3789/* vlv_set_rps_idle: Set the frequency to Rpn if Gfx clocks are down 3810/* vlv_set_rps_idle: Set the frequency to Rpn if Gfx clocks are down
3790 * 3811 *
3791 * * If Gfx is Idle, then 3812 * * If Gfx is Idle, then
@@ -3850,38 +3871,20 @@ void gen6_rps_idle(struct drm_i915_private *dev_priv)
3850 3871
3851void gen6_rps_boost(struct drm_i915_private *dev_priv) 3872void gen6_rps_boost(struct drm_i915_private *dev_priv)
3852{ 3873{
3853 struct drm_device *dev = dev_priv->dev;
3854
3855 mutex_lock(&dev_priv->rps.hw_lock); 3874 mutex_lock(&dev_priv->rps.hw_lock);
3856 if (dev_priv->rps.enabled) { 3875 if (dev_priv->rps.enabled) {
3857 if (IS_VALLEYVIEW(dev)) 3876 intel_set_rps(dev_priv->dev, dev_priv->rps.max_freq_softlimit);
3858 valleyview_set_rps(dev_priv->dev, dev_priv->rps.max_freq_softlimit);
3859 else
3860 gen6_set_rps(dev_priv->dev, dev_priv->rps.max_freq_softlimit);
3861 dev_priv->rps.last_adj = 0; 3877 dev_priv->rps.last_adj = 0;
3862 } 3878 }
3863 mutex_unlock(&dev_priv->rps.hw_lock); 3879 mutex_unlock(&dev_priv->rps.hw_lock);
3864} 3880}
3865 3881
3866void valleyview_set_rps(struct drm_device *dev, u8 val) 3882void intel_set_rps(struct drm_device *dev, u8 val)
3867{ 3883{
3868 struct drm_i915_private *dev_priv = dev->dev_private; 3884 if (IS_VALLEYVIEW(dev))
3869 3885 valleyview_set_rps(dev, val);
3870 WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock)); 3886 else
3871 WARN_ON(val > dev_priv->rps.max_freq_softlimit); 3887 gen6_set_rps(dev, val);
3872 WARN_ON(val < dev_priv->rps.min_freq_softlimit);
3873
3874 if (WARN_ONCE(IS_CHERRYVIEW(dev) && (val & 1),
3875 "Odd GPU freq value\n"))
3876 val &= ~1;
3877
3878 if (val != dev_priv->rps.cur_freq)
3879 vlv_punit_write(dev_priv, PUNIT_REG_GPU_FREQ_REQ, val);
3880
3881 I915_WRITE(GEN6_PMINTRMSK, gen6_rps_pm_mask(dev_priv, val));
3882
3883 dev_priv->rps.cur_freq = val;
3884 trace_intel_gpu_freq_change(intel_gpu_freq(dev_priv, val));
3885} 3888}
3886 3889
3887static void gen9_disable_rps(struct drm_device *dev) 3890static void gen9_disable_rps(struct drm_device *dev)