From: lakkyung.jung Date: Wed, 14 Mar 2018 04:18:58 +0000 (+0900) Subject: [COMMON] cpuidle: Add to get target residency for cpu. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=642a403b1315921066689b0dfdac8716ae7cac13;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] cpuidle: Add to get target residency for cpu. Change-Id: I9c59acd8bdda34d7071d8512c8551dcb76eee5b5 Signed-off-by: lakkyung.jung --- diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 6158f57ebdb8..3adf36b56c2b 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -51,6 +51,23 @@ bool cpuidle_not_available(struct cpuidle_driver *drv, return off || !initialized || !drv || !dev || !dev->enabled; } +unsigned int cpuidle_get_target_residency(int cpu, int state) +{ + struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu); + struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); + struct cpuidle_state *s; + unsigned int target_residency = INT_MAX; + + if (!drv) + goto exit_func; + + s = &drv->states[state]; + target_residency = s->target_residency; + +exit_func: + return target_residency; +} + /** * cpuidle_play_dead - cpu off-lining * diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index ad33507b34be..fc115a352fe4 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -157,6 +157,7 @@ extern int cpuidle_play_dead(void); extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); static inline struct cpuidle_device *cpuidle_get_device(void) {return __this_cpu_read(cpuidle_devices); } +extern unsigned int cpuidle_get_target_residency(int cpu, int state); #else static inline void disable_cpuidle(void) { } static inline bool cpuidle_not_available(struct cpuidle_driver *drv, @@ -193,6 +194,7 @@ static inline int cpuidle_play_dead(void) {return -ENODEV; } static inline struct cpuidle_driver *cpuidle_get_cpu_driver( struct cpuidle_device *dev) {return NULL; } static inline struct cpuidle_device *cpuidle_get_device(void) {return NULL; } +static inline unsigned int cpuidle_get_target_residency(int cpu, int state) {return UINT_MAX;} #endif #ifdef CONFIG_CPU_IDLE