diff options
Diffstat (limited to 'drivers/gpu/nvgpu/os')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/sysfs.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/sysfs.c b/drivers/gpu/nvgpu/os/linux/sysfs.c index 84a311de..221ea0ce 100644 --- a/drivers/gpu/nvgpu/os/linux/sysfs.c +++ b/drivers/gpu/nvgpu/os/linux/sysfs.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -266,6 +266,13 @@ static ssize_t railgate_enable_store(struct device *dev, | |||
266 | if (kstrtoul(buf, 10, &railgate_enable) < 0) | 266 | if (kstrtoul(buf, 10, &railgate_enable) < 0) |
267 | return -EINVAL; | 267 | return -EINVAL; |
268 | 268 | ||
269 | /* convert to boolean */ | ||
270 | railgate_enable = !!railgate_enable; | ||
271 | |||
272 | /* writing same value should be treated as nop and successful */ | ||
273 | if (railgate_enable == enabled) | ||
274 | goto out; | ||
275 | |||
269 | if (!platform->can_railgate_init) { | 276 | if (!platform->can_railgate_init) { |
270 | nvgpu_err(g, "Railgating is not supported"); | 277 | nvgpu_err(g, "Railgating is not supported"); |
271 | return -EINVAL; | 278 | return -EINVAL; |
@@ -274,7 +281,7 @@ static ssize_t railgate_enable_store(struct device *dev, | |||
274 | if (railgate_enable) { | 281 | if (railgate_enable) { |
275 | __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, true); | 282 | __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, true); |
276 | pm_runtime_set_autosuspend_delay(dev, g->railgate_delay); | 283 | pm_runtime_set_autosuspend_delay(dev, g->railgate_delay); |
277 | } else if (railgate_enable == 0 && enabled) { | 284 | } else { |
278 | __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false); | 285 | __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false); |
279 | pm_runtime_set_autosuspend_delay(dev, -1); | 286 | pm_runtime_set_autosuspend_delay(dev, -1); |
280 | } | 287 | } |
@@ -284,6 +291,7 @@ static ssize_t railgate_enable_store(struct device *dev, | |||
284 | return err; | 291 | return err; |
285 | gk20a_idle(g); | 292 | gk20a_idle(g); |
286 | 293 | ||
294 | out: | ||
287 | nvgpu_info(g, "railgate is %s.", | 295 | nvgpu_info(g, "railgate is %s.", |
288 | nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) ? | 296 | nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) ? |
289 | "enabled" : "disabled"); | 297 | "enabled" : "disabled"); |