summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a
diff options
context:
space:
mode:
authorArto Merilainen <amerilainen@nvidia.com>2014-04-22 01:22:00 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:09:44 -0400
commit4c7065b558dac5968610415770d957f0e3b1ba69 (patch)
tree6973663dcd7016c84421add723fbffdd573d53d9 /drivers/gpu/nvgpu/gk20a
parentf2ef74fbfff11cad91cd08b3f1be69840f0aadda (diff)
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 <amerilainen@nvidia.com> Reviewed-on: http://git-master/r/399474 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_scale.c29
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c28
2 files changed, 26 insertions, 31 deletions
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 @@
34#include "clk_gk20a.h" 34#include "clk_gk20a.h"
35#include "gk20a_scale.h" 35#include "gk20a_scale.h"
36 36
37static ssize_t gk20a_scale_load_show(struct device *dev,
38 struct device_attribute *attr,
39 char *buf)
40{
41 struct platform_device *pdev = to_platform_device(dev);
42 struct gk20a *g = get_gk20a(pdev);
43 u32 busy_time;
44 ssize_t res;
45
46 if (!g->power_on) {
47 busy_time = 0;
48 } else {
49 gk20a_busy(g->dev);
50 gk20a_pmu_load_norm(g, &busy_time);
51 gk20a_idle(g->dev);
52 }
53
54 res = snprintf(buf, PAGE_SIZE, "%u\n", busy_time);
55
56 return res;
57}
58
59static DEVICE_ATTR(load, S_IRUGO, gk20a_scale_load_show, NULL);
60
61/* 37/*
62 * gk20a_scale_qos_notify() 38 * gk20a_scale_qos_notify()
63 * 39 *
@@ -293,9 +269,6 @@ void gk20a_scale_init(struct platform_device *pdev)
293 if (err || !profile->devfreq_profile.max_state) 269 if (err || !profile->devfreq_profile.max_state)
294 goto err_get_freqs; 270 goto err_get_freqs;
295 271
296 if (device_create_file(&pdev->dev, &dev_attr_load))
297 goto err_create_sysfs_entry;
298
299 /* Store device profile so we can access it if devfreq governor 272 /* Store device profile so we can access it if devfreq governor
300 * init needs that */ 273 * init needs that */
301 g->scale_profile = profile; 274 g->scale_profile = profile;
@@ -332,8 +305,6 @@ void gk20a_scale_init(struct platform_device *pdev)
332 return; 305 return;
333 306
334err_get_freqs: 307err_get_freqs:
335 device_remove_file(&pdev->dev, &dev_attr_load);
336err_create_sysfs_entry:
337 kfree(g->scale_profile); 308 kfree(g->scale_profile);
338 g->scale_profile = NULL; 309 g->scale_profile = NULL;
339} 310}
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,
248 248
249 return res; 249 return res;
250} 250}
251
252static DEVICE_ATTR(counters, S_IRUGO, counters_show, NULL); 251static DEVICE_ATTR(counters, S_IRUGO, counters_show, NULL);
252
253static ssize_t counters_show_reset(struct device *dev, 253static ssize_t counters_show_reset(struct device *dev,
254 struct device_attribute *attr, char *buf) 254 struct device_attribute *attr, char *buf)
255{ 255{
@@ -261,9 +261,31 @@ static ssize_t counters_show_reset(struct device *dev,
261 261
262 return res; 262 return res;
263} 263}
264
265static DEVICE_ATTR(counters_reset, S_IRUGO, counters_show_reset, NULL); 264static DEVICE_ATTR(counters_reset, S_IRUGO, counters_show_reset, NULL);
266 265
266static ssize_t gk20a_load_show(struct device *dev,
267 struct device_attribute *attr,
268 char *buf)
269{
270 struct platform_device *pdev = to_platform_device(dev);
271 struct gk20a *g = get_gk20a(pdev);
272 u32 busy_time;
273 ssize_t res;
274
275 if (!g->power_on) {
276 busy_time = 0;
277 } else {
278 gk20a_busy(g->dev);
279 gk20a_pmu_load_norm(g, &busy_time);
280 gk20a_idle(g->dev);
281 }
282
283 res = snprintf(buf, PAGE_SIZE, "%u\n", busy_time);
284
285 return res;
286}
287static DEVICE_ATTR(load, S_IRUGO, gk20a_load_show, NULL);
288
267static ssize_t elpg_enable_store(struct device *device, 289static ssize_t elpg_enable_store(struct device *device,
268 struct device_attribute *attr, const char *buf, size_t count) 290 struct device_attribute *attr, const char *buf, size_t count)
269{ 291{
@@ -318,6 +340,7 @@ void gk20a_remove_sysfs(struct device *dev)
318 device_remove_file(dev, &dev_attr_elpg_enable); 340 device_remove_file(dev, &dev_attr_elpg_enable);
319 device_remove_file(dev, &dev_attr_counters); 341 device_remove_file(dev, &dev_attr_counters);
320 device_remove_file(dev, &dev_attr_counters_reset); 342 device_remove_file(dev, &dev_attr_counters_reset);
343 device_remove_file(dev, &dev_attr_load);
321 device_remove_file(dev, &dev_attr_railgate_delay); 344 device_remove_file(dev, &dev_attr_railgate_delay);
322 device_remove_file(dev, &dev_attr_clockgate_delay); 345 device_remove_file(dev, &dev_attr_clockgate_delay);
323} 346}
@@ -333,6 +356,7 @@ void gk20a_create_sysfs(struct platform_device *dev)
333 error |= device_create_file(&dev->dev, &dev_attr_elpg_enable); 356 error |= device_create_file(&dev->dev, &dev_attr_elpg_enable);
334 error |= device_create_file(&dev->dev, &dev_attr_counters); 357 error |= device_create_file(&dev->dev, &dev_attr_counters);
335 error |= device_create_file(&dev->dev, &dev_attr_counters_reset); 358 error |= device_create_file(&dev->dev, &dev_attr_counters_reset);
359 error |= device_create_file(&dev->dev, &dev_attr_load);
336 error |= device_create_file(&dev->dev, &dev_attr_railgate_delay); 360 error |= device_create_file(&dev->dev, &dev_attr_railgate_delay);
337 error |= device_create_file(&dev->dev, &dev_attr_clockgate_delay); 361 error |= device_create_file(&dev->dev, &dev_attr_clockgate_delay);
338 362