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

Commit f9aee28d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: cpuidle: Minimize round off errors in wake up time"

parents 44f5f07c a95247f5
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1123,6 +1123,8 @@ static int cluster_configure(struct lpm_cluster *cluster, int idx,
		struct cpumask nextcpu, *cpumask;
		uint64_t us;
		uint32_t pred_us;
		uint64_t sec;
		uint64_t nsec;

		us = get_cluster_sleep_time(cluster, &nextcpu,
						from_idle, &pred_us);
@@ -1134,11 +1136,20 @@ static int cluster_configure(struct lpm_cluster *cluster, int idx,
			goto failed_set_mode;
		}

		us = (us + 1) * 1000;
		clear_predict_history();
		clear_cl_predict_history();

		do_div(us, NSEC_PER_SEC/SCLK_HZ);
		us = us + 1;
		sec = us;
		do_div(sec, USEC_PER_SEC);
		nsec = us - sec * USEC_PER_SEC;

		sec = sec * SCLK_HZ;
		if (nsec > 0) {
			nsec = nsec * NSEC_PER_USEC;
			do_div(nsec, NSEC_PER_SEC/SCLK_HZ);
		}
		us = sec + nsec;
		msm_mpm_enter_sleep(us, from_idle, cpumask);
	}