Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117567
b: refs/heads/master
c: e3f91ca
h: refs/heads/master
i:
  117565: b9e890c
  117563: b0b6fcc
  117559: d0da66e
  117551: 61a4d20
  117535: 3af16d6
  117503: 5c62248
v: v3
  • Loading branch information
Haavard Skinnemoen committed Oct 23, 2008
1 parent d0f2c61 commit 309c637
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6090065663ba5daab82d116d3040dc924e8cf79f
refs/heads/master: e3f91ca48162c3eb70450314a4d09384fccb92fa
14 changes: 14 additions & 0 deletions trunk/arch/avr32/mach-at32ap/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ static unsigned int at32_get_speed(unsigned int cpu)
return (unsigned int)((clk_get_rate(cpuclk) + 500) / 1000);
}

static unsigned int ref_freq;
static unsigned long loops_per_jiffy_ref;

static int at32_set_target(struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int relation)
Expand All @@ -61,8 +64,19 @@ static int at32_set_target(struct cpufreq_policy *policy,
freqs.cpu = 0;
freqs.flags = 0;

if (!ref_freq) {
ref_freq = freqs.old;
loops_per_jiffy_ref = boot_cpu_data.loops_per_jiffy;
}

cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
if (freqs.old < freqs.new)
boot_cpu_data.loops_per_jiffy = cpufreq_scale(
loops_per_jiffy_ref, ref_freq, freqs.new);
clk_set_rate(cpuclk, freq);
if (freqs.new < freqs.old)
boot_cpu_data.loops_per_jiffy = cpufreq_scale(
loops_per_jiffy_ref, ref_freq, freqs.new);
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);

pr_debug("cpufreq: set frequency %lu Hz\n", freq);
Expand Down

0 comments on commit 309c637

Please sign in to comment.