msm: lpm-levels: Modify enter_sleep to communicate with RPM only for PC

Latency of WFI, SPC, RET increased during enter
sleep which caused significant boot delay. Modify enter_sleep
to process RPM communication only for PC.

Change-Id: I1fb3c89a904bf888b89960ea1bdd5c7f8fdc2212
Signed-off-by: Priyanka Mathur <pmathur@codeaurora.org>
diff --git a/arch/arm/mach-msm/lpm_levels.c b/arch/arm/mach-msm/lpm_levels.c
index 463f2a5..fcb4299 100644
--- a/arch/arm/mach-msm/lpm_levels.c
+++ b/arch/arm/mach-msm/lpm_levels.c
@@ -57,8 +57,6 @@
 		bool from_idle, bool notify_rpm)
 {
 	int ret = 0;
-	int debug_mask;
-	struct msm_rpmrs_limits *l = (struct msm_rpmrs_limits *)limits;
 	struct msm_lpm_sleep_data sleep_data;
 
 	sleep_data.limits = limits;
@@ -66,28 +64,34 @@
 	atomic_notifier_call_chain(&__get_cpu_var(lpm_notify_head),
 		MSM_LPM_STATE_ENTER, &sleep_data);
 
-	ret = msm_rpm_enter_sleep();
-	if (ret) {
-		pr_warn("%s(): RPM failed to enter sleep err:%d\n",
-				__func__, ret);
-		goto bail;
+	if (notify_rpm) {
+		int debug_mask;
+		struct msm_rpmrs_limits *l = (struct msm_rpmrs_limits *)limits;
+
+		ret = msm_rpm_enter_sleep();
+		if (ret) {
+			pr_warn("%s(): RPM failed to enter sleep err:%d\n",
+					__func__, ret);
+			goto bail;
+		}
+		if (from_idle)
+			debug_mask = msm_lpm_lvl_dbg_msk &
+					MSM_LPM_LVL_DBG_IDLE_LIMITS;
+		else
+			debug_mask = msm_lpm_lvl_dbg_msk &
+					MSM_LPM_LVL_DBG_SUSPEND_LIMITS;
+
+		if (debug_mask)
+			pr_info("%s(): pxo:%d l2:%d mem:0x%x(0x%x) dig:0x%x(0x%x)\n",
+					__func__, l->pxo, l->l2_cache,
+					l->vdd_mem_lower_bound,
+					l->vdd_mem_upper_bound,
+					l->vdd_dig_lower_bound,
+					l->vdd_dig_upper_bound);
+
+		ret = msm_lpmrs_enter_sleep(sclk_count, l, from_idle,
+				notify_rpm);
 	}
-	if (from_idle)
-		debug_mask = msm_lpm_lvl_dbg_msk &
-				MSM_LPM_LVL_DBG_IDLE_LIMITS;
-	else
-		debug_mask = msm_lpm_lvl_dbg_msk &
-				MSM_LPM_LVL_DBG_SUSPEND_LIMITS;
-
-	if (debug_mask)
-		pr_info("%s(): pxo:%d l2:%d mem:0x%x(0x%x) dig:0x%x(0x%x)\n",
-				__func__, l->pxo, l->l2_cache,
-				l->vdd_mem_lower_bound,
-				l->vdd_mem_upper_bound,
-				l->vdd_dig_lower_bound,
-				l->vdd_dig_upper_bound);
-
-	ret = msm_lpmrs_enter_sleep(sclk_count, l, from_idle, notify_rpm);
 bail:
 	return ret;
 }