aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-09-09 07:18:08 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-09-12 20:39:12 -0400
commit297a66221d2bed61e7d74d11bf071c7b489fc33d (patch)
treee5547e9a3c08c930f1919f33e1ca32e03373db0e
parent33cc4fc1b2147ee3cf36d02c1106456cb276c043 (diff)
cpufreq: dt: Support governor tunables per policy
The cpufreq-dt driver is also used for systems with multiple clock/voltage domains for CPUs, i.e. multiple cpufreq policies in a system. And in such cases the platform users may want to enable "governor tunables per policy". Support that via platform data, as not all users of the driver would want that behavior. Reported-by: Juri Lelli <Juri.Lelli@arm.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/cpufreq-dt-platdev.c7
-rw-r--r--drivers/cpufreq/cpufreq-dt.c6
-rw-r--r--drivers/cpufreq/cpufreq-dt.h19
3 files changed, 30 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
index 276378a43321..d2637e1a5710 100644
--- a/drivers/cpufreq/cpufreq-dt-platdev.c
+++ b/drivers/cpufreq/cpufreq-dt-platdev.c
@@ -11,6 +11,8 @@
11#include <linux/of.h> 11#include <linux/of.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13 13
14#include "cpufreq-dt.h"
15
14static const struct of_device_id machines[] __initconst = { 16static const struct of_device_id machines[] __initconst = {
15 { .compatible = "allwinner,sun4i-a10", }, 17 { .compatible = "allwinner,sun4i-a10", },
16 { .compatible = "allwinner,sun5i-a10s", }, 18 { .compatible = "allwinner,sun5i-a10s", },
@@ -93,7 +95,8 @@ static int __init cpufreq_dt_platdev_init(void)
93 if (!match) 95 if (!match)
94 return -ENODEV; 96 return -ENODEV;
95 97
96 return PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", -1, 98 return PTR_ERR_OR_ZERO(platform_device_register_data(NULL, "cpufreq-dt",
97 NULL, 0)); 99 -1, match->data,
100 sizeof(struct cpufreq_dt_platform_data)));
98} 101}
99device_initcall(cpufreq_dt_platdev_init); 102device_initcall(cpufreq_dt_platdev_init);
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 2bd20534155d..5c07ae05d69a 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -25,6 +25,8 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/thermal.h> 26#include <linux/thermal.h>
27 27
28#include "cpufreq-dt.h"
29
28struct private_data { 30struct private_data {
29 struct device *cpu_dev; 31 struct device *cpu_dev;
30 struct thermal_cooling_device *cdev; 32 struct thermal_cooling_device *cdev;
@@ -353,6 +355,7 @@ static struct cpufreq_driver dt_cpufreq_driver = {
353 355
354static int dt_cpufreq_probe(struct platform_device *pdev) 356static int dt_cpufreq_probe(struct platform_device *pdev)
355{ 357{
358 struct cpufreq_dt_platform_data *data = dev_get_platdata(&pdev->dev);
356 int ret; 359 int ret;
357 360
358 /* 361 /*
@@ -366,6 +369,9 @@ static int dt_cpufreq_probe(struct platform_device *pdev)
366 if (ret) 369 if (ret)
367 return ret; 370 return ret;
368 371
372 if (data && data->have_governor_per_policy)
373 dt_cpufreq_driver.flags |= CPUFREQ_HAVE_GOVERNOR_PER_POLICY;
374
369 ret = cpufreq_register_driver(&dt_cpufreq_driver); 375 ret = cpufreq_register_driver(&dt_cpufreq_driver);
370 if (ret) 376 if (ret)
371 dev_err(&pdev->dev, "failed register driver: %d\n", ret); 377 dev_err(&pdev->dev, "failed register driver: %d\n", ret);
diff --git a/drivers/cpufreq/cpufreq-dt.h b/drivers/cpufreq/cpufreq-dt.h
new file mode 100644
index 000000000000..54d774e46c43
--- /dev/null
+++ b/drivers/cpufreq/cpufreq-dt.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright (C) 2016 Linaro
3 * Viresh Kumar <viresh.kumar@linaro.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __CPUFREQ_DT_H__
11#define __CPUFREQ_DT_H__
12
13#include <linux/types.h>
14
15struct cpufreq_dt_platform_data {
16 bool have_governor_per_policy;
17};
18
19#endif /* __CPUFREQ_DT_H__ */