diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index 29c92398..b68073af 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | |||
@@ -425,23 +425,25 @@ static ssize_t elpg_enable_store(struct device *dev, | |||
425 | if (kstrtoul(buf, 10, &val) < 0) | 425 | if (kstrtoul(buf, 10, &val) < 0) |
426 | return -EINVAL; | 426 | return -EINVAL; |
427 | 427 | ||
428 | /* | 428 | if (!g->power_on) { |
429 | * Since elpg is refcounted, we should not unnecessarily call | 429 | g->elpg_enabled = val ? true : false; |
430 | * enable/disable if it is already so. | 430 | } else { |
431 | */ | 431 | err = gk20a_busy(g->dev); |
432 | err = gk20a_busy(g->dev); | 432 | if (err) |
433 | if (err) | 433 | return -EAGAIN; |
434 | return -EAGAIN; | 434 | /* |
435 | 435 | * Since elpg is refcounted, we should not unnecessarily call | |
436 | if (val && !g->elpg_enabled) { | 436 | * enable/disable if it is already so. |
437 | g->elpg_enabled = true; | 437 | */ |
438 | gk20a_pmu_enable_elpg(g); | 438 | if (val && !g->elpg_enabled) { |
439 | } else if (!val && g->elpg_enabled) { | 439 | g->elpg_enabled = true; |
440 | g->elpg_enabled = false; | 440 | gk20a_pmu_enable_elpg(g); |
441 | gk20a_pmu_disable_elpg(g); | 441 | } else if (!val && g->elpg_enabled) { |
442 | g->elpg_enabled = false; | ||
443 | gk20a_pmu_disable_elpg(g); | ||
444 | } | ||
445 | gk20a_idle(g->dev); | ||
442 | } | 446 | } |
443 | gk20a_idle(g->dev); | ||
444 | |||
445 | dev_info(dev, "ELPG is %s.\n", g->elpg_enabled ? "enabled" : | 447 | dev_info(dev, "ELPG is %s.\n", g->elpg_enabled ? "enabled" : |
446 | "disabled"); | 448 | "disabled"); |
447 | 449 | ||