msm: lpm-levels: Fix issue with coresight save/restore

The coresight save/restore functions needs to be called when the L2 of the
respective clusters are placed in power collapse/GDHS. On a multi-cluster
system, keeping track of this using a static variable could result in
incorrect save/restore of CTI registers. Fix by using a variable
associated with a cluster.

Change-Id: Ib4ba5790af2a9e3bc245f1ef5010930b5cf4921c
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
This commit is contained in:
Mahesh Sivasubramanian 2014-08-06 10:13:50 -06:00
parent e92aa60f73
commit b15fe8e06e
1 changed files with 6 additions and 8 deletions

View File

@ -189,29 +189,27 @@ int set_l2_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
{
int lpm = mode;
int rc = 0;
static bool coresight_saved;
ops->tz_flag = MSM_SCM_L2_ON;
if (ops->tz_flag == MSM_SCM_L2_OFF ||
ops->tz_flag == MSM_SCM_L2_GDHS)
coresight_cti_ctx_restore();
switch (mode) {
case MSM_SPM_MODE_POWER_COLLAPSE:
ops->tz_flag = MSM_SCM_L2_OFF;
coresight_cti_ctx_save();
coresight_saved = true;
break;
case MSM_SPM_MODE_GDHS:
ops->tz_flag = MSM_SCM_L2_GDHS;
coresight_cti_ctx_save();
coresight_saved = true;
break;
case MSM_SPM_MODE_RETENTION:
case MSM_SPM_MODE_DISABLED:
if (coresight_saved) {
coresight_cti_ctx_restore();
coresight_saved = false;
}
ops->tz_flag = MSM_SCM_L2_ON;
break;
default:
ops->tz_flag = MSM_SCM_L2_ON;
lpm = MSM_SPM_MODE_DISABLED;
break;
}