aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r--drivers/cpufreq/cpufreq.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 2f6a73c01b71..f7b9d6fce123 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -763,6 +763,8 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
763 init_completion(&policy->kobj_unregister); 763 init_completion(&policy->kobj_unregister);
764 INIT_WORK(&policy->update, handle_update); 764 INIT_WORK(&policy->update, handle_update);
765 765
766 /* Set governor before ->init, so that driver could check it */
767 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
766 /* call driver. From then on the cpufreq must be able 768 /* call driver. From then on the cpufreq must be able
767 * to accept all calls to ->verify and ->setpolicy for this CPU 769 * to accept all calls to ->verify and ->setpolicy for this CPU
768 */ 770 */
@@ -1109,12 +1111,7 @@ unsigned int cpufreq_quick_get(unsigned int cpu)
1109 unsigned int ret_freq = 0; 1111 unsigned int ret_freq = 0;
1110 1112
1111 if (policy) { 1113 if (policy) {
1112 if (unlikely(lock_policy_rwsem_read(cpu)))
1113 return ret_freq;
1114
1115 ret_freq = policy->cur; 1114 ret_freq = policy->cur;
1116
1117 unlock_policy_rwsem_read(cpu);
1118 cpufreq_cpu_put(policy); 1115 cpufreq_cpu_put(policy);
1119 } 1116 }
1120 1117
@@ -1483,6 +1480,31 @@ static int __cpufreq_governor(struct cpufreq_policy *policy,
1483{ 1480{
1484 int ret; 1481 int ret;
1485 1482
1483 /* Only must be defined when default governor is known to have latency
1484 restrictions, like e.g. conservative or ondemand.
1485 That this is the case is already ensured in Kconfig
1486 */
1487#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE
1488 struct cpufreq_governor *gov = &cpufreq_gov_performance;
1489#else
1490 struct cpufreq_governor *gov = NULL;
1491#endif
1492
1493 if (policy->governor->max_transition_latency &&
1494 policy->cpuinfo.transition_latency >
1495 policy->governor->max_transition_latency) {
1496 if (!gov)
1497 return -EINVAL;
1498 else {
1499 printk(KERN_WARNING "%s governor failed, too long"
1500 " transition latency of HW, fallback"
1501 " to %s governor\n",
1502 policy->governor->name,
1503 gov->name);
1504 policy->governor = gov;
1505 }
1506 }
1507
1486 if (!try_module_get(policy->governor->owner)) 1508 if (!try_module_get(policy->governor->owner))
1487 return -EINVAL; 1509 return -EINVAL;
1488 1510
@@ -1703,7 +1725,7 @@ int cpufreq_update_policy(unsigned int cpu)
1703} 1725}
1704EXPORT_SYMBOL(cpufreq_update_policy); 1726EXPORT_SYMBOL(cpufreq_update_policy);
1705 1727
1706static int cpufreq_cpu_callback(struct notifier_block *nfb, 1728static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
1707 unsigned long action, void *hcpu) 1729 unsigned long action, void *hcpu)
1708{ 1730{
1709 unsigned int cpu = (unsigned long)hcpu; 1731 unsigned int cpu = (unsigned long)hcpu;