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

Commit 5c502df8 authored by Srinivas Rao L's avatar Srinivas Rao L
Browse files

lpm-levels: Add support for APC off with L2RAM ON mode



To support APCS_PMIC_OFF_L2RAM_ON mode, add support for
device tree entry to specify if L2 cache need not be flushed.

Change-Id: Id67c97359f73ea364d10f81b1d2623f2dcfe820a
Signed-off-by: default avatarSrinivas Rao L <lsrao@codeaurora.org>
parent 8c88a114
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -96,6 +96,8 @@ Optional properties:
	or not for the drivers to prepare for cluster collapse.
	- qcom,hyp-psci: This property is used to determine if the cpu
        enters the low power mode within hypervisor.
	- qcom,no-cache-flush: This boolean property will specify that cache
	will not be flushed and will be in retention for this mode.
	- qcom,reset-level: This property is used to determine in this
	low power mode only control logic power collapse happens or memory
	logic power collapse aswell happens or retention state.
+4 −1
Original line number Diff line number Diff line
@@ -358,7 +358,8 @@ static int parse_legacy_cluster_params(struct device_node *node,
	int ret;
	struct lpm_match {
		char *devname;
		int (*set_mode)(struct low_power_ops *, int, bool);
		int (*set_mode)(struct low_power_ops *, int,
					struct lpm_cluster_level *);
	};
	struct lpm_match match_tbl[] = {
		{"l2", set_l2_mode},
@@ -595,6 +596,8 @@ static int parse_cluster_level(struct device_node *node,
					"qcom,disable-dynamic-int-routing");
	level->last_core_only = of_property_read_bool(node,
					"qcom,last-core-only");
	level->no_cache_flush = of_property_read_bool(node,
					"qcom,no-cache-flush");

	key = "parse_power_params";
	ret = parse_power_params(node, &level->pwr);
+14 −5
Original line number Diff line number Diff line
@@ -354,10 +354,12 @@ static void msm_pm_set_timer(uint32_t modified_time_us)
	hrtimer_start(&lpm_hrtimer, modified_ktime, HRTIMER_MODE_REL_PINNED);
}

int set_l2_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
int set_l2_mode(struct low_power_ops *ops, int mode,
				struct lpm_cluster_level *level)
{
	int lpm = mode;
	int rc = 0;
	bool notify_rpm = level->notify_rpm;
	struct low_power_ops *cpu_ops = per_cpu(cpu_cluster,
			smp_processor_id())->lpm_dev;

@@ -369,6 +371,9 @@ int set_l2_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
	case MSM_SPM_MODE_STANDALONE_POWER_COLLAPSE:
	case MSM_SPM_MODE_POWER_COLLAPSE:
	case MSM_SPM_MODE_FASTPC:
		if (level->no_cache_flush)
			cpu_ops->tz_flag = MSM_SCM_L2_GDHS;
		else
			cpu_ops->tz_flag = MSM_SCM_L2_OFF;
		coresight_cti_ctx_save();
		break;
@@ -400,8 +405,10 @@ int set_l2_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
	return rc;
}

int set_l3_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
int set_l3_mode(struct low_power_ops *ops, int mode,
				struct lpm_cluster_level *level)
{
	bool notify_rpm = level->notify_rpm;
	struct low_power_ops *cpu_ops = per_cpu(cpu_cluster,
			smp_processor_id())->lpm_dev;

@@ -418,8 +425,10 @@ int set_l3_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
}


int set_system_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
int set_system_mode(struct low_power_ops *ops, int mode,
				struct lpm_cluster_level *level)
{
	bool notify_rpm = level->notify_rpm;
	return msm_spm_config_low_power_mode(ops->spm, mode, notify_rpm);
}

@@ -434,7 +443,7 @@ static int set_device_mode(struct lpm_cluster *cluster, int ndevice,
	ops = &cluster->lpm_dev[ndevice];
	if (ops && ops->set_mode)
		return ops->set_mode(ops, level->mode[ndevice],
				level->notify_rpm);
				level);
	else
		return -EINVAL;
}
+10 −5
Original line number Diff line number Diff line
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -76,11 +76,13 @@ struct lpm_cluster_level {
	unsigned int psci_id;
	bool is_reset;
	int reset_level;
	bool no_cache_flush;
};

struct low_power_ops {
	struct msm_spm_device *spm;
	int (*set_mode)(struct low_power_ops *ops, int mode, bool notify_rpm);
	int (*set_mode)(struct low_power_ops *ops, int mode,
				struct lpm_cluster_level *level);
	enum msm_pm_l2_scm_flag tz_flag;
};

@@ -110,9 +112,12 @@ struct lpm_cluster {
	bool no_saw_devices;
};

int set_l2_mode(struct low_power_ops *ops, int mode, bool notify_rpm);
int set_system_mode(struct low_power_ops *ops, int mode, bool notify_rpm);
int set_l3_mode(struct low_power_ops *ops, int mode, bool notify_rpm);
int set_l2_mode(struct low_power_ops *ops, int mode,
				struct lpm_cluster_level *level);
int set_system_mode(struct low_power_ops *ops, int mode,
				struct lpm_cluster_level *level);
int set_l3_mode(struct low_power_ops *ops, int mode,
				struct lpm_cluster_level *level);
void lpm_suspend_wake_time(uint64_t wakeup_time);

struct lpm_cluster *lpm_of_parse_cluster(struct platform_device *pdev);