Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b15fe8e0 authored by Mahesh Sivasubramanian's avatar Mahesh Sivasubramanian
Browse files

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: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
parent e92aa60f
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -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;
	}