Browse Source

drm/i915: Add debugfs knobs for VLVCHV memory latency values

Allow tweaking the VLV/CHV memory latencies thorugh sysfs, like we do
for ILK+.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Clint Taylor <Clinton.A.Taylor@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Ville Syrjälä 10 years ago
parent
commit
de38b95cbb
1 changed files with 19 additions and 5 deletions
  1. 19 5
      drivers/gpu/drm/i915/i915_debugfs.c

+ 19 - 5
drivers/gpu/drm/i915/i915_debugfs.c

@@ -4203,8 +4203,15 @@ static const struct file_operations i915_displayport_test_type_fops = {
 static void wm_latency_show(struct seq_file *m, const uint16_t wm[8])
 static void wm_latency_show(struct seq_file *m, const uint16_t wm[8])
 {
 {
 	struct drm_device *dev = m->private;
 	struct drm_device *dev = m->private;
-	int num_levels = ilk_wm_max_level(dev) + 1;
 	int level;
 	int level;
+	int num_levels;
+
+	if (IS_CHERRYVIEW(dev))
+		num_levels = 3;
+	else if (IS_VALLEYVIEW(dev))
+		num_levels = 1;
+	else
+		num_levels = ilk_wm_max_level(dev) + 1;
 
 
 	drm_modeset_lock_all(dev);
 	drm_modeset_lock_all(dev);
 
 
@@ -4213,9 +4220,9 @@ static void wm_latency_show(struct seq_file *m, const uint16_t wm[8])
 
 
 		/*
 		/*
 		 * - WM1+ latency values in 0.5us units
 		 * - WM1+ latency values in 0.5us units
-		 * - latencies are in us on gen9
+		 * - latencies are in us on gen9/vlv/chv
 		 */
 		 */
-		if (INTEL_INFO(dev)->gen >= 9)
+		if (INTEL_INFO(dev)->gen >= 9 || IS_VALLEYVIEW(dev))
 			latency *= 10;
 			latency *= 10;
 		else if (level > 0)
 		else if (level > 0)
 			latency *= 5;
 			latency *= 5;
@@ -4279,7 +4286,7 @@ static int pri_wm_latency_open(struct inode *inode, struct file *file)
 {
 {
 	struct drm_device *dev = inode->i_private;
 	struct drm_device *dev = inode->i_private;
 
 
-	if (HAS_GMCH_DISPLAY(dev))
+	if (INTEL_INFO(dev)->gen < 5)
 		return -ENODEV;
 		return -ENODEV;
 
 
 	return single_open(file, pri_wm_latency_show, dev);
 	return single_open(file, pri_wm_latency_show, dev);
@@ -4311,11 +4318,18 @@ static ssize_t wm_latency_write(struct file *file, const char __user *ubuf,
 	struct seq_file *m = file->private_data;
 	struct seq_file *m = file->private_data;
 	struct drm_device *dev = m->private;
 	struct drm_device *dev = m->private;
 	uint16_t new[8] = { 0 };
 	uint16_t new[8] = { 0 };
-	int num_levels = ilk_wm_max_level(dev) + 1;
+	int num_levels;
 	int level;
 	int level;
 	int ret;
 	int ret;
 	char tmp[32];
 	char tmp[32];
 
 
+	if (IS_CHERRYVIEW(dev))
+		num_levels = 3;
+	else if (IS_VALLEYVIEW(dev))
+		num_levels = 1;
+	else
+		num_levels = ilk_wm_max_level(dev) + 1;
+
 	if (len >= sizeof(tmp))
 	if (len >= sizeof(tmp))
 		return -EINVAL;
 		return -EINVAL;