ANDROID: cpuidle: teo: Export a function that allows modifying util_threshold

There are some corner cases where we do worse in power because the
threshold is too low. Until these cases are better understood and
addressed upstream, provide a function for vendors to override this
value with something more suitable in their modules.

Bug: 289293494
Signed-off-by: Qais Yousef <qyousef@google.com>
Change-Id: I95dd36718a317f3fcb2a9f4bc87dd3390a4f7d7d
This commit is contained in:
Qais Yousef 2023-07-25 16:38:34 +00:00 committed by Treehugger Robot
parent 2490ab50e7
commit 20ecb229c5
2 changed files with 21 additions and 0 deletions

View File

@ -202,6 +202,19 @@ struct teo_cpu {
static DEFINE_PER_CPU(struct teo_cpu, teo_cpus);
unsigned long teo_cpu_get_util_threshold(int cpu)
{
struct teo_cpu *cpu_data = per_cpu_ptr(&teo_cpus, cpu);
return cpu_data->util_threshold;
}
EXPORT_SYMBOL_GPL(teo_cpu_get_util_threshold);
void teo_cpu_set_util_threshold(int cpu, unsigned long util)
{
struct teo_cpu *cpu_data = per_cpu_ptr(&teo_cpus, cpu);
cpu_data->util_threshold = util;
}
EXPORT_SYMBOL_GPL(teo_cpu_set_util_threshold);
/**
* teo_cpu_is_utilized - Check if the CPU's util is above the threshold
* @cpu: Target CPU

View File

@ -314,4 +314,12 @@ extern s64 cpuidle_governor_latency_req(unsigned int cpu);
#define CPU_PM_CPU_IDLE_ENTER_RETENTION_PARAM(low_level_idle_enter, idx, state) \
__CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, state, 1)
#ifdef CONFIG_CPU_IDLE_GOV_TEO
unsigned long teo_cpu_get_util_threshold(int cpu);
void teo_cpu_set_util_threshold(int cpu, unsigned long util);
#else
static inline unsigned long teo_cpu_get_util_threshold(int cpu) {return -1;}
static inline void teo_cpu_set_util_threshold(int cpu, unsigned long util) {}
#endif
#endif /* _LINUX_CPUIDLE_H */