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.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
index b23a1406..52a34086 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
@@ -45,11 +45,15 @@ static ssize_t elcg_enable_store(struct device *device,
45 struct platform_device *ndev = to_platform_device(device); 45 struct platform_device *ndev = to_platform_device(device);
46 struct gk20a *g = get_gk20a(ndev); 46 struct gk20a *g = get_gk20a(ndev);
47 unsigned long val = 0; 47 unsigned long val = 0;
48 int err;
48 49
49 if (kstrtoul(buf, 10, &val) < 0) 50 if (kstrtoul(buf, 10, &val) < 0)
50 return -EINVAL; 51 return -EINVAL;
51 52
52 gk20a_busy(g->dev); 53 err = gk20a_busy(g->dev);
54 if (err)
55 return err;
56
53 if (val) { 57 if (val) {
54 g->elcg_enabled = true; 58 g->elcg_enabled = true;
55 gr_gk20a_init_elcg_mode(g, ELCG_AUTO, ENGINE_GR_GK20A); 59 gr_gk20a_init_elcg_mode(g, ELCG_AUTO, ENGINE_GR_GK20A);
@@ -84,6 +88,7 @@ static ssize_t blcg_enable_store(struct device *device,
84 struct platform_device *ndev = to_platform_device(device); 88 struct platform_device *ndev = to_platform_device(device);
85 struct gk20a *g = get_gk20a(ndev); 89 struct gk20a *g = get_gk20a(ndev);
86 unsigned long val = 0; 90 unsigned long val = 0;
91 int err;
87 92
88 if (kstrtoul(buf, 10, &val) < 0) 93 if (kstrtoul(buf, 10, &val) < 0)
89 return -EINVAL; 94 return -EINVAL;
@@ -93,7 +98,10 @@ static ssize_t blcg_enable_store(struct device *device,
93 else 98 else
94 g->blcg_enabled = false; 99 g->blcg_enabled = false;
95 100
96 gk20a_busy(g->dev); 101 err = gk20a_busy(g->dev);
102 if (err)
103 return err;
104
97 if (g->ops.clock_gating.blcg_bus_load_gating_prod) 105 if (g->ops.clock_gating.blcg_bus_load_gating_prod)
98 g->ops.clock_gating.blcg_bus_load_gating_prod(g, g->blcg_enabled); 106 g->ops.clock_gating.blcg_bus_load_gating_prod(g, g->blcg_enabled);
99 if (g->ops.clock_gating.blcg_ctxsw_firmware_load_gating_prod) 107 if (g->ops.clock_gating.blcg_ctxsw_firmware_load_gating_prod)
@@ -133,6 +141,7 @@ static ssize_t slcg_enable_store(struct device *device,
133 struct platform_device *ndev = to_platform_device(device); 141 struct platform_device *ndev = to_platform_device(device);
134 struct gk20a *g = get_gk20a(ndev); 142 struct gk20a *g = get_gk20a(ndev);
135 unsigned long val = 0; 143 unsigned long val = 0;
144 int err;
136 145
137 if (kstrtoul(buf, 10, &val) < 0) 146 if (kstrtoul(buf, 10, &val) < 0)
138 return -EINVAL; 147 return -EINVAL;
@@ -147,7 +156,10 @@ static ssize_t slcg_enable_store(struct device *device,
147 * init. Therefore, it would be incongruous to add it here. Once 156 * init. Therefore, it would be incongruous to add it here. Once
148 * it is added to init, we should add it here too. 157 * it is added to init, we should add it here too.
149 */ 158 */
150 gk20a_busy(g->dev); 159 err = gk20a_busy(g->dev);
160 if (err)
161 return err;
162
151 if (g->ops.clock_gating.slcg_bus_load_gating_prod) 163 if (g->ops.clock_gating.slcg_bus_load_gating_prod)
152 g->ops.clock_gating.slcg_bus_load_gating_prod(g, g->slcg_enabled); 164 g->ops.clock_gating.slcg_bus_load_gating_prod(g, g->slcg_enabled);
153 if (g->ops.clock_gating.slcg_ce2_load_gating_prod) 165 if (g->ops.clock_gating.slcg_ce2_load_gating_prod)
@@ -305,11 +317,15 @@ static ssize_t gk20a_load_show(struct device *dev,
305 struct gk20a *g = get_gk20a(pdev); 317 struct gk20a *g = get_gk20a(pdev);
306 u32 busy_time; 318 u32 busy_time;
307 ssize_t res; 319 ssize_t res;
320 int err;
308 321
309 if (!g->power_on) { 322 if (!g->power_on) {
310 busy_time = 0; 323 busy_time = 0;
311 } else { 324 } else {
312 gk20a_busy(g->dev); 325 err = gk20a_busy(g->dev);
326 if (err)
327 return err;
328
313 gk20a_pmu_load_update(g); 329 gk20a_pmu_load_update(g);
314 gk20a_pmu_load_norm(g, &busy_time); 330 gk20a_pmu_load_norm(g, &busy_time);
315 gk20a_idle(g->dev); 331 gk20a_idle(g->dev);
@@ -436,6 +452,9 @@ static ssize_t aelpg_enable_store(struct device *device,
436 return -EINVAL; 452 return -EINVAL;
437 453
438 err = gk20a_busy(g->dev); 454 err = gk20a_busy(g->dev);
455 if (err)
456 return err;
457
439 if (g->pmu.pmu_ready) { 458 if (g->pmu.pmu_ready) {
440 if (val && !g->aelpg_enabled) { 459 if (val && !g->aelpg_enabled) {
441 g->aelpg_enabled = true; 460 g->aelpg_enabled = true;