aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/i915_sysfs.c')
-rw-r--r--drivers/gpu/drm/i915/i915_sysfs.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index a3a3e22f1a84..fa4b4e881401 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -226,7 +226,7 @@ static ssize_t gt_max_freq_mhz_show(struct device *kdev, struct device_attribute
226 int ret; 226 int ret;
227 227
228 mutex_lock(&dev_priv->rps.hw_lock); 228 mutex_lock(&dev_priv->rps.hw_lock);
229 ret = dev_priv->rps.max_delay * GT_FREQUENCY_MULTIPLIER; 229 ret = dev_priv->rps.hw_max * GT_FREQUENCY_MULTIPLIER;
230 mutex_unlock(&dev_priv->rps.hw_lock); 230 mutex_unlock(&dev_priv->rps.hw_lock);
231 231
232 return snprintf(buf, PAGE_SIZE, "%d\n", ret); 232 return snprintf(buf, PAGE_SIZE, "%d\n", ret);
@@ -239,7 +239,7 @@ static ssize_t gt_max_freq_mhz_store(struct device *kdev,
239 struct drm_minor *minor = container_of(kdev, struct drm_minor, kdev); 239 struct drm_minor *minor = container_of(kdev, struct drm_minor, kdev);
240 struct drm_device *dev = minor->dev; 240 struct drm_device *dev = minor->dev;
241 struct drm_i915_private *dev_priv = dev->dev_private; 241 struct drm_i915_private *dev_priv = dev->dev_private;
242 u32 val, rp_state_cap, hw_max, hw_min; 242 u32 val, rp_state_cap, hw_max, hw_min, non_oc_max;
243 ssize_t ret; 243 ssize_t ret;
244 244
245 ret = kstrtou32(buf, 0, &val); 245 ret = kstrtou32(buf, 0, &val);
@@ -251,7 +251,8 @@ static ssize_t gt_max_freq_mhz_store(struct device *kdev,
251 mutex_lock(&dev_priv->rps.hw_lock); 251 mutex_lock(&dev_priv->rps.hw_lock);
252 252
253 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); 253 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
254 hw_max = (rp_state_cap & 0xff); 254 hw_max = dev_priv->rps.hw_max;
255 non_oc_max = (rp_state_cap & 0xff);
255 hw_min = ((rp_state_cap & 0xff0000) >> 16); 256 hw_min = ((rp_state_cap & 0xff0000) >> 16);
256 257
257 if (val < hw_min || val > hw_max || val < dev_priv->rps.min_delay) { 258 if (val < hw_min || val > hw_max || val < dev_priv->rps.min_delay) {
@@ -259,6 +260,10 @@ static ssize_t gt_max_freq_mhz_store(struct device *kdev,
259 return -EINVAL; 260 return -EINVAL;
260 } 261 }
261 262
263 if (val > non_oc_max)
264 DRM_DEBUG("User requested overclocking to %d\n",
265 val * GT_FREQUENCY_MULTIPLIER);
266
262 if (dev_priv->rps.cur_delay > val) 267 if (dev_priv->rps.cur_delay > val)
263 gen6_set_rps(dev_priv->dev, val); 268 gen6_set_rps(dev_priv->dev, val);
264 269
@@ -302,7 +307,7 @@ static ssize_t gt_min_freq_mhz_store(struct device *kdev,
302 mutex_lock(&dev_priv->rps.hw_lock); 307 mutex_lock(&dev_priv->rps.hw_lock);
303 308
304 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); 309 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
305 hw_max = (rp_state_cap & 0xff); 310 hw_max = dev_priv->rps.hw_max;
306 hw_min = ((rp_state_cap & 0xff0000) >> 16); 311 hw_min = ((rp_state_cap & 0xff0000) >> 16);
307 312
308 if (val < hw_min || val > hw_max || val > dev_priv->rps.max_delay) { 313 if (val < hw_min || val > hw_max || val > dev_priv->rps.max_delay) {