mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
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>
This commit is contained in:
@@ -425,23 +425,25 @@ static ssize_t elpg_enable_store(struct device *dev,
|
||||
if (kstrtoul(buf, 10, &val) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* Since elpg is refcounted, we should not unnecessarily call
|
||||
* enable/disable if it is already so.
|
||||
*/
|
||||
err = gk20a_busy(g->dev);
|
||||
if (err)
|
||||
return -EAGAIN;
|
||||
|
||||
if (val && !g->elpg_enabled) {
|
||||
g->elpg_enabled = true;
|
||||
gk20a_pmu_enable_elpg(g);
|
||||
} else if (!val && g->elpg_enabled) {
|
||||
g->elpg_enabled = false;
|
||||
gk20a_pmu_disable_elpg(g);
|
||||
if (!g->power_on) {
|
||||
g->elpg_enabled = val ? true : false;
|
||||
} else {
|
||||
err = gk20a_busy(g->dev);
|
||||
if (err)
|
||||
return -EAGAIN;
|
||||
/*
|
||||
* Since elpg is refcounted, we should not unnecessarily call
|
||||
* enable/disable if it is already so.
|
||||
*/
|
||||
if (val && !g->elpg_enabled) {
|
||||
g->elpg_enabled = true;
|
||||
gk20a_pmu_enable_elpg(g);
|
||||
} else if (!val && g->elpg_enabled) {
|
||||
g->elpg_enabled = false;
|
||||
gk20a_pmu_disable_elpg(g);
|
||||
}
|
||||
gk20a_idle(g->dev);
|
||||
}
|
||||
gk20a_idle(g->dev);
|
||||
|
||||
dev_info(dev, "ELPG is %s.\n", g->elpg_enabled ? "enabled" :
|
||||
"disabled");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user