aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/s3c64xx-cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/s3c64xx-cpufreq.c')
-rw-r--r--drivers/cpufreq/s3c64xx-cpufreq.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/drivers/cpufreq/s3c64xx-cpufreq.c b/drivers/cpufreq/s3c64xx-cpufreq.c
index 3475f65aeec6..a5e72cb5f53c 100644
--- a/drivers/cpufreq/s3c64xx-cpufreq.c
+++ b/drivers/cpufreq/s3c64xx-cpufreq.c
@@ -8,6 +8,8 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#define pr_fmt(fmt) "cpufreq: " fmt
12
11#include <linux/kernel.h> 13#include <linux/kernel.h>
12#include <linux/types.h> 14#include <linux/types.h>
13#include <linux/init.h> 15#include <linux/init.h>
@@ -91,7 +93,7 @@ static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy,
91 if (freqs.old == freqs.new) 93 if (freqs.old == freqs.new)
92 return 0; 94 return 0;
93 95
94 pr_debug("cpufreq: Transition %d-%dkHz\n", freqs.old, freqs.new); 96 pr_debug("Transition %d-%dkHz\n", freqs.old, freqs.new);
95 97
96 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 98 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
97 99
@@ -101,7 +103,7 @@ static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy,
101 dvfs->vddarm_min, 103 dvfs->vddarm_min,
102 dvfs->vddarm_max); 104 dvfs->vddarm_max);
103 if (ret != 0) { 105 if (ret != 0) {
104 pr_err("cpufreq: Failed to set VDDARM for %dkHz: %d\n", 106 pr_err("Failed to set VDDARM for %dkHz: %d\n",
105 freqs.new, ret); 107 freqs.new, ret);
106 goto err; 108 goto err;
107 } 109 }
@@ -110,7 +112,7 @@ static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy,
110 112
111 ret = clk_set_rate(armclk, freqs.new * 1000); 113 ret = clk_set_rate(armclk, freqs.new * 1000);
112 if (ret < 0) { 114 if (ret < 0) {
113 pr_err("cpufreq: Failed to set rate %dkHz: %d\n", 115 pr_err("Failed to set rate %dkHz: %d\n",
114 freqs.new, ret); 116 freqs.new, ret);
115 goto err; 117 goto err;
116 } 118 }
@@ -123,14 +125,14 @@ static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy,
123 dvfs->vddarm_min, 125 dvfs->vddarm_min,
124 dvfs->vddarm_max); 126 dvfs->vddarm_max);
125 if (ret != 0) { 127 if (ret != 0) {
126 pr_err("cpufreq: Failed to set VDDARM for %dkHz: %d\n", 128 pr_err("Failed to set VDDARM for %dkHz: %d\n",
127 freqs.new, ret); 129 freqs.new, ret);
128 goto err_clk; 130 goto err_clk;
129 } 131 }
130 } 132 }
131#endif 133#endif
132 134
133 pr_debug("cpufreq: Set actual frequency %lukHz\n", 135 pr_debug("Set actual frequency %lukHz\n",
134 clk_get_rate(armclk) / 1000); 136 clk_get_rate(armclk) / 1000);
135 137
136 return 0; 138 return 0;
@@ -153,7 +155,7 @@ static void __init s3c64xx_cpufreq_config_regulator(void)
153 155
154 count = regulator_count_voltages(vddarm); 156 count = regulator_count_voltages(vddarm);
155 if (count < 0) { 157 if (count < 0) {
156 pr_err("cpufreq: Unable to check supported voltages\n"); 158 pr_err("Unable to check supported voltages\n");
157 } 159 }
158 160
159 freq = s3c64xx_freq_table; 161 freq = s3c64xx_freq_table;
@@ -171,7 +173,7 @@ static void __init s3c64xx_cpufreq_config_regulator(void)
171 } 173 }
172 174
173 if (!found) { 175 if (!found) {
174 pr_debug("cpufreq: %dkHz unsupported by regulator\n", 176 pr_debug("%dkHz unsupported by regulator\n",
175 freq->frequency); 177 freq->frequency);
176 freq->frequency = CPUFREQ_ENTRY_INVALID; 178 freq->frequency = CPUFREQ_ENTRY_INVALID;
177 } 179 }
@@ -194,13 +196,13 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
194 return -EINVAL; 196 return -EINVAL;
195 197
196 if (s3c64xx_freq_table == NULL) { 198 if (s3c64xx_freq_table == NULL) {
197 pr_err("cpufreq: No frequency information for this CPU\n"); 199 pr_err("No frequency information for this CPU\n");
198 return -ENODEV; 200 return -ENODEV;
199 } 201 }
200 202
201 armclk = clk_get(NULL, "armclk"); 203 armclk = clk_get(NULL, "armclk");
202 if (IS_ERR(armclk)) { 204 if (IS_ERR(armclk)) {
203 pr_err("cpufreq: Unable to obtain ARMCLK: %ld\n", 205 pr_err("Unable to obtain ARMCLK: %ld\n",
204 PTR_ERR(armclk)); 206 PTR_ERR(armclk));
205 return PTR_ERR(armclk); 207 return PTR_ERR(armclk);
206 } 208 }
@@ -209,12 +211,19 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
209 vddarm = regulator_get(NULL, "vddarm"); 211 vddarm = regulator_get(NULL, "vddarm");
210 if (IS_ERR(vddarm)) { 212 if (IS_ERR(vddarm)) {
211 ret = PTR_ERR(vddarm); 213 ret = PTR_ERR(vddarm);
212 pr_err("cpufreq: Failed to obtain VDDARM: %d\n", ret); 214 pr_err("Failed to obtain VDDARM: %d\n", ret);
213 pr_err("cpufreq: Only frequency scaling available\n"); 215 pr_err("Only frequency scaling available\n");
214 vddarm = NULL; 216 vddarm = NULL;
215 } else { 217 } else {
216 s3c64xx_cpufreq_config_regulator(); 218 s3c64xx_cpufreq_config_regulator();
217 } 219 }
220
221 vddint = regulator_get(NULL, "vddint");
222 if (IS_ERR(vddint)) {
223 ret = PTR_ERR(vddint);
224 pr_err("Failed to obtain VDDINT: %d\n", ret);
225 vddint = NULL;
226 }
218#endif 227#endif
219 228
220 freq = s3c64xx_freq_table; 229 freq = s3c64xx_freq_table;
@@ -225,7 +234,7 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
225 r = clk_round_rate(armclk, freq->frequency * 1000); 234 r = clk_round_rate(armclk, freq->frequency * 1000);
226 r /= 1000; 235 r /= 1000;
227 if (r != freq->frequency) { 236 if (r != freq->frequency) {
228 pr_debug("cpufreq: %dkHz unsupported by clock\n", 237 pr_debug("%dkHz unsupported by clock\n",
229 freq->frequency); 238 freq->frequency);
230 freq->frequency = CPUFREQ_ENTRY_INVALID; 239 freq->frequency = CPUFREQ_ENTRY_INVALID;
231 } 240 }
@@ -248,7 +257,7 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
248 257
249 ret = cpufreq_frequency_table_cpuinfo(policy, s3c64xx_freq_table); 258 ret = cpufreq_frequency_table_cpuinfo(policy, s3c64xx_freq_table);
250 if (ret != 0) { 259 if (ret != 0) {
251 pr_err("cpufreq: Failed to configure frequency table: %d\n", 260 pr_err("Failed to configure frequency table: %d\n",
252 ret); 261 ret);
253 regulator_put(vddarm); 262 regulator_put(vddarm);
254 clk_put(armclk); 263 clk_put(armclk);