mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-30 08:02:30 +00:00
cpufreq: vexpress: Set CPUFREQ_IS_COOLING_DEV flag
Reuse the cpufreq core's registration of cooling device by setting the CPUFREQ_IS_COOLING_DEV flag. Set this only if bL switcher isn't enabled. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
parent
484f2b7c61
commit
bb8c26d938
1 changed files with 3 additions and 19 deletions
|
@ -15,7 +15,6 @@
|
||||||
#include <linux/cpu.h>
|
#include <linux/cpu.h>
|
||||||
#include <linux/cpufreq.h>
|
#include <linux/cpufreq.h>
|
||||||
#include <linux/cpumask.h>
|
#include <linux/cpumask.h>
|
||||||
#include <linux/cpu_cooling.h>
|
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
@ -47,7 +46,6 @@ static bool bL_switching_enabled;
|
||||||
#define ACTUAL_FREQ(cluster, freq) ((cluster == A7_CLUSTER) ? freq << 1 : freq)
|
#define ACTUAL_FREQ(cluster, freq) ((cluster == A7_CLUSTER) ? freq << 1 : freq)
|
||||||
#define VIRT_FREQ(cluster, freq) ((cluster == A7_CLUSTER) ? freq >> 1 : freq)
|
#define VIRT_FREQ(cluster, freq) ((cluster == A7_CLUSTER) ? freq >> 1 : freq)
|
||||||
|
|
||||||
static struct thermal_cooling_device *cdev[MAX_CLUSTERS];
|
|
||||||
static struct clk *clk[MAX_CLUSTERS];
|
static struct clk *clk[MAX_CLUSTERS];
|
||||||
static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS + 1];
|
static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS + 1];
|
||||||
static atomic_t cluster_usage[MAX_CLUSTERS + 1];
|
static atomic_t cluster_usage[MAX_CLUSTERS + 1];
|
||||||
|
@ -457,11 +455,6 @@ static int ve_spc_cpufreq_exit(struct cpufreq_policy *policy)
|
||||||
struct device *cpu_dev;
|
struct device *cpu_dev;
|
||||||
int cur_cluster = cpu_to_cluster(policy->cpu);
|
int cur_cluster = cpu_to_cluster(policy->cpu);
|
||||||
|
|
||||||
if (cur_cluster < MAX_CLUSTERS) {
|
|
||||||
cpufreq_cooling_unregister(cdev[cur_cluster]);
|
|
||||||
cdev[cur_cluster] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
cpu_dev = get_cpu_device(policy->cpu);
|
cpu_dev = get_cpu_device(policy->cpu);
|
||||||
if (!cpu_dev) {
|
if (!cpu_dev) {
|
||||||
pr_err("%s: failed to get cpu%d device\n", __func__,
|
pr_err("%s: failed to get cpu%d device\n", __func__,
|
||||||
|
@ -473,17 +466,6 @@ static int ve_spc_cpufreq_exit(struct cpufreq_policy *policy)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ve_spc_cpufreq_ready(struct cpufreq_policy *policy)
|
|
||||||
{
|
|
||||||
int cur_cluster = cpu_to_cluster(policy->cpu);
|
|
||||||
|
|
||||||
/* Do not register a cpu_cooling device if we are in IKS mode */
|
|
||||||
if (cur_cluster >= MAX_CLUSTERS)
|
|
||||||
return;
|
|
||||||
|
|
||||||
cdev[cur_cluster] = of_cpufreq_cooling_register(policy);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct cpufreq_driver ve_spc_cpufreq_driver = {
|
static struct cpufreq_driver ve_spc_cpufreq_driver = {
|
||||||
.name = "vexpress-spc",
|
.name = "vexpress-spc",
|
||||||
.flags = CPUFREQ_HAVE_GOVERNOR_PER_POLICY |
|
.flags = CPUFREQ_HAVE_GOVERNOR_PER_POLICY |
|
||||||
|
@ -493,7 +475,6 @@ static struct cpufreq_driver ve_spc_cpufreq_driver = {
|
||||||
.get = ve_spc_cpufreq_get_rate,
|
.get = ve_spc_cpufreq_get_rate,
|
||||||
.init = ve_spc_cpufreq_init,
|
.init = ve_spc_cpufreq_init,
|
||||||
.exit = ve_spc_cpufreq_exit,
|
.exit = ve_spc_cpufreq_exit,
|
||||||
.ready = ve_spc_cpufreq_ready,
|
|
||||||
.attr = cpufreq_generic_attr,
|
.attr = cpufreq_generic_attr,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -553,6 +534,9 @@ static int ve_spc_cpufreq_probe(struct platform_device *pdev)
|
||||||
for (i = 0; i < MAX_CLUSTERS; i++)
|
for (i = 0; i < MAX_CLUSTERS; i++)
|
||||||
mutex_init(&cluster_lock[i]);
|
mutex_init(&cluster_lock[i]);
|
||||||
|
|
||||||
|
if (!is_bL_switching_enabled())
|
||||||
|
ve_spc_cpufreq_driver.flags |= CPUFREQ_IS_COOLING_DEV;
|
||||||
|
|
||||||
ret = cpufreq_register_driver(&ve_spc_cpufreq_driver);
|
ret = cpufreq_register_driver(&ve_spc_cpufreq_driver);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_info("%s: Failed registering platform driver: %s, err: %d\n",
|
pr_info("%s: Failed registering platform driver: %s, err: %d\n",
|
||||||
|
|
Loading…
Reference in a new issue