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

Commit 71b28d5d authored by Maulik Shah's avatar Maulik Shah
Browse files

cpuidle: lpm-levels: Correct calculation for idx_restrict_time



Correctly compare with max residency of LPM modes to calculate
idx_restrict_time.

Change-Id: I2ce95b8159f51fca240712f4b1dae0e0e5b60397
Signed-off-by: default avatarMaulik Shah <mkshah@codeaurora.org>
parent d8f81fe4
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -505,7 +505,8 @@ static uint64_t lpm_cpuidle_predict(struct cpuidle_device *dev,
		for (j = 1; j < cpu->nlevels; j++) {
			struct lpm_cpu_level *level = &cpu->levels[j];
			uint32_t min_residency = level->pwr.min_residency;
			uint32_t max_residency = level->pwr.max_residency;
			uint32_t max_residency = 0;
			struct lpm_cpu_level *lvl;
			uint32_t failed = 0;
			uint64_t total = 0;

@@ -520,6 +521,8 @@ static uint64_t lpm_cpuidle_predict(struct cpuidle_device *dev,
				*idx_restrict = j;
				do_div(total, failed);
				for (i = 0; i < j; i++) {
					lvl = &cpu->levels[i];
					max_residency = lvl->pwr.max_residency;
					if (total < max_residency) {
						*idx_restrict = i + 1;
						total = max_residency;