msm: pm: Add API to get deep idle latency

Previously a driver could grab an idle wakelock and prevent the
deep idle sleep states associated with remote processor assisted
power collapse (either via the modem or the RPM). With the
removal of idle wakelocks we must replace them with equivalent
upstream compatabile APIs. Since the drivers are actually
expressing their desire to prevent certain CPU latencys add an
API to expose the latency of deep idle sleep to drivers.

It's expected that this API will be removed once drivers properly
specify their latency requirements.

Change-Id: Iebeb17009fca1486fddda4f78f4952080096234a
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
This commit is contained in:
Stephen Boyd
2012-06-06 18:52:51 -07:00
committed by Steve Muckle
parent 5a586c1b4d
commit 3f4bac202b
4 changed files with 55 additions and 2 deletions
+3 -2
View File
@@ -26,10 +26,11 @@ struct msm_cpuidle_state {
};
#ifdef CONFIG_CPU_IDLE
s32 msm_cpuidle_get_deep_idle_latency(void);
int msm_cpuidle_init(void);
#else
static inline int msm_cpuidle_init(void)
{ return -ENOSYS; }
static inline int msm_cpuidle_init(void) { return -ENOSYS; }
static inline s32 msm_cpuidle_get_deep_idle_latency(void) { return 0; }
#endif
#ifdef CONFIG_MSM_SLEEP_STATS
+23
View File
@@ -51,6 +51,29 @@ void msm_rpmrs_show_resources(void)
return;
}
s32 msm_cpuidle_get_deep_idle_latency(void)
{
int i;
struct msm_rpmrs_level *level = msm_lpm_levels, *best = level;
if (!level)
return 0;
for (i = 0; i < msm_lpm_level_count; i++, level++) {
if (!level->available)
continue;
if (level->sleep_mode != MSM_PM_SLEEP_MODE_POWER_COLLAPSE)
continue;
/* Pick the first power collapse mode by default */
if (best->sleep_mode != MSM_PM_SLEEP_MODE_POWER_COLLAPSE)
best = level;
/* Find the lowest latency for power collapse */
if (level->latency_us < best->latency_us)
best = level;
}
return best->latency_us - 1;
}
static void *msm_lpm_lowest_limits(bool from_idle,
enum msm_pm_sleep_mode sleep_mode, uint32_t latency_us,
uint32_t sleep_us, uint32_t *power)
+6
View File
@@ -394,6 +394,12 @@ mode_sysfs_add_exit:
return ret;
}
s32 msm_cpuidle_get_deep_idle_latency(void)
{
int i = MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN);
return msm_pm_modes[i].latency - 1;
}
void __init msm_pm_set_platform_data(
struct msm_pm_platform_data *data, int count)
{
+23
View File
@@ -867,6 +867,29 @@ void msm_rpmrs_show_resources(void)
spin_unlock_irqrestore(&msm_rpmrs_lock, flags);
}
s32 msm_cpuidle_get_deep_idle_latency(void)
{
int i;
struct msm_rpmrs_level *level = msm_rpmrs_levels, *best = level;
if (!level)
return 0;
for (i = 0; i < msm_rpmrs_level_count; i++, level++) {
if (!level->available)
continue;
if (level->sleep_mode != MSM_PM_SLEEP_MODE_POWER_COLLAPSE)
continue;
/* Pick the first power collapse mode by default */
if (best->sleep_mode != MSM_PM_SLEEP_MODE_POWER_COLLAPSE)
best = level;
/* Find the lowest latency for power collapse */
if (level->latency_us < best->latency_us)
best = level;
}
return best->latency_us - 1;
}
static void *msm_rpmrs_lowest_limits(bool from_idle,
enum msm_pm_sleep_mode sleep_mode, uint32_t latency_us,
uint32_t sleep_us, uint32_t *power)