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

Commit 5b3a3648 authored by Karthik Parsha's avatar Karthik Parsha Committed by Gerrit - the friendly Code Review server
Browse files

msm: lpm-levels: Save and restore cpu ctis on L2 SCU power transition



L2 SCU is turned off on L2 PC and L2 GDHS. Save and then restore cpu ctis
on L2 entering PC or GDHS and restore on exit.

Change-Id: I20360f8be213a634b5a4f9aa4cb7e0ef0aa263be
Signed-off-by: default avatarKarthik Parsha <kparsha@codeaurora.org>
parent 1ade5c36
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include <linux/remote_spinlock.h>
#include <linux/msm_remote_spinlock.h>
#include <linux/dma-mapping.h>
#include <linux/coresight-cti.h>
#include <soc/qcom/spm.h>
#include <soc/qcom/pm.h>
#include <soc/qcom/rpm-notifier.h>
@@ -178,18 +179,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;

	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;
		}
		break;
	default:
		lpm = MSM_SPM_MODE_DISABLED;