aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Briand <mathieu.briand@linaro.org>2012-04-26 14:23:11 +0200
committerDave Martin <dave.martin@linaro.org>2012-04-27 17:18:07 +0100
commitd40e3c72f9af5fe1a047998944dbc6dd6be5f754 (patch)
treead69d49c97553b40688c3d8a5bdd8490f5553c26
parent710293e3ac7153d56b1942a434041123d0208356 (diff)
cpufreq/arm-bl-cpufreq: fix some bugs
Post-init tests now obey test_config value cpufreq_cpu_get() are followed by a cpufreq_cpu_put() add some delay between post-init tests to avoid random crashes (need some more investigation) Signed-off-by: Mathieu Briand <mathieu.briand@linaro.org>
-rw-r--r--drivers/cpufreq/arm-bl-cpufreq_driver.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/cpufreq/arm-bl-cpufreq_driver.c b/drivers/cpufreq/arm-bl-cpufreq_driver.c
index 87c787df1fc..bbf4fef621b 100644
--- a/drivers/cpufreq/arm-bl-cpufreq_driver.c
+++ b/drivers/cpufreq/arm-bl-cpufreq_driver.c
@@ -32,8 +32,11 @@
#include <linux/printk.h>
#include <linux/string.h>
#include <linux/spinlock.h>
+
+#ifdef CONFIG_ARM_BL_CPUFREQ_TEST
#include <linux/delay.h>
#include <linux/sched.h>
+#endif
#include "arm-bl-cpufreq.h"
@@ -248,7 +251,7 @@ static int __init bl_cpufreq_module_init(void)
else {
pr_info("cpufreq backend driver registered.\n");
- if (post_init_tests() != 0) {
+ if ((test_config > 0) && (post_init_tests() != 0)) {
cpufreq_unregister_driver(&bl_cpufreq_driver);
return -ECANCELED;
}
@@ -485,6 +488,7 @@ static int test_cpufreq_driver_target(void)
struct cpufreq_frequency_table const *other_entry = NULL;
const struct cpufreq_frequency_table const *origin_entry =
find_entry_by_cluster(get_current_cluster());
+ struct cpufreq_policy *policy = cpufreq_cpu_get(0);
pr_info("Begin tests on cpufreq_driver_target");
@@ -498,7 +502,7 @@ static int test_cpufreq_driver_target(void)
/* Swicth to "other" cluster, ie cluster not used at module loading time
*/
- cpufreq_driver_target(cpufreq_cpu_get(0), entry_to_freq(other_entry),
+ cpufreq_driver_target(policy, entry_to_freq(other_entry),
CPUFREQ_RELATION_H);
mdelay(10);
cluster = get_current_cluster();
@@ -513,7 +517,7 @@ static int test_cpufreq_driver_target(void)
/* Swicth again to "other" cluster
*/
- cpufreq_driver_target(cpufreq_cpu_get(0), entry_to_freq(other_entry),
+ cpufreq_driver_target(policy, entry_to_freq(other_entry),
CPUFREQ_RELATION_H);
mdelay(10);
cluster = get_current_cluster();
@@ -530,7 +534,7 @@ static int test_cpufreq_driver_target(void)
/* Swicth back to "origin" cluster, ie cluster used at module loading
* time
*/
- cpufreq_driver_target(cpufreq_cpu_get(0), entry_to_freq(origin_entry),
+ cpufreq_driver_target(policy, entry_to_freq(origin_entry),
CPUFREQ_RELATION_H);
mdelay(10);
cluster = get_current_cluster();
@@ -546,7 +550,7 @@ static int test_cpufreq_driver_target(void)
/* Swicth again to "origin" cluster
*/
- cpufreq_driver_target(cpufreq_cpu_get(0), entry_to_freq(origin_entry),
+ cpufreq_driver_target(policy, entry_to_freq(origin_entry),
CPUFREQ_RELATION_H);
mdelay(10);
cluster = get_current_cluster();
@@ -560,6 +564,8 @@ static int test_cpufreq_driver_target(void)
} else
pr_info("SUCCESS\n");
+ cpufreq_cpu_put(policy);
+
pr_info("Tests on cpufreq_driver_target : ");
if (failed != 0) {
@@ -596,6 +602,7 @@ static int test_transitions(void)
{
int nTest = 0, failed = 0;
unsigned int num_cpu = num_present_cpus();
+ struct cpufreq_policy *policy = cpufreq_cpu_get(0);
pr_info("Begin tests on transition notifications");
@@ -610,7 +617,7 @@ static int test_transitions(void)
*/
test_transition_count = 0;
test_transition_freq = FREQ_LITTLE;
- cpufreq_driver_target(cpufreq_cpu_get(0), FREQ_LITTLE,
+ cpufreq_driver_target(policy, FREQ_LITTLE,
CPUFREQ_RELATION_H);
wait_event_timeout(test_wq, (test_transition_count == 2 * num_cpu),
msecs_to_jiffies(200));
@@ -629,7 +636,7 @@ static int test_transitions(void)
*/
test_transition_count = 0;
test_transition_freq = FREQ_BIG;
- cpufreq_driver_target(cpufreq_cpu_get(0), FREQ_BIG, CPUFREQ_RELATION_H);
+ cpufreq_driver_target(policy, FREQ_BIG, CPUFREQ_RELATION_H);
wait_event_timeout(test_wq, (test_transition_count == 2 * num_cpu),
msecs_to_jiffies(200));
@@ -645,6 +652,7 @@ static int test_transitions(void)
cpufreq_unregister_notifier(
&test_arm_bl_cpufreq_notifier_block,
CPUFREQ_TRANSITION_NOTIFIER);
+ cpufreq_cpu_put(policy);
pr_info("Tests on transition notifications : ");
if (failed != 0) {
@@ -683,7 +691,9 @@ static int post_init_tests(void)
pr_info("Begin post-init tests");
+ mdelay(100);
err |= test_cpufreq_driver_target();
+ mdelay(100);
err |= test_transitions();
if (err != 0) {