diff options
Diffstat (limited to 'drivers/cpufreq/db8500-cpufreq.c')
-rw-r--r-- | drivers/cpufreq/db8500-cpufreq.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/drivers/cpufreq/db8500-cpufreq.c b/drivers/cpufreq/db8500-cpufreq.c index d90456a809f..f5002015d82 100644 --- a/drivers/cpufreq/db8500-cpufreq.c +++ b/drivers/cpufreq/db8500-cpufreq.c | |||
@@ -12,30 +12,35 @@ | |||
12 | #include <linux/cpufreq.h> | 12 | #include <linux/cpufreq.h> |
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/mfd/db8500-prcmu.h> | 15 | #include <linux/mfd/dbx500-prcmu.h> |
16 | #include <mach/id.h> | 16 | #include <mach/id.h> |
17 | 17 | ||
18 | static struct cpufreq_frequency_table freq_table[] = { | 18 | static struct cpufreq_frequency_table freq_table[] = { |
19 | [0] = { | 19 | [0] = { |
20 | .index = 0, | 20 | .index = 0, |
21 | .frequency = 300000, | 21 | .frequency = 200000, |
22 | }, | 22 | }, |
23 | [1] = { | 23 | [1] = { |
24 | .index = 1, | 24 | .index = 1, |
25 | .frequency = 600000, | 25 | .frequency = 300000, |
26 | }, | 26 | }, |
27 | [2] = { | 27 | [2] = { |
28 | /* Used for MAX_OPP, if available */ | ||
29 | .index = 2, | 28 | .index = 2, |
30 | .frequency = CPUFREQ_TABLE_END, | 29 | .frequency = 600000, |
31 | }, | 30 | }, |
32 | [3] = { | 31 | [3] = { |
32 | /* Used for MAX_OPP, if available */ | ||
33 | .index = 3, | 33 | .index = 3, |
34 | .frequency = CPUFREQ_TABLE_END, | 34 | .frequency = CPUFREQ_TABLE_END, |
35 | }, | 35 | }, |
36 | [4] = { | ||
37 | .index = 4, | ||
38 | .frequency = CPUFREQ_TABLE_END, | ||
39 | }, | ||
36 | }; | 40 | }; |
37 | 41 | ||
38 | static enum arm_opp idx2opp[] = { | 42 | static enum arm_opp idx2opp[] = { |
43 | ARM_EXTCLK, | ||
39 | ARM_50_OPP, | 44 | ARM_50_OPP, |
40 | ARM_100_OPP, | 45 | ARM_100_OPP, |
41 | ARM_MAX_OPP | 46 | ARM_MAX_OPP |
@@ -72,13 +77,13 @@ static int db8500_cpufreq_target(struct cpufreq_policy *policy, | |||
72 | 77 | ||
73 | freqs.old = policy->cur; | 78 | freqs.old = policy->cur; |
74 | freqs.new = freq_table[idx].frequency; | 79 | freqs.new = freq_table[idx].frequency; |
75 | freqs.cpu = policy->cpu; | ||
76 | 80 | ||
77 | if (freqs.old == freqs.new) | 81 | if (freqs.old == freqs.new) |
78 | return 0; | 82 | return 0; |
79 | 83 | ||
80 | /* pre-change notification */ | 84 | /* pre-change notification */ |
81 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 85 | for_each_cpu(freqs.cpu, policy->cpus) |
86 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
82 | 87 | ||
83 | /* request the PRCM unit for opp change */ | 88 | /* request the PRCM unit for opp change */ |
84 | if (prcmu_set_arm_opp(idx2opp[idx])) { | 89 | if (prcmu_set_arm_opp(idx2opp[idx])) { |
@@ -87,7 +92,8 @@ static int db8500_cpufreq_target(struct cpufreq_policy *policy, | |||
87 | } | 92 | } |
88 | 93 | ||
89 | /* post change notification */ | 94 | /* post change notification */ |
90 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 95 | for_each_cpu(freqs.cpu, policy->cpus) |
96 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
91 | 97 | ||
92 | return 0; | 98 | return 0; |
93 | } | 99 | } |
@@ -103,17 +109,19 @@ static unsigned int db8500_cpufreq_getspeed(unsigned int cpu) | |||
103 | 109 | ||
104 | static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) | 110 | static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) |
105 | { | 111 | { |
106 | int res; | 112 | int i, res; |
107 | int i; | ||
108 | 113 | ||
109 | BUILD_BUG_ON(ARRAY_SIZE(idx2opp) + 1 != ARRAY_SIZE(freq_table)); | 114 | BUILD_BUG_ON(ARRAY_SIZE(idx2opp) + 1 != ARRAY_SIZE(freq_table)); |
110 | 115 | ||
111 | if (cpu_is_u8500v2() && !prcmu_is_u8400()) { | 116 | if (!prcmu_is_u8400()) { |
112 | freq_table[0].frequency = 400000; | 117 | freq_table[1].frequency = 400000; |
113 | freq_table[1].frequency = 800000; | 118 | freq_table[2].frequency = 800000; |
114 | if (prcmu_has_arm_maxopp()) | 119 | if (prcmu_has_arm_maxopp()) |
115 | freq_table[2].frequency = 1000000; | 120 | freq_table[3].frequency = 1000000; |
116 | } | 121 | } |
122 | pr_info("db8500-cpufreq : Available frequencies:\n"); | ||
123 | for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) | ||
124 | pr_info(" %d Mhz\n", freq_table[i].frequency/1000); | ||
117 | 125 | ||
118 | /* get policy fields based on the table */ | 126 | /* get policy fields based on the table */ |
119 | res = cpufreq_frequency_table_cpuinfo(policy, freq_table); | 127 | res = cpufreq_frequency_table_cpuinfo(policy, freq_table); |
@@ -127,10 +135,6 @@ static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) | |||
127 | policy->min = policy->cpuinfo.min_freq; | 135 | policy->min = policy->cpuinfo.min_freq; |
128 | policy->max = policy->cpuinfo.max_freq; | 136 | policy->max = policy->cpuinfo.max_freq; |
129 | policy->cur = db8500_cpufreq_getspeed(policy->cpu); | 137 | policy->cur = db8500_cpufreq_getspeed(policy->cpu); |
130 | |||
131 | for (i = 0; freq_table[i].frequency != policy->cur; i++) | ||
132 | ; | ||
133 | |||
134 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 138 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; |
135 | 139 | ||
136 | /* | 140 | /* |