diff mbox

[RFC,10/13] qcom: platsmp: Enable deeper idle states for hotplug

Message ID 1407470722-23015-11-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
Allow cpu and system deeper sleep modes when a cpu is hotplugged.
Calling wfi() executes architectural clock gating supported by the ARM
core, while this is useful, it does not save leakage power and does not
help in reducing power in the peripheral logic surrounding the cpu.

QCOM platforms have a sub-system power manager to control the logic
around the core. Pass the hotplug call over to SoC idle interface driver
to allow for the core and the peripheral logic to enter low power when
hotplugged.

Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
---
 arch/arm/mach-qcom/platsmp.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/arch/arm/mach-qcom/platsmp.c b/arch/arm/mach-qcom/platsmp.c
index d690856..c40f220 100644
--- a/arch/arm/mach-qcom/platsmp.c
+++ b/arch/arm/mach-qcom/platsmp.c
@@ -20,7 +20,8 @@ 
 
 #include <asm/smp_plat.h>
 
-#include "scm-boot.h"
+#include <soc/qcom/scm-boot.h>
+#include <soc/qcom/pm.h>
 
 #define VDD_SC1_ARRAY_CLAMP_GFS_CTL	0x35a0
 #define SCSS_CPU1CORE_RESET		0x2d80
@@ -51,12 +52,30 @@  static DEFINE_SPINLOCK(boot_lock);
 #ifdef CONFIG_HOTPLUG_CPU
 static void __ref qcom_cpu_die(unsigned int cpu)
 {
+#if defined CONFIG_QCOM_PM
+	for (;;)
+		msm_pm_cpu_hotplug_enter(cpu);
+#else
 	wfi();
+#endif
+}
+
+static int __ref qcom_cpu_kill(unsigned int cpu)
+{
+	int ret = 0;
+
+#if defined CONFIG_QCOM_PM
+	ret = msm_pm_wait_cpu_shutdown(cpu) ? 0 : 1;
+#endif
+	return ret;
 }
+
 #endif
 
 static void qcom_secondary_init(unsigned int cpu)
 {
+	msm_pm_secondary_startup(cpu);
+
 	/*
 	 * Synchronise with the boot thread.
 	 */
@@ -373,6 +392,7 @@  static struct smp_operations qcom_smp_kpssv2_ops __initdata = {
 	.smp_boot_secondary	= kpssv2_boot_secondary,
 #ifdef CONFIG_HOTPLUG_CPU
 	.cpu_die		= qcom_cpu_die,
+	.cpu_kill		= qcom_cpu_kill,
 #endif
 };
 CPU_METHOD_OF_DECLARE(qcom_smp_kpssv2, "qcom,kpss-acc-v2", &qcom_smp_kpssv2_ops);