aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c46
-rw-r--r--drivers/cpufreq/exynos4210-cpufreq.c1
-rw-r--r--drivers/cpufreq/exynos4x12-cpufreq.c1
-rw-r--r--drivers/cpufreq/exynos5250-cpufreq.c1
-rw-r--r--drivers/cpufreq/tegra-cpufreq.c4
5 files changed, 44 insertions, 9 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 02d534da22dd..81e9d4412db8 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -26,6 +26,7 @@
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/suspend.h>
29#include <linux/syscore_ops.h> 30#include <linux/syscore_ops.h>
30#include <linux/tick.h> 31#include <linux/tick.h>
31#include <trace/events/power.h> 32#include <trace/events/power.h>
@@ -47,6 +48,9 @@ static LIST_HEAD(cpufreq_policy_list);
47static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor); 48static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor);
48#endif 49#endif
49 50
51/* Flag to suspend/resume CPUFreq governors */
52static bool cpufreq_suspended;
53
50static inline bool has_target(void) 54static inline bool has_target(void)
51{ 55{
52 return cpufreq_driver->target_index || cpufreq_driver->target; 56 return cpufreq_driver->target_index || cpufreq_driver->target;
@@ -1462,6 +1466,41 @@ static struct subsys_interface cpufreq_interface = {
1462 .remove_dev = cpufreq_remove_dev, 1466 .remove_dev = cpufreq_remove_dev,
1463}; 1467};
1464 1468
1469void cpufreq_suspend(void)
1470{
1471 struct cpufreq_policy *policy;
1472
1473 if (!has_target())
1474 return;
1475
1476 pr_debug("%s: Suspending Governors\n", __func__);
1477
1478 list_for_each_entry(policy, &cpufreq_policy_list, policy_list)
1479 if (__cpufreq_governor(policy, CPUFREQ_GOV_STOP))
1480 pr_err("%s: Failed to stop governor for policy: %p\n",
1481 __func__, policy);
1482
1483 cpufreq_suspended = true;
1484}
1485
1486void cpufreq_resume(void)
1487{
1488 struct cpufreq_policy *policy;
1489
1490 if (!has_target())
1491 return;
1492
1493 pr_debug("%s: Resuming Governors\n", __func__);
1494
1495 cpufreq_suspended = false;
1496
1497 list_for_each_entry(policy, &cpufreq_policy_list, policy_list)
1498 if (__cpufreq_governor(policy, CPUFREQ_GOV_START)
1499 || __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS))
1500 pr_err("%s: Failed to start governor for policy: %p\n",
1501 __func__, policy);
1502}
1503
1465/** 1504/**
1466 * cpufreq_bp_suspend - Prepare the boot CPU for system suspend. 1505 * cpufreq_bp_suspend - Prepare the boot CPU for system suspend.
1467 * 1506 *
@@ -1764,6 +1803,10 @@ static int __cpufreq_governor(struct cpufreq_policy *policy,
1764 struct cpufreq_governor *gov = NULL; 1803 struct cpufreq_governor *gov = NULL;
1765#endif 1804#endif
1766 1805
1806 /* Don't start any governor operations if we are entering suspend */
1807 if (cpufreq_suspended)
1808 return 0;
1809
1767 if (policy->governor->max_transition_latency && 1810 if (policy->governor->max_transition_latency &&
1768 policy->cpuinfo.transition_latency > 1811 policy->cpuinfo.transition_latency >
1769 policy->governor->max_transition_latency) { 1812 policy->governor->max_transition_latency) {
@@ -2076,9 +2119,6 @@ static int cpufreq_cpu_callback(struct notifier_block *nfb,
2076 dev = get_cpu_device(cpu); 2119 dev = get_cpu_device(cpu);
2077 if (dev) { 2120 if (dev) {
2078 2121
2079 if (action & CPU_TASKS_FROZEN)
2080 frozen = true;
2081
2082 switch (action & ~CPU_TASKS_FROZEN) { 2122 switch (action & ~CPU_TASKS_FROZEN) {
2083 case CPU_ONLINE: 2123 case CPU_ONLINE:
2084 __cpufreq_add_dev(dev, NULL, frozen); 2124 __cpufreq_add_dev(dev, NULL, frozen);
diff --git a/drivers/cpufreq/exynos4210-cpufreq.c b/drivers/cpufreq/exynos4210-cpufreq.c
index f2c75065ce19..dfd1643b0b2f 100644
--- a/drivers/cpufreq/exynos4210-cpufreq.c
+++ b/drivers/cpufreq/exynos4210-cpufreq.c
@@ -157,4 +157,3 @@ err_moutcore:
157 pr_debug("%s: failed initialization\n", __func__); 157 pr_debug("%s: failed initialization\n", __func__);
158 return -EINVAL; 158 return -EINVAL;
159} 159}
160EXPORT_SYMBOL(exynos4210_cpufreq_init);
diff --git a/drivers/cpufreq/exynos4x12-cpufreq.c b/drivers/cpufreq/exynos4x12-cpufreq.c
index 8683304ce62c..efad5e657f6f 100644
--- a/drivers/cpufreq/exynos4x12-cpufreq.c
+++ b/drivers/cpufreq/exynos4x12-cpufreq.c
@@ -211,4 +211,3 @@ err_moutcore:
211 pr_debug("%s: failed initialization\n", __func__); 211 pr_debug("%s: failed initialization\n", __func__);
212 return -EINVAL; 212 return -EINVAL;
213} 213}
214EXPORT_SYMBOL(exynos4x12_cpufreq_init);
diff --git a/drivers/cpufreq/exynos5250-cpufreq.c b/drivers/cpufreq/exynos5250-cpufreq.c
index 9fae466d7746..8feda86fe42c 100644
--- a/drivers/cpufreq/exynos5250-cpufreq.c
+++ b/drivers/cpufreq/exynos5250-cpufreq.c
@@ -236,4 +236,3 @@ err_moutcore:
236 pr_err("%s: failed initialization\n", __func__); 236 pr_err("%s: failed initialization\n", __func__);
237 return -EINVAL; 237 return -EINVAL;
238} 238}
239EXPORT_SYMBOL(exynos5250_cpufreq_init);
diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c
index f42df7ec03c5..b7309c37033d 100644
--- a/drivers/cpufreq/tegra-cpufreq.c
+++ b/drivers/cpufreq/tegra-cpufreq.c
@@ -142,10 +142,8 @@ static int tegra_target(struct cpufreq_policy *policy, unsigned int index)
142 142
143 mutex_lock(&tegra_cpu_lock); 143 mutex_lock(&tegra_cpu_lock);
144 144
145 if (is_suspended) { 145 if (is_suspended)
146 ret = -EBUSY;
147 goto out; 146 goto out;
148 }
149 147
150 freq = freq_table[index].frequency; 148 freq = freq_table[index].frequency;
151 149