video: tegra: host: gk20a: fix ELPG robustness
If we disable ELPG via sysfs node, enter suspend, then on subsequently
waking up, the ELPG ref count would get reset to 1, and then get reduced
to 0 by the forced disable call in PMU init. However, the subsequent
enable call will increment the ref count, but not actually enable ELPG,
becaues the sysfs command had set the ELPG enabled flag to false. This
causes an elpg_ref count imbalance, and all subsequent ELPG
enable/disable calls become suspect.
Therefore, we remove the check of elpg_enabled flag inside the
elpg_enable() routine. Instead, we just deduct and extra ref count when
we disable elpg via the sysfs. This way, as long as all usage of elpg is
balanced, our ref counts will ensure that elpg is disabled, and this
status can be maintained across railgates.
Bug
1410515
Change-Id: Ifdcb34c91d7a811e32d445003c4a15cc2678d507
Signed-off-by: Prashant Malani <pmalani@nvidia.com>
Reviewed-on: http://git-master/r/338049
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>