Skip to content

Commit 53df1ad

Browse files
batcheurjwysocki
authored andcommitted
EXYNOS: bugfix on retrieving old_index from freqs.old
The policy might have been changed since last call of target(). Thus, using cpufreq_frequency_table_target(), which depends on policy to find the corresponding index from a frequency, may return inconsistent index for freqs.old. Thus, old_index should be calculated not based on the current policy. We have been observing such issue when scaling_min/max_freq were updated and sometimes cuased system lockups deu to incorrectly configured voltages. Signed-off-by: MyungJoo Ham <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 84a1caf commit 53df1ad

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/cpufreq/exynos-cpufreq.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,18 @@ static int exynos_target(struct cpufreq_policy *policy,
6262
goto out;
6363
}
6464

65-
if (cpufreq_frequency_table_target(policy, freq_table,
66-
freqs.old, relation, &old_index)) {
65+
/*
66+
* The policy max have been changed so that we cannot get proper
67+
* old_index with cpufreq_frequency_table_target(). Thus, ignore
68+
* policy and get the index from the raw freqeuncy table.
69+
*/
70+
for (old_index = 0;
71+
freq_table[old_index].frequency != CPUFREQ_TABLE_END;
72+
old_index++)
73+
if (freq_table[old_index].frequency == freqs.old)
74+
break;
75+
76+
if (freq_table[old_index].frequency == CPUFREQ_TABLE_END) {
6777
ret = -EINVAL;
6878
goto out;
6979
}

0 commit comments

Comments
 (0)