diff options
author | Anders Kugler <akugler@nvidia.com> | 2015-05-15 22:02:40 -0400 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2015-06-06 10:24:52 -0400 |
commit | 140d213de6f76d19c3137ea6a97a88af7eaaf6ac (patch) | |
tree | 2cb3142f20359031d911d77ad68d84f79a32e06d /drivers/gpu/nvgpu | |
parent | df67ff6a75cba1fc96ae5fbe7dba260250eae9fd (diff) |
gpu: nvgpu: sysfs queries
Export the gpu's safe fmax_at_vmin frequency so it can be
queried from userspace (e.g. PHS).
Bug 1566108
Change-Id: I47326588ebd443f189a6051edbf95b35b35636d1
Signed-off-by: Anders Kugler <akugler@nvidia.com>
Reviewed-on: http://git-master/r/743501
(cherry picked from commit a977495878a486ca45c7de969582fd9ea949b0f0)
Reviewed-on: http://git-master/r/753279
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index 5fe10273..d8da34d9 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | |||
@@ -554,6 +554,21 @@ static ssize_t emc3d_ratio_read(struct device *device, | |||
554 | 554 | ||
555 | static DEVICE_ATTR(emc3d_ratio, ROOTRW, emc3d_ratio_read, emc3d_ratio_store); | 555 | static DEVICE_ATTR(emc3d_ratio, ROOTRW, emc3d_ratio_read, emc3d_ratio_store); |
556 | 556 | ||
557 | static ssize_t fmax_at_vmin_safe_read(struct device *device, | ||
558 | struct device_attribute *attr, char *buf) | ||
559 | { | ||
560 | struct platform_device *ndev = to_platform_device(device); | ||
561 | struct gk20a *g = get_gk20a(ndev); | ||
562 | unsigned long gpu_fmax_at_vmin_hz = 0; | ||
563 | |||
564 | gpu_fmax_at_vmin_hz = tegra_dvfs_get_fmax_at_vmin_safe_t( | ||
565 | clk_get_parent(g->clk.tegra_clk)); | ||
566 | |||
567 | return sprintf(buf, "%d\n", (int)(gpu_fmax_at_vmin_hz)); | ||
568 | } | ||
569 | |||
570 | static DEVICE_ATTR(fmax_at_vmin_safe, S_IRUGO, fmax_at_vmin_safe_read, NULL); | ||
571 | |||
557 | #ifdef CONFIG_PM_RUNTIME | 572 | #ifdef CONFIG_PM_RUNTIME |
558 | static ssize_t force_idle_store(struct device *device, | 573 | static ssize_t force_idle_store(struct device *device, |
559 | struct device_attribute *attr, const char *buf, size_t count) | 574 | struct device_attribute *attr, const char *buf, size_t count) |
@@ -671,6 +686,7 @@ void gk20a_remove_sysfs(struct device *dev) | |||
671 | device_remove_file(dev, &dev_attr_ptimer_scale_factor); | 686 | device_remove_file(dev, &dev_attr_ptimer_scale_factor); |
672 | device_remove_file(dev, &dev_attr_elpg_enable); | 687 | device_remove_file(dev, &dev_attr_elpg_enable); |
673 | device_remove_file(dev, &dev_attr_emc3d_ratio); | 688 | device_remove_file(dev, &dev_attr_emc3d_ratio); |
689 | device_remove_file(dev, &dev_attr_fmax_at_vmin_safe); | ||
674 | device_remove_file(dev, &dev_attr_counters); | 690 | device_remove_file(dev, &dev_attr_counters); |
675 | device_remove_file(dev, &dev_attr_counters_reset); | 691 | device_remove_file(dev, &dev_attr_counters_reset); |
676 | device_remove_file(dev, &dev_attr_load); | 692 | device_remove_file(dev, &dev_attr_load); |
@@ -699,6 +715,7 @@ void gk20a_create_sysfs(struct platform_device *dev) | |||
699 | error |= device_create_file(&dev->dev, &dev_attr_ptimer_scale_factor); | 715 | error |= device_create_file(&dev->dev, &dev_attr_ptimer_scale_factor); |
700 | error |= device_create_file(&dev->dev, &dev_attr_elpg_enable); | 716 | error |= device_create_file(&dev->dev, &dev_attr_elpg_enable); |
701 | error |= device_create_file(&dev->dev, &dev_attr_emc3d_ratio); | 717 | error |= device_create_file(&dev->dev, &dev_attr_emc3d_ratio); |
718 | error |= device_create_file(&dev->dev, &dev_attr_fmax_at_vmin_safe); | ||
702 | error |= device_create_file(&dev->dev, &dev_attr_counters); | 719 | error |= device_create_file(&dev->dev, &dev_attr_counters); |
703 | error |= device_create_file(&dev->dev, &dev_attr_counters_reset); | 720 | error |= device_create_file(&dev->dev, &dev_attr_counters_reset); |
704 | error |= device_create_file(&dev->dev, &dev_attr_load); | 721 | error |= device_create_file(&dev->dev, &dev_attr_load); |