Skip to content

Commit

Permalink
EXYNOS: bugfix on retrieving old_index from freqs.old
Browse files Browse the repository at this point in the history
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 <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
  • Loading branch information
Jonghwa Lee authored and Rafael J. Wysocki committed Jul 20, 2012
1 parent 84a1caf commit 53df1ad
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions drivers/cpufreq/exynos-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,18 @@ static int exynos_target(struct cpufreq_policy *policy,
goto out;
}

if (cpufreq_frequency_table_target(policy, freq_table,
freqs.old, relation, &old_index)) {
/*
* The policy max have been changed so that we cannot get proper
* old_index with cpufreq_frequency_table_target(). Thus, ignore
* policy and get the index from the raw freqeuncy table.
*/
for (old_index = 0;
freq_table[old_index].frequency != CPUFREQ_TABLE_END;
old_index++)
if (freq_table[old_index].frequency == freqs.old)
break;

if (freq_table[old_index].frequency == CPUFREQ_TABLE_END) {
ret = -EINVAL;
goto out;
}
Expand Down

0 comments on commit 53df1ad

Please sign in to comment.