diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index 4d5854d4..783ff6fb 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | |||
@@ -288,7 +288,6 @@ static DEVICE_ATTR(ptimer_src_freq, | |||
288 | static ssize_t railgate_enable_store(struct device *dev, | 288 | static ssize_t railgate_enable_store(struct device *dev, |
289 | struct device_attribute *attr, const char *buf, size_t count) | 289 | struct device_attribute *attr, const char *buf, size_t count) |
290 | { | 290 | { |
291 | struct gk20a_platform *platform = dev_get_drvdata(dev); | ||
292 | unsigned long railgate_enable = 0; | 291 | unsigned long railgate_enable = 0; |
293 | /* dev is guaranteed to be valid here. Ok to de-reference */ | 292 | /* dev is guaranteed to be valid here. Ok to de-reference */ |
294 | struct gk20a *g = get_gk20a(dev); | 293 | struct gk20a *g = get_gk20a(dev); |
@@ -297,21 +296,21 @@ static ssize_t railgate_enable_store(struct device *dev, | |||
297 | if (kstrtoul(buf, 10, &railgate_enable) < 0) | 296 | if (kstrtoul(buf, 10, &railgate_enable) < 0) |
298 | return -EINVAL; | 297 | return -EINVAL; |
299 | 298 | ||
300 | if (railgate_enable && !platform->can_railgate) { | 299 | if (railgate_enable && !g->can_railgate) { |
301 | /* release extra ref count */ | 300 | /* release extra ref count */ |
302 | gk20a_idle(g); | 301 | gk20a_idle(g); |
303 | platform->can_railgate = true; | 302 | g->can_railgate = true; |
304 | platform->user_railgate_disabled = false; | 303 | g->user_railgate_disabled = false; |
305 | } else if (railgate_enable == 0 && platform->can_railgate) { | 304 | } else if (railgate_enable == 0 && g->can_railgate) { |
306 | /* take extra ref count */ | 305 | /* take extra ref count */ |
307 | err = gk20a_busy(g); | 306 | err = gk20a_busy(g); |
308 | if (err) | 307 | if (err) |
309 | return err; | 308 | return err; |
310 | platform->can_railgate = false; | 309 | g->can_railgate = false; |
311 | platform->user_railgate_disabled = true; | 310 | g->user_railgate_disabled = true; |
312 | } | 311 | } |
313 | 312 | ||
314 | dev_info(dev, "railgate is %s.\n", platform->can_railgate ? | 313 | dev_info(dev, "railgate is %s.\n", g->can_railgate ? |
315 | "enabled" : "disabled"); | 314 | "enabled" : "disabled"); |
316 | 315 | ||
317 | return count; | 316 | return count; |
@@ -320,9 +319,9 @@ static ssize_t railgate_enable_store(struct device *dev, | |||
320 | static ssize_t railgate_enable_read(struct device *dev, | 319 | static ssize_t railgate_enable_read(struct device *dev, |
321 | struct device_attribute *attr, char *buf) | 320 | struct device_attribute *attr, char *buf) |
322 | { | 321 | { |
323 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 322 | struct gk20a *g = get_gk20a(dev); |
324 | 323 | ||
325 | return snprintf(buf, PAGE_SIZE, "%d\n", platform->can_railgate ? 1 : 0); | 324 | return snprintf(buf, PAGE_SIZE, "%d\n", g->can_railgate ? 1 : 0); |
326 | } | 325 | } |
327 | 326 | ||
328 | static DEVICE_ATTR(railgate_enable, ROOTRW, railgate_enable_read, | 327 | static DEVICE_ATTR(railgate_enable, ROOTRW, railgate_enable_read, |
@@ -333,20 +332,19 @@ static ssize_t railgate_delay_store(struct device *dev, | |||
333 | struct device_attribute *attr, | 332 | struct device_attribute *attr, |
334 | const char *buf, size_t count) | 333 | const char *buf, size_t count) |
335 | { | 334 | { |
336 | struct gk20a_platform *platform = dev_get_drvdata(dev); | ||
337 | int railgate_delay = 0, ret = 0; | 335 | int railgate_delay = 0, ret = 0; |
338 | struct gk20a *g = get_gk20a(dev); | 336 | struct gk20a *g = get_gk20a(dev); |
339 | int err; | 337 | int err; |
340 | 338 | ||
341 | if (!platform->can_railgate) { | 339 | if (!g->can_railgate) { |
342 | dev_info(dev, "does not support power-gating\n"); | 340 | dev_info(dev, "does not support power-gating\n"); |
343 | return count; | 341 | return count; |
344 | } | 342 | } |
345 | 343 | ||
346 | ret = sscanf(buf, "%d", &railgate_delay); | 344 | ret = sscanf(buf, "%d", &railgate_delay); |
347 | if (ret == 1 && railgate_delay >= 0) { | 345 | if (ret == 1 && railgate_delay >= 0) { |
348 | platform->railgate_delay = railgate_delay; | 346 | g->railgate_delay = railgate_delay; |
349 | pm_runtime_set_autosuspend_delay(dev, platform->railgate_delay); | 347 | pm_runtime_set_autosuspend_delay(dev, g->railgate_delay); |
350 | } else | 348 | } else |
351 | dev_err(dev, "Invalid powergate delay\n"); | 349 | dev_err(dev, "Invalid powergate delay\n"); |
352 | 350 | ||
@@ -361,9 +359,9 @@ static ssize_t railgate_delay_store(struct device *dev, | |||
361 | static ssize_t railgate_delay_show(struct device *dev, | 359 | static ssize_t railgate_delay_show(struct device *dev, |
362 | struct device_attribute *attr, char *buf) | 360 | struct device_attribute *attr, char *buf) |
363 | { | 361 | { |
364 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 362 | struct gk20a *g = get_gk20a(dev); |
365 | 363 | ||
366 | return snprintf(buf, PAGE_SIZE, "%d\n", platform->railgate_delay); | 364 | return snprintf(buf, PAGE_SIZE, "%d\n", g->railgate_delay); |
367 | } | 365 | } |
368 | static DEVICE_ATTR(railgate_delay, ROOTRW, railgate_delay_show, | 366 | static DEVICE_ATTR(railgate_delay, ROOTRW, railgate_delay_show, |
369 | railgate_delay_store); | 367 | railgate_delay_store); |