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

This commit is contained in:
Linux Build Service Account 2017-04-02 22:02:29 -07:00 committed by Gerrit - the friendly Code Review server
commit f9aee28de6

View file

@ -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);
}