PD #98831(97021): fit cpu frequent out of avaliable table to proper cooling state

When you set a value scaling_max_freq of cpu frequent which is not in
scaling_avaliable_table, thermal governor will got a wrong cooling_state
when doing step_wise and force update state of each trip point.This will
cause scaling_max_freq loop between each trip point limitation.

Change-Id: I8d04761474b02868db824157e0d549ed76341c80
This commit is contained in:
tao.zeng
2014-09-02 03:20:12 +00:00
committed by Mauro Ribeiro
parent c7456bb262
commit e93d34d925

View File

@@ -195,10 +195,21 @@ static int get_property(unsigned int cpu, unsigned long input,
/* now we have a valid frequency entry */
freq = table[i].frequency;
if (property == GET_LEVEL && (unsigned int)input == freq) {
if (property == GET_LEVEL) {
/* get level by frequency */
*output = descend ? j : (max_level - j - 1);
return 0;
if (descend && input >= freq) {
*output = (j - 1);
if (input != freq) {
pr_debug("descend, fit %ld to level:%d, next freq:%d\n", input, *output, freq);
}
return 0;
} else if (!descend && input <= freq) {
*output = (max_level - j - 1);
if (input != freq) {
pr_debug("ascend, fit %ld to level:%d, next freq:%d\n", input, *output, freq);
}
return 0;
}
}
if (property == GET_FREQ && level == j) {
/* get frequency by level */