From 4c7065b558dac5968610415770d957f0e3b1ba69 Mon Sep 17 00:00:00 2001 From: Arto Merilainen Date: Tue, 22 Apr 2014 08:22:00 +0300 Subject: gpu: nvgpu: Create load sysfs node always Currently creation of the load sysfs node is bound to devfreq profile initialisation, however, this information is useful even if the scaling is not enabled. This patch modifies the code to create the sysfs node always. Bug 1485489 Change-Id: Id20433344aa81108f89a36cd56c9a73dd9d2e1c8 Signed-off-by: Arto Merilainen Reviewed-on: http://git-master/r/399474 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a_scale.c | 29 ----------------------------- drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 31 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c index d1fd71fe..8a92828f 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c @@ -34,30 +34,6 @@ #include "clk_gk20a.h" #include "gk20a_scale.h" -static ssize_t gk20a_scale_load_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct platform_device *pdev = to_platform_device(dev); - struct gk20a *g = get_gk20a(pdev); - u32 busy_time; - ssize_t res; - - if (!g->power_on) { - busy_time = 0; - } else { - gk20a_busy(g->dev); - gk20a_pmu_load_norm(g, &busy_time); - gk20a_idle(g->dev); - } - - res = snprintf(buf, PAGE_SIZE, "%u\n", busy_time); - - return res; -} - -static DEVICE_ATTR(load, S_IRUGO, gk20a_scale_load_show, NULL); - /* * gk20a_scale_qos_notify() * @@ -293,9 +269,6 @@ void gk20a_scale_init(struct platform_device *pdev) if (err || !profile->devfreq_profile.max_state) goto err_get_freqs; - if (device_create_file(&pdev->dev, &dev_attr_load)) - goto err_create_sysfs_entry; - /* Store device profile so we can access it if devfreq governor * init needs that */ g->scale_profile = profile; @@ -332,8 +305,6 @@ void gk20a_scale_init(struct platform_device *pdev) return; err_get_freqs: - device_remove_file(&pdev->dev, &dev_attr_load); -err_create_sysfs_entry: kfree(g->scale_profile); g->scale_profile = NULL; } diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index 335c3f3b..f7e0a2b6 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c @@ -248,8 +248,8 @@ static ssize_t counters_show(struct device *dev, return res; } - static DEVICE_ATTR(counters, S_IRUGO, counters_show, NULL); + static ssize_t counters_show_reset(struct device *dev, struct device_attribute *attr, char *buf) { @@ -261,9 +261,31 @@ static ssize_t counters_show_reset(struct device *dev, return res; } - static DEVICE_ATTR(counters_reset, S_IRUGO, counters_show_reset, NULL); +static ssize_t gk20a_load_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct platform_device *pdev = to_platform_device(dev); + struct gk20a *g = get_gk20a(pdev); + u32 busy_time; + ssize_t res; + + if (!g->power_on) { + busy_time = 0; + } else { + gk20a_busy(g->dev); + gk20a_pmu_load_norm(g, &busy_time); + gk20a_idle(g->dev); + } + + res = snprintf(buf, PAGE_SIZE, "%u\n", busy_time); + + return res; +} +static DEVICE_ATTR(load, S_IRUGO, gk20a_load_show, NULL); + static ssize_t elpg_enable_store(struct device *device, struct device_attribute *attr, const char *buf, size_t count) { @@ -318,6 +340,7 @@ void gk20a_remove_sysfs(struct device *dev) device_remove_file(dev, &dev_attr_elpg_enable); device_remove_file(dev, &dev_attr_counters); device_remove_file(dev, &dev_attr_counters_reset); + device_remove_file(dev, &dev_attr_load); device_remove_file(dev, &dev_attr_railgate_delay); device_remove_file(dev, &dev_attr_clockgate_delay); } @@ -333,6 +356,7 @@ void gk20a_create_sysfs(struct platform_device *dev) error |= device_create_file(&dev->dev, &dev_attr_elpg_enable); error |= device_create_file(&dev->dev, &dev_attr_counters); error |= device_create_file(&dev->dev, &dev_attr_counters_reset); + error |= device_create_file(&dev->dev, &dev_attr_load); error |= device_create_file(&dev->dev, &dev_attr_railgate_delay); error |= device_create_file(&dev->dev, &dev_attr_clockgate_delay); -- cgit v1.2.2