summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/sysfs.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/sysfs.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/sysfs.c b/drivers/gpu/nvgpu/common/linux/sysfs.c
index e425e153..7a887beb 100644
--- a/drivers/gpu/nvgpu/common/linux/sysfs.c
+++ b/drivers/gpu/nvgpu/common/linux/sysfs.c
@@ -305,24 +305,23 @@ static ssize_t railgate_enable_store(struct device *dev,
305 unsigned long railgate_enable = 0; 305 unsigned long railgate_enable = 0;
306 /* dev is guaranteed to be valid here. Ok to de-reference */ 306 /* dev is guaranteed to be valid here. Ok to de-reference */
307 struct gk20a *g = get_gk20a(dev); 307 struct gk20a *g = get_gk20a(dev);
308 int err = 0; 308 int err;
309 309
310 if (kstrtoul(buf, 10, &railgate_enable) < 0) 310 if (kstrtoul(buf, 10, &railgate_enable) < 0)
311 return -EINVAL; 311 return -EINVAL;
312 312
313 if (railgate_enable && !g->can_railgate) { 313 if (railgate_enable && !g->can_railgate) {
314 /* release extra ref count */
315 gk20a_idle(g);
316 g->can_railgate = true; 314 g->can_railgate = true;
317 g->user_railgate_disabled = false; 315 pm_runtime_set_autosuspend_delay(dev, g->railgate_delay);
318 } else if (railgate_enable == 0 && g->can_railgate) { 316 } else if (railgate_enable == 0 && g->can_railgate) {
319 /* take extra ref count */
320 err = gk20a_busy(g);
321 if (err)
322 return err;
323 g->can_railgate = false; 317 g->can_railgate = false;
324 g->user_railgate_disabled = true; 318 pm_runtime_set_autosuspend_delay(dev, -1);
325 } 319 }
320 /* wake-up system to make rail-gating setting effective */
321 err = gk20a_busy(g);
322 if (err)
323 return err;
324 gk20a_idle(g);
326 325
327 nvgpu_info(g, "railgate is %s.", g->can_railgate ? 326 nvgpu_info(g, "railgate is %s.", g->can_railgate ?
328 "enabled" : "disabled"); 327 "enabled" : "disabled");