summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/os/linux/sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/sysfs.c')
-rw-r--r--drivers/gpu/nvgpu/os/linux/sysfs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/sysfs.c b/drivers/gpu/nvgpu/os/linux/sysfs.c
index 2ab29649..84a311de 100644
--- a/drivers/gpu/nvgpu/os/linux/sysfs.c
+++ b/drivers/gpu/nvgpu/os/linux/sysfs.c
@@ -259,13 +259,19 @@ static ssize_t railgate_enable_store(struct device *dev,
259 unsigned long railgate_enable = 0; 259 unsigned long railgate_enable = 0;
260 /* dev is guaranteed to be valid here. Ok to de-reference */ 260 /* dev is guaranteed to be valid here. Ok to de-reference */
261 struct gk20a *g = get_gk20a(dev); 261 struct gk20a *g = get_gk20a(dev);
262 struct gk20a_platform *platform = dev_get_drvdata(dev);
262 bool enabled = nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE); 263 bool enabled = nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE);
263 int err; 264 int err;
264 265
265 if (kstrtoul(buf, 10, &railgate_enable) < 0) 266 if (kstrtoul(buf, 10, &railgate_enable) < 0)
266 return -EINVAL; 267 return -EINVAL;
267 268
268 if (railgate_enable && !enabled) { 269 if (!platform->can_railgate_init) {
270 nvgpu_err(g, "Railgating is not supported");
271 return -EINVAL;
272 }
273
274 if (railgate_enable) {
269 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, true); 275 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, true);
270 pm_runtime_set_autosuspend_delay(dev, g->railgate_delay); 276 pm_runtime_set_autosuspend_delay(dev, g->railgate_delay);
271 } else if (railgate_enable == 0 && enabled) { 277 } else if (railgate_enable == 0 && enabled) {