Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32bf6b89 authored by Anji Jonnala's avatar Anji Jonnala Committed by Maulik Shah
Browse files

cpuidle: lpm-levels: Provide API to set wake up time from suspend



Drivers like alarm can use this API to provide the wakeup time
from suspend, vMPM driver sends this time to RPM to be programmed
in MPM to wake up APSS from deep sleep.

Change-Id: I77d5ecad1735cd1daa47491ea6290b854e422812
Signed-off-by: default avatarAnji Jonnala <anjir@codeaurora.org>
Signed-off-by: default avatarMaulik Shah <mkshah@codeaurora.org>
parent 7f13d925
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ module_param_named(
static int msm_pm_sleep_time_override;
module_param_named(sleep_time_override,
	msm_pm_sleep_time_override, int, S_IRUGO | S_IWUSR | S_IWGRP);
static uint64_t suspend_wake_time;

static bool print_parsed_dt;
module_param_named(
@@ -122,6 +123,21 @@ s32 msm_cpuidle_get_deep_idle_latency(void)
	return 10;
}

void lpm_suspend_wake_time(uint64_t wakeup_time)
{
	if (wakeup_time <= 0) {
		suspend_wake_time = msm_pm_sleep_time_override;
		return;
	}

	if (msm_pm_sleep_time_override &&
		(msm_pm_sleep_time_override < wakeup_time))
		suspend_wake_time = msm_pm_sleep_time_override;
	else
		suspend_wake_time = wakeup_time;
}
EXPORT_SYMBOL(lpm_suspend_wake_time);

static void update_debug_pc_event(enum debug_event event, uint32_t arg1,
		uint32_t arg2, uint32_t arg3, uint32_t arg4)
{
@@ -376,14 +392,15 @@ static uint64_t get_cluster_sleep_time(struct lpm_cluster *cluster,
	struct cpumask online_cpus_in_cluster;

	next_event.tv64 = KTIME_MAX;

	if (!suspend_wake_time)
		suspend_wake_time =  msm_pm_sleep_time_override;
	if (!from_idle) {
		if (mask)
			cpumask_copy(mask, cpumask_of(raw_smp_processor_id()));
		if (!msm_pm_sleep_time_override)
		if (!suspend_wake_time)
			return ~0ULL;
		else
			return USEC_PER_SEC * msm_pm_sleep_time_override;
			return USEC_PER_SEC * suspend_wake_time;
	}

	cpumask_and(&online_cpus_in_cluster,
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ struct lpm_cluster {
int set_l2_mode(struct low_power_ops *ops, int mode, bool notify_rpm);
int set_system_mode(struct low_power_ops *ops, int mode, bool notify_rpm);
int set_l3_mode(struct low_power_ops *ops, int mode, bool notify_rpm);
void lpm_suspend_wake_time(uint64_t wakeup_time);

struct lpm_cluster *lpm_of_parse_cluster(struct platform_device *pdev);
void free_cluster_node(struct lpm_cluster *cluster);