aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-27 15:47:03 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-27 15:47:03 -0400
commite11158c0c9ab59d46bb70953f6275643a7a01fa1 (patch)
tree64302fccb64d1220631d33c1262ace5bb0d218cb /drivers/cpufreq
parent39a95f4861381a87167729be8f71c59ed4efc27d (diff)
parent027f6d582c23a492ff06b29d592154f4cd7a246c (diff)
Merge branch 'pm-cpufreq-arm' into pm-cpufreq
* pm-cpufreq-arm: cpufreq: tegra: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: s3c64xx: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: omap: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: imx6q: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: exynos: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: dbx500: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: davinci: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: arm-big-little: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: s3c2416: fix forgotten driver_data conversions
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/arm_big_little.c4
-rw-r--r--drivers/cpufreq/davinci-cpufreq.c3
-rw-r--r--drivers/cpufreq/dbx500-cpufreq.c4
-rw-r--r--drivers/cpufreq/exynos-cpufreq.c10
-rw-r--r--drivers/cpufreq/imx6q-cpufreq.c17
-rw-r--r--drivers/cpufreq/omap-cpufreq.c6
-rw-r--r--drivers/cpufreq/s3c2416-cpufreq.c4
-rw-r--r--drivers/cpufreq/s3c64xx-cpufreq.c8
-rw-r--r--drivers/cpufreq/tegra-cpufreq.c4
9 files changed, 38 insertions, 22 deletions
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 5d7f53fcd6f5..3549f0784af1 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -84,11 +84,9 @@ static int bL_cpufreq_set_target(struct cpufreq_policy *policy,
84 ret = clk_set_rate(clk[cur_cluster], freqs.new * 1000); 84 ret = clk_set_rate(clk[cur_cluster], freqs.new * 1000);
85 if (ret) { 85 if (ret) {
86 pr_err("clk_set_rate failed: %d\n", ret); 86 pr_err("clk_set_rate failed: %d\n", ret);
87 return ret; 87 freqs.new = freqs.old;
88 } 88 }
89 89
90 policy->cur = freqs.new;
91
92 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 90 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
93 91
94 return ret; 92 return ret;
diff --git a/drivers/cpufreq/davinci-cpufreq.c b/drivers/cpufreq/davinci-cpufreq.c
index c33c76c360fa..551dd655c6f2 100644
--- a/drivers/cpufreq/davinci-cpufreq.c
+++ b/drivers/cpufreq/davinci-cpufreq.c
@@ -114,6 +114,9 @@ static int davinci_target(struct cpufreq_policy *policy,
114 pdata->set_voltage(idx); 114 pdata->set_voltage(idx);
115 115
116out: 116out:
117 if (ret)
118 freqs.new = freqs.old;
119
117 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 120 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
118 121
119 return ret; 122 return ret;
diff --git a/drivers/cpufreq/dbx500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c
index 6ec6539ae041..1fdb02b9f1ec 100644
--- a/drivers/cpufreq/dbx500-cpufreq.c
+++ b/drivers/cpufreq/dbx500-cpufreq.c
@@ -57,13 +57,13 @@ static int dbx500_cpufreq_target(struct cpufreq_policy *policy,
57 if (ret) { 57 if (ret) {
58 pr_err("dbx500-cpufreq: Failed to set armss_clk to %d Hz: error %d\n", 58 pr_err("dbx500-cpufreq: Failed to set armss_clk to %d Hz: error %d\n",
59 freqs.new * 1000, ret); 59 freqs.new * 1000, ret);
60 return ret; 60 freqs.new = freqs.old;
61 } 61 }
62 62
63 /* post change notification */ 63 /* post change notification */
64 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 64 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
65 65
66 return 0; 66 return ret;
67} 67}
68 68
69static unsigned int dbx500_cpufreq_getspeed(unsigned int cpu) 69static unsigned int dbx500_cpufreq_getspeed(unsigned int cpu)
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index 475b4f607f0d..0d32f02ef4d6 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -113,7 +113,8 @@ static int exynos_cpufreq_scale(unsigned int target_freq)
113 if (ret) { 113 if (ret) {
114 pr_err("%s: failed to set cpu voltage to %d\n", 114 pr_err("%s: failed to set cpu voltage to %d\n",
115 __func__, arm_volt); 115 __func__, arm_volt);
116 goto out; 116 freqs.new = freqs.old;
117 goto post_notify;
117 } 118 }
118 } 119 }
119 120
@@ -123,14 +124,19 @@ static int exynos_cpufreq_scale(unsigned int target_freq)
123 if (ret) { 124 if (ret) {
124 pr_err("%s: failed to set cpu voltage to %d\n", 125 pr_err("%s: failed to set cpu voltage to %d\n",
125 __func__, safe_arm_volt); 126 __func__, safe_arm_volt);
126 goto out; 127 freqs.new = freqs.old;
128 goto post_notify;
127 } 129 }
128 } 130 }
129 131
130 exynos_info->set_freq(old_index, index); 132 exynos_info->set_freq(old_index, index);
131 133
134post_notify:
132 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 135 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
133 136
137 if (ret)
138 goto out;
139
134 /* When the new frequency is lower than current frequency */ 140 /* When the new frequency is lower than current frequency */
135 if ((freqs.new < freqs.old) || 141 if ((freqs.new < freqs.old) ||
136 ((freqs.new > freqs.old) && safe_arm_volt)) { 142 ((freqs.new > freqs.old) && safe_arm_volt)) {
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index b78bc35973ba..e37cdaedbb5b 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -68,8 +68,6 @@ static int imx6q_set_target(struct cpufreq_policy *policy,
68 if (freqs.old == freqs.new) 68 if (freqs.old == freqs.new)
69 return 0; 69 return 0;
70 70
71 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
72
73 rcu_read_lock(); 71 rcu_read_lock();
74 opp = opp_find_freq_ceil(cpu_dev, &freq_hz); 72 opp = opp_find_freq_ceil(cpu_dev, &freq_hz);
75 if (IS_ERR(opp)) { 73 if (IS_ERR(opp)) {
@@ -86,13 +84,16 @@ static int imx6q_set_target(struct cpufreq_policy *policy,
86 freqs.old / 1000, volt_old / 1000, 84 freqs.old / 1000, volt_old / 1000,
87 freqs.new / 1000, volt / 1000); 85 freqs.new / 1000, volt / 1000);
88 86
87 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
88
89 /* scaling up? scale voltage before frequency */ 89 /* scaling up? scale voltage before frequency */
90 if (freqs.new > freqs.old) { 90 if (freqs.new > freqs.old) {
91 ret = regulator_set_voltage_tol(arm_reg, volt, 0); 91 ret = regulator_set_voltage_tol(arm_reg, volt, 0);
92 if (ret) { 92 if (ret) {
93 dev_err(cpu_dev, 93 dev_err(cpu_dev,
94 "failed to scale vddarm up: %d\n", ret); 94 "failed to scale vddarm up: %d\n", ret);
95 return ret; 95 freqs.new = freqs.old;
96 goto post_notify;
96 } 97 }
97 98
98 /* 99 /*
@@ -145,15 +146,18 @@ static int imx6q_set_target(struct cpufreq_policy *policy,
145 if (ret) { 146 if (ret) {
146 dev_err(cpu_dev, "failed to set clock rate: %d\n", ret); 147 dev_err(cpu_dev, "failed to set clock rate: %d\n", ret);
147 regulator_set_voltage_tol(arm_reg, volt_old, 0); 148 regulator_set_voltage_tol(arm_reg, volt_old, 0);
148 return ret; 149 freqs.new = freqs.old;
150 goto post_notify;
149 } 151 }
150 152
151 /* scaling down? scale voltage after frequency */ 153 /* scaling down? scale voltage after frequency */
152 if (freqs.new < freqs.old) { 154 if (freqs.new < freqs.old) {
153 ret = regulator_set_voltage_tol(arm_reg, volt, 0); 155 ret = regulator_set_voltage_tol(arm_reg, volt, 0);
154 if (ret) 156 if (ret) {
155 dev_warn(cpu_dev, 157 dev_warn(cpu_dev,
156 "failed to scale vddarm down: %d\n", ret); 158 "failed to scale vddarm down: %d\n", ret);
159 ret = 0;
160 }
157 161
158 if (freqs.old == FREQ_1P2_GHZ / 1000) { 162 if (freqs.old == FREQ_1P2_GHZ / 1000) {
159 regulator_set_voltage_tol(pu_reg, 163 regulator_set_voltage_tol(pu_reg,
@@ -163,9 +167,10 @@ static int imx6q_set_target(struct cpufreq_policy *policy,
163 } 167 }
164 } 168 }
165 169
170post_notify:
166 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 171 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
167 172
168 return 0; 173 return ret;
169} 174}
170 175
171static int imx6q_cpufreq_init(struct cpufreq_policy *policy) 176static int imx6q_cpufreq_init(struct cpufreq_policy *policy)
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
index 0279d18a57f9..29468a522ee9 100644
--- a/drivers/cpufreq/omap-cpufreq.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -93,9 +93,6 @@ static int omap_target(struct cpufreq_policy *policy,
93 if (freqs.old == freqs.new && policy->cur == freqs.new) 93 if (freqs.old == freqs.new && policy->cur == freqs.new)
94 return ret; 94 return ret;
95 95
96 /* notifiers */
97 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
98
99 freq = freqs.new * 1000; 96 freq = freqs.new * 1000;
100 ret = clk_round_rate(mpu_clk, freq); 97 ret = clk_round_rate(mpu_clk, freq);
101 if (IS_ERR_VALUE(ret)) { 98 if (IS_ERR_VALUE(ret)) {
@@ -125,6 +122,9 @@ static int omap_target(struct cpufreq_policy *policy,
125 freqs.old / 1000, volt_old ? volt_old / 1000 : -1, 122 freqs.old / 1000, volt_old ? volt_old / 1000 : -1,
126 freqs.new / 1000, volt ? volt / 1000 : -1); 123 freqs.new / 1000, volt ? volt / 1000 : -1);
127 124
125 /* notifiers */
126 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
127
128 /* scaling up? scale voltage before frequency */ 128 /* scaling up? scale voltage before frequency */
129 if (mpu_reg && (freqs.new > freqs.old)) { 129 if (mpu_reg && (freqs.new > freqs.old)) {
130 r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol); 130 r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol);
diff --git a/drivers/cpufreq/s3c2416-cpufreq.c b/drivers/cpufreq/s3c2416-cpufreq.c
index 69f2e55828dc..e35865af96e2 100644
--- a/drivers/cpufreq/s3c2416-cpufreq.c
+++ b/drivers/cpufreq/s3c2416-cpufreq.c
@@ -312,7 +312,7 @@ static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
312 if (freq->frequency == CPUFREQ_ENTRY_INVALID) 312 if (freq->frequency == CPUFREQ_ENTRY_INVALID)
313 continue; 313 continue;
314 314
315 dvfs = &s3c2416_dvfs_table[freq->index]; 315 dvfs = &s3c2416_dvfs_table[freq->driver_data];
316 found = 0; 316 found = 0;
317 317
318 /* Check only the min-voltage, more is always ok on S3C2416 */ 318 /* Check only the min-voltage, more is always ok on S3C2416 */
@@ -462,7 +462,7 @@ static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
462 freq = s3c_freq->freq_table; 462 freq = s3c_freq->freq_table;
463 while (freq->frequency != CPUFREQ_TABLE_END) { 463 while (freq->frequency != CPUFREQ_TABLE_END) {
464 /* special handling for dvs mode */ 464 /* special handling for dvs mode */
465 if (freq->index == 0) { 465 if (freq->driver_data == 0) {
466 if (!s3c_freq->hclk) { 466 if (!s3c_freq->hclk) {
467 pr_debug("cpufreq: %dkHz unsupported as it would need unavailable dvs mode\n", 467 pr_debug("cpufreq: %dkHz unsupported as it would need unavailable dvs mode\n",
468 freq->frequency); 468 freq->frequency);
diff --git a/drivers/cpufreq/s3c64xx-cpufreq.c b/drivers/cpufreq/s3c64xx-cpufreq.c
index 306d395de990..13bb4bae64ee 100644
--- a/drivers/cpufreq/s3c64xx-cpufreq.c
+++ b/drivers/cpufreq/s3c64xx-cpufreq.c
@@ -104,7 +104,8 @@ static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy,
104 if (ret != 0) { 104 if (ret != 0) {
105 pr_err("Failed to set VDDARM for %dkHz: %d\n", 105 pr_err("Failed to set VDDARM for %dkHz: %d\n",
106 freqs.new, ret); 106 freqs.new, ret);
107 goto err; 107 freqs.new = freqs.old;
108 goto post_notify;
108 } 109 }
109 } 110 }
110#endif 111#endif
@@ -113,10 +114,13 @@ static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy,
113 if (ret < 0) { 114 if (ret < 0) {
114 pr_err("Failed to set rate %dkHz: %d\n", 115 pr_err("Failed to set rate %dkHz: %d\n",
115 freqs.new, ret); 116 freqs.new, ret);
116 goto err; 117 freqs.new = freqs.old;
117 } 118 }
118 119
120post_notify:
119 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 121 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
122 if (ret)
123 goto err;
120 124
121#ifdef CONFIG_REGULATOR 125#ifdef CONFIG_REGULATOR
122 if (vddarm && freqs.new < freqs.old) { 126 if (vddarm && freqs.new < freqs.old) {
diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c
index 81561be17e8c..cd66b85d927c 100644
--- a/drivers/cpufreq/tegra-cpufreq.c
+++ b/drivers/cpufreq/tegra-cpufreq.c
@@ -137,12 +137,12 @@ static int tegra_update_cpu_speed(struct cpufreq_policy *policy,
137 if (ret) { 137 if (ret) {
138 pr_err("cpu-tegra: Failed to set cpu frequency to %d kHz\n", 138 pr_err("cpu-tegra: Failed to set cpu frequency to %d kHz\n",
139 freqs.new); 139 freqs.new);
140 return ret; 140 freqs.new = freqs.old;
141 } 141 }
142 142
143 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); 143 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
144 144
145 return 0; 145 return ret;
146} 146}
147 147
148static unsigned long tegra_cpu_highest_speed(void) 148static unsigned long tegra_cpu_highest_speed(void)