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

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

msm: spm: Add support to trigger SPM with q-channel for clock gating



On some targets, the SPM can be triggered using a Q-channel instead of
relying on wfi to trigger a low power mode. As wfe command also triggers
the Q-channel, SPM can be triggered for clock gating using wfe as well.
This along side the SPM commands to stagger a wakeup of a core, can be used
to stagger wake up out of wfi/wfe using SPM.

Change-Id: Ie2897607c7361f2b6c291f68f27d3929a4fd0cb3
Signed-off-by: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
parent e22a9bf6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -64,6 +64,9 @@ only on SAW2 v3.0 and above.
	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.
- qcom,use-qchannel-for-wfi: This boolean property is used to indicate
	that the SPM gets triggerd by the qchannel and not by means of
	wfi. So a wfe could trigger a spm for clock gating as well.

Example 1:
	qcom,spm@f9089000 {
+6 −6
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ struct msm_spm_device {
	bool qchannel_ignore;
	bool allow_rpm_hs;
	bool use_spm_clk_gating;
	bool use_qchannel_for_wfi;
};

struct msm_spm_vdd_info {
@@ -162,8 +163,8 @@ static void msm_spm_config_q2s(struct msm_spm_device *dev, unsigned int mode)
	switch (mode) {
	case MSM_SPM_MODE_DISABLED:
	case MSM_SPM_MODE_CLOCK_GATING:
		qchannel_ignore = 1;
		spm_legacy_mode = dev->use_spm_clk_gating;
		qchannel_ignore = !dev->use_qchannel_for_wfi;
		spm_legacy_mode = 0;
		break;
	case MSM_SPM_MODE_RETENTION:
		qchannel_ignore = 0;
@@ -198,10 +199,6 @@ 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)) {
@@ -638,6 +635,9 @@ static int msm_spm_dev_probe(struct platform_device *pdev)
	key = "qcom,use-spm-clock-gating";
	dev->use_spm_clk_gating = of_property_read_bool(node, key);

	key = "qcom,use-qchannel-for-wfi";
	dev->use_qchannel_for_wfi = 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