msm: pm2: Add CPR specific function callbacks to PM driver
CPR(Core Power Reduction) is a new h/w block added in 8x25
2.0 revision. This block reduce the power consumption of
SOC using sensors inside the SOC. Add function callbacks to
PM driver to perform disable, enable, save and restore of
CPR context data when the core do an IdlePC.
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
(cherry picked from commit ff723ece018452e722155daa67ff0fdd65cc5c96)
Change-Id: Ideb6300ce1afe9976853e47ab9f1eec2ef22c77e
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
diff --git a/arch/arm/mach-msm/pm2.c b/arch/arm/mach-msm/pm2.c
index 8fccda4..10c5445 100644
--- a/arch/arm/mach-msm/pm2.c
+++ b/arch/arm/mach-msm/pm2.c
@@ -152,6 +152,7 @@
static struct msm_pm_platform_data *msm_pm_modes;
static struct msm_pm_irq_calls *msm_pm_irq_extns;
+static struct msm_pm_cpr_ops *msm_cpr_ops;
struct msm_pm_kobj_attribute {
unsigned int cpu;
@@ -415,6 +416,11 @@
msm_pm_irq_extns = irq_calls;
}
+void __init msm_pm_set_cpr_ops(struct msm_pm_cpr_ops *ops)
+{
+ msm_cpr_ops = ops;
+}
+
/******************************************************************************
* Sleep Limitations
*****************************************************************************/
@@ -876,6 +882,10 @@
WARN_ON(ret);
}
+ /* Call CPR suspend only for "idlePC" case */
+ if (msm_cpr_ops && from_idle)
+ msm_cpr_ops->cpr_suspend();
+
msm_pm_irq_extns->enter_sleep1(true, from_idle,
&msm_pm_smem_data->irq_mask);
msm_sirc_enter_sleep();
@@ -1113,6 +1123,10 @@
WARN_ON(ret);
}
+ /* Call CPR resume only for "idlePC" case */
+ if (msm_cpr_ops && from_idle)
+ msm_cpr_ops->cpr_resume();
+
return 0;
power_collapse_early_exit:
@@ -1165,6 +1179,10 @@
if (collapsed)
smd_sleep_exit();
+ /* Call CPR resume only for "idlePC" case */
+ if (msm_cpr_ops && from_idle)
+ msm_cpr_ops->cpr_resume();
+
power_collapse_bail:
if (cpu_is_msm8625()) {
ret = msm_spm_set_low_power_mode(MSM_SPM_MODE_CLOCK_GATING,