aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/i915_debugfs.c')
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 5363e9c66c27..4fa00fcfbc96 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1765,6 +1765,64 @@ static const struct file_operations i915_max_freq_fops = {
1765}; 1765};
1766 1766
1767static ssize_t 1767static ssize_t
1768i915_min_freq_read(struct file *filp, char __user *ubuf, size_t max,
1769 loff_t *ppos)
1770{
1771 struct drm_device *dev = filp->private_data;
1772 drm_i915_private_t *dev_priv = dev->dev_private;
1773 char buf[80];
1774 int len;
1775
1776 len = snprintf(buf, sizeof(buf),
1777 "min freq: %d\n", dev_priv->min_delay * 50);
1778
1779 if (len > sizeof(buf))
1780 len = sizeof(buf);
1781
1782 return simple_read_from_buffer(ubuf, max, ppos, buf, len);
1783}
1784
1785static ssize_t
1786i915_min_freq_write(struct file *filp, const char __user *ubuf, size_t cnt,
1787 loff_t *ppos)
1788{
1789 struct drm_device *dev = filp->private_data;
1790 struct drm_i915_private *dev_priv = dev->dev_private;
1791 char buf[20];
1792 int val = 1;
1793
1794 if (cnt > 0) {
1795 if (cnt > sizeof(buf) - 1)
1796 return -EINVAL;
1797
1798 if (copy_from_user(buf, ubuf, cnt))
1799 return -EFAULT;
1800 buf[cnt] = 0;
1801
1802 val = simple_strtoul(buf, NULL, 0);
1803 }
1804
1805 DRM_DEBUG_DRIVER("Manually setting min freq to %d\n", val);
1806
1807 /*
1808 * Turbo will still be enabled, but won't go below the set value.
1809 */
1810 dev_priv->min_delay = val / 50;
1811
1812 gen6_set_rps(dev, val / 50);
1813
1814 return cnt;
1815}
1816
1817static const struct file_operations i915_min_freq_fops = {
1818 .owner = THIS_MODULE,
1819 .open = simple_open,
1820 .read = i915_min_freq_read,
1821 .write = i915_min_freq_write,
1822 .llseek = default_llseek,
1823};
1824
1825static ssize_t
1768i915_cache_sharing_read(struct file *filp, 1826i915_cache_sharing_read(struct file *filp,
1769 char __user *ubuf, 1827 char __user *ubuf,
1770 size_t max, 1828 size_t max,
@@ -1997,6 +2055,12 @@ int i915_debugfs_init(struct drm_minor *minor)
1997 return ret; 2055 return ret;
1998 2056
1999 ret = i915_debugfs_create(minor->debugfs_root, minor, 2057 ret = i915_debugfs_create(minor->debugfs_root, minor,
2058 "i915_min_freq",
2059 &i915_min_freq_fops);
2060 if (ret)
2061 return ret;
2062
2063 ret = i915_debugfs_create(minor->debugfs_root, minor,
2000 "i915_cache_sharing", 2064 "i915_cache_sharing",
2001 &i915_cache_sharing_fops); 2065 &i915_cache_sharing_fops);
2002 if (ret) 2066 if (ret)
@@ -2028,6 +2092,8 @@ void i915_debugfs_cleanup(struct drm_minor *minor)
2028 1, minor); 2092 1, minor);
2029 drm_debugfs_remove_files((struct drm_info_list *) &i915_max_freq_fops, 2093 drm_debugfs_remove_files((struct drm_info_list *) &i915_max_freq_fops,
2030 1, minor); 2094 1, minor);
2095 drm_debugfs_remove_files((struct drm_info_list *) &i915_min_freq_fops,
2096 1, minor);
2031 drm_debugfs_remove_files((struct drm_info_list *) &i915_cache_sharing_fops, 2097 drm_debugfs_remove_files((struct drm_info_list *) &i915_cache_sharing_fops,
2032 1, minor); 2098 1, minor);
2033 drm_debugfs_remove_files((struct drm_info_list *) &i915_ring_stop_fops, 2099 drm_debugfs_remove_files((struct drm_info_list *) &i915_ring_stop_fops,