diff mbox

[RFC,06/13] qcom: msm-pm: Add support for hotplug and secondary startup

Message ID 1407470722-23015-7-git-send-email-lina.iyer@linaro.org (mailing list archive)
State Deferred
Headers show

Commit Message

Lina Iyer Aug. 8, 2014, 4:05 a.m. UTC
Add hotplug and secondary startup entry point to cold or warm boot
secondary cpus.

Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
---
 drivers/soc/qcom/msm-pm.c | 36 ++++++++++++++++++++++++++++++++++++
 include/soc/qcom/pm.h     |  4 ++++
 2 files changed, 40 insertions(+)
diff mbox

Patch

diff --git a/drivers/soc/qcom/msm-pm.c b/drivers/soc/qcom/msm-pm.c
index 17a7c8c..4a6471d 100644
--- a/drivers/soc/qcom/msm-pm.c
+++ b/drivers/soc/qcom/msm-pm.c
@@ -216,3 +216,39 @@  bool msm_cpu_pm_enter_sleep(enum msm_pm_sleep_mode mode, bool from_idle)
 	return exit_stat;
 }
 EXPORT_SYMBOL(msm_cpu_pm_enter_sleep);
+
+/**
+ * msm_pm_cpu_hotplug_enter - Entry point for SoC hotplug interface
+ * Set up cores to enter deeper sleep modes than just clock gating
+ * Find the best deepest low power mode that can enter
+ *
+ * @cpu - The cpu that is being hotplugged off
+ */
+int msm_pm_cpu_hotplug_enter(unsigned int cpu)
+{
+	enum msm_pm_sleep_mode mode = MSM_PM_SLEEP_MODE_NR;
+	int ret;
+
+	if (msm_spm_is_mode_avail(MSM_SPM_MODE_POWER_COLLAPSE))
+		mode = MSM_PM_SLEEP_MODE_POWER_COLLAPSE;
+	else if (msm_spm_is_mode_avail( MSM_SPM_MODE_RETENTION))
+		mode = MSM_PM_SLEEP_MODE_RETENTION;
+	else
+		mode = MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT;
+
+	ret = msm_cpu_pm_enter_sleep(mode, false) ? 0 : -EFAULT;
+
+	return ret;
+}
+EXPORT_SYMBOL(msm_pm_cpu_hotplug_enter);
+
+/**
+ * msm_pm_secondary_startup() - Restore after hotplug resume
+ *
+ * @ cpu: the cpu thats coming up.
+ */
+int msm_pm_secondary_startup(unsigned int cpu)
+{
+	return msm_spm_set_low_power_mode(MSM_SPM_MODE_CLOCK_GATING, false);
+}
+EXPORT_SYMBOL(msm_pm_secondary_startup);
diff --git a/include/soc/qcom/pm.h b/include/soc/qcom/pm.h
index 01872ad..ed6124a 100644
--- a/include/soc/qcom/pm.h
+++ b/include/soc/qcom/pm.h
@@ -30,10 +30,14 @@  enum msm_pm_l2_scm_flag {
 
 #ifdef CONFIG_QCOM_PM
 bool msm_cpu_pm_enter_sleep(enum msm_pm_sleep_mode mode, bool from_idle);
+int msm_pm_cpu_hotplug_enter(unsigned int cpu);
+int msm_pm_secondary_startup(unsigned int cpu);
 #else
 static inline bool msm_cpu_pm_enter_sleep(enum msm_pm_sleep_mode mode,
 						bool from_idle)
 { return true; }
+static inline int msm_pm_cpu_hotplug_enter(unsigned int cpu) { return 0; }
+static inline int msm_pm_secondary_startup(unsigned int cpu) { return 0; }
 #endif
 
 #endif  /* __QCOM_PM_H */