diff options
author | Vijayakumar <vsubbu@nvidia.com> | 2016-05-18 03:26:38 -0400 |
---|---|---|
committer | Bibek Basu <bbasu@nvidia.com> | 2016-05-23 02:54:45 -0400 |
commit | dc6aa0663f6341cb722f2e187d81ecf47e361eff (patch) | |
tree | 7e57ac18ab12cbbd2fd8b7ec36c7c63bae3fa954 /drivers/gpu | |
parent | 64f2e3ee9be32aab8bc7f3d373e4b89d60d3fe53 (diff) |
gpu: nvgpu: gk20a: fix elpg sysfs control
bug 200200943
When we enable ELPG through sysfs there is a possibility of
refcounting twice as enable ELPG function is done in
scheduled work during rail gating exit and also called from sysfs
write. Just updating elpg enable/disable flag is good enough
as ELPG code uses it during rail gating exit
Change-Id: Ibb267d4ce30b9848abcde29882b90d884ef213bb
Signed-off-by: Vijayakumar <vsubbu@nvidia.com>
Reviewed-on: http://git-master/r/1149587
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-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 | ||