summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c63
1 files changed, 62 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
index a2980354..307fb681 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * GK20A Graphics 4 * GK20A Graphics
5 * 5 *
6 * Copyright (c) 2011-2016, NVIDIA CORPORATION. All rights reserved. 6 * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License, 9 * under the terms and conditions of the GNU General Public License,
@@ -756,6 +756,63 @@ static ssize_t tpc_fs_mask_read(struct device *dev,
756 756
757static DEVICE_ATTR(tpc_fs_mask, ROOTRW, tpc_fs_mask_read, tpc_fs_mask_store); 757static DEVICE_ATTR(tpc_fs_mask, ROOTRW, tpc_fs_mask_read, tpc_fs_mask_store);
758 758
759static ssize_t min_timeslice_us_read(struct device *dev,
760 struct device_attribute *attr, char *buf)
761{
762 struct gk20a *g = get_gk20a(dev);
763
764 return snprintf(buf, PAGE_SIZE, "%u\n", g->min_timeslice_us);
765}
766
767static ssize_t min_timeslice_us_store(struct device *dev,
768 struct device_attribute *attr, const char *buf, size_t count)
769{
770 struct gk20a *g = get_gk20a(dev);
771 unsigned long val;
772
773 if (kstrtoul(buf, 10, &val) < 0)
774 return -EINVAL;
775
776 if (val > g->max_timeslice_us)
777 return -EINVAL;
778
779 g->min_timeslice_us = val;
780
781 return count;
782}
783
784static DEVICE_ATTR(min_timeslice_us, ROOTRW, min_timeslice_us_read,
785 min_timeslice_us_store);
786
787static ssize_t max_timeslice_us_read(struct device *dev,
788 struct device_attribute *attr, char *buf)
789{
790 struct gk20a *g = get_gk20a(dev);
791
792 return snprintf(buf, PAGE_SIZE, "%u\n", g->max_timeslice_us);
793}
794
795static ssize_t max_timeslice_us_store(struct device *dev,
796 struct device_attribute *attr, const char *buf, size_t count)
797{
798 struct gk20a *g = get_gk20a(dev);
799 unsigned long val;
800
801 if (kstrtoul(buf, 10, &val) < 0)
802 return -EINVAL;
803
804 if (val < g->min_timeslice_us)
805 return -EINVAL;
806
807 g->max_timeslice_us = val;
808
809 return count;
810}
811
812static DEVICE_ATTR(max_timeslice_us, ROOTRW, max_timeslice_us_read,
813 max_timeslice_us_store);
814
815
759void gk20a_remove_sysfs(struct device *dev) 816void gk20a_remove_sysfs(struct device *dev)
760{ 817{
761 struct gk20a *g = get_gk20a(dev); 818 struct gk20a *g = get_gk20a(dev);
@@ -782,6 +839,8 @@ void gk20a_remove_sysfs(struct device *dev)
782 device_remove_file(dev, &dev_attr_aelpg_enable); 839 device_remove_file(dev, &dev_attr_aelpg_enable);
783 device_remove_file(dev, &dev_attr_allow_all); 840 device_remove_file(dev, &dev_attr_allow_all);
784 device_remove_file(dev, &dev_attr_tpc_fs_mask); 841 device_remove_file(dev, &dev_attr_tpc_fs_mask);
842 device_remove_file(dev, &dev_attr_min_timeslice_us);
843 device_remove_file(dev, &dev_attr_max_timeslice_us);
785 844
786 if (g->host1x_dev && (dev->parent != &g->host1x_dev->dev)) { 845 if (g->host1x_dev && (dev->parent != &g->host1x_dev->dev)) {
787 sysfs_remove_link(&g->host1x_dev->dev.kobj, dev_name(dev)); 846 sysfs_remove_link(&g->host1x_dev->dev.kobj, dev_name(dev));
@@ -822,6 +881,8 @@ void gk20a_create_sysfs(struct device *dev)
822 error |= device_create_file(dev, &dev_attr_aelpg_enable); 881 error |= device_create_file(dev, &dev_attr_aelpg_enable);
823 error |= device_create_file(dev, &dev_attr_allow_all); 882 error |= device_create_file(dev, &dev_attr_allow_all);
824 error |= device_create_file(dev, &dev_attr_tpc_fs_mask); 883 error |= device_create_file(dev, &dev_attr_tpc_fs_mask);
884 error |= device_create_file(dev, &dev_attr_min_timeslice_us);
885 error |= device_create_file(dev, &dev_attr_max_timeslice_us);
825 886
826 if (g->host1x_dev && (dev->parent != &g->host1x_dev->dev)) { 887 if (g->host1x_dev && (dev->parent != &g->host1x_dev->dev)) {
827 error |= sysfs_create_link(&g->host1x_dev->dev.kobj, 888 error |= sysfs_create_link(&g->host1x_dev->dev.kobj,