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

Commit 0c2194e6 authored by Venkat Devarasetty's avatar Venkat Devarasetty
Browse files

msm: lpm: check for next wake up against current time



If the next wake up time for a core is less than the
current time then we should not subtract current time
from next event time which results in a large negative
value. In case the earliest event is expired already
then do not enter cluster low power mode.

Change-Id: Iab04ef9fa4a64e76817254f9c6af4af2d80abb26
Signed-off-by: default avatarVenkat Devarasetty <vdevaras@codeaurora.org>
parent c8100225
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -362,7 +362,11 @@ static uint64_t get_cluster_sleep_time(struct lpm_cluster *cluster,
	if (mask)
		cpumask_copy(mask, cpumask_of(next_cpu));


	if (ktime_to_us(next_event) > ktime_to_us(ktime_get()))
		return ktime_to_us(ktime_sub(next_event, ktime_get()));
	else
		return 0;
}

static int cluster_select(struct lpm_cluster *cluster, bool from_idle)
@@ -377,7 +381,7 @@ static int cluster_select(struct lpm_cluster *cluster, bool from_idle)
	if (!cluster)
		return -EINVAL;

	sleep_us = get_cluster_sleep_time(cluster, NULL, from_idle);
	sleep_us = (uint32_t)get_cluster_sleep_time(cluster, NULL, from_idle);

	for (i = 0; i < cluster->nlevels; i++) {
		struct lpm_cluster_level *level = &cluster->levels[i];