diff options
Diffstat (limited to 'firmware/system.c')
-rw-r--r-- | firmware/system.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/firmware/system.c b/firmware/system.c index 66bd90f71b..c01d1270d7 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -30,6 +30,7 @@ long cpu_frequency = CPU_FREQ; | |||
30 | 30 | ||
31 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 31 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
32 | int boost_counter = 0; | 32 | int boost_counter = 0; |
33 | bool cpu_idle = false; | ||
33 | void cpu_boost(bool on_off) | 34 | void cpu_boost(bool on_off) |
34 | { | 35 | { |
35 | if(on_off) | 36 | if(on_off) |
@@ -45,7 +46,10 @@ void cpu_boost(bool on_off) | |||
45 | /* Lower the frequency if the counter reaches 0 */ | 46 | /* Lower the frequency if the counter reaches 0 */ |
46 | if(--boost_counter == 0) | 47 | if(--boost_counter == 0) |
47 | { | 48 | { |
48 | set_cpu_frequency(CPUFREQ_NORMAL); | 49 | if(cpu_idle) |
50 | set_cpu_frequency(CPUFREQ_DEFAULT); | ||
51 | else | ||
52 | set_cpu_frequency(CPUFREQ_NORMAL); | ||
49 | } | 53 | } |
50 | 54 | ||
51 | /* Safety measure */ | 55 | /* Safety measure */ |
@@ -53,6 +57,22 @@ void cpu_boost(bool on_off) | |||
53 | boost_counter = 0; | 57 | boost_counter = 0; |
54 | } | 58 | } |
55 | } | 59 | } |
60 | |||
61 | void cpu_idle_mode(bool on_off) | ||
62 | { | ||
63 | cpu_idle = on_off; | ||
64 | |||
65 | /* We need to adjust the frequency immediately if the CPU | ||
66 | isn't boosted */ | ||
67 | if(boost_counter == 0) | ||
68 | { | ||
69 | if(cpu_idle) | ||
70 | set_cpu_frequency(CPUFREQ_DEFAULT); | ||
71 | else | ||
72 | set_cpu_frequency(CPUFREQ_NORMAL); | ||
73 | } | ||
74 | } | ||
75 | |||
56 | #endif | 76 | #endif |
57 | 77 | ||
58 | #if CONFIG_CPU == TCC730 | 78 | #if CONFIG_CPU == TCC730 |