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

Commit 6c549a92 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: spm: Add support to use SPM for clock gating mode"

parents 5ef7fef0 657774e4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -60,6 +60,10 @@ Optional properties
- qcom,supports-rpm-hs: Indicates that this SPM instance allow handshake with
RPM processor when executing the sleep command in the SPM sequence. Supported
only on SAW2 v3.0 and above.
- qcom,use-spm-clock-gating: This boolean property is used to indicate that
	the SPM needs to be used for clock gating. Using the SPM for clock
	gating would result in auto clock gating being disabled. Use this on
	targets that do not support or do not use auto clock gating.

Example 1:
	qcom,spm@f9089000 {
+2 −4
Original line number Diff line number Diff line
@@ -205,6 +205,7 @@ int set_l2_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
		ops->tz_flag = MSM_SCM_L2_GDHS;
		coresight_cti_ctx_save();
		break;
	case MSM_SPM_MODE_CLOCK_GATING:
	case MSM_SPM_MODE_RETENTION:
	case MSM_SPM_MODE_DISABLED:
		ops->tz_flag = MSM_SCM_L2_ON;
@@ -225,10 +226,7 @@ int set_l2_mode(struct low_power_ops *ops, int mode, bool notify_rpm)

int set_cci_mode(struct low_power_ops *ops, int mode, bool notify_rpm)
{
	int lpm = mode;
	if (mode == MSM_SPM_MODE_CLOCK_GATING)
		lpm = MSM_SPM_MODE_DISABLED;
	return msm_spm_config_low_power_mode(ops->spm, lpm, notify_rpm);
	return msm_spm_config_low_power_mode(ops->spm, mode, notify_rpm);
}

static int cpu_power_select(struct cpuidle_device *dev,
+9 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ struct msm_spm_device {
	void __iomem *q2s_reg;
	bool qchannel_ignore;
	bool allow_rpm_hs;
	bool use_spm_clk_gating;
};

struct msm_spm_vdd_info {
@@ -162,7 +163,7 @@ static void msm_spm_config_q2s(struct msm_spm_device *dev, unsigned int mode)
	case MSM_SPM_MODE_DISABLED:
	case MSM_SPM_MODE_CLOCK_GATING:
		qchannel_ignore = 1;
		spm_legacy_mode = 0;
		spm_legacy_mode = dev->use_spm_clk_gating;
		break;
	case MSM_SPM_MODE_RETENTION:
		qchannel_ignore = 0;
@@ -197,6 +198,10 @@ static int msm_spm_dev_set_low_power_mode(struct msm_spm_device *dev,
			|| (mode == MSM_SPM_MODE_GDHS))
		pc_mode = true;

	if ((mode == MSM_SPM_MODE_CLOCK_GATING)
			&& (!dev->use_spm_clk_gating))
		mode = MSM_SPM_MODE_DISABLED;

	if (mode == MSM_SPM_MODE_DISABLED) {
		ret = msm_spm_drv_set_spm_enable(&dev->reg_data, false);
	} else if (!msm_spm_drv_set_spm_enable(&dev->reg_data, true)) {
@@ -630,6 +635,9 @@ static int msm_spm_dev_probe(struct platform_device *pdev)
	key = "qcom,use-qchannel-for-pc";
	dev->qchannel_ignore = !of_property_read_bool(node, key);

	key = "qcom,use-spm-clock-gating";
	dev->use_spm_clk_gating = of_property_read_bool(node, key);

	/*
	 * At system boot, cpus and or clusters can remain in reset. CCI SPM
	 * will not be triggered unless SPM_LEGACY_MODE bit is set for the