aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-03-30 04:15:26 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-04-08 19:18:42 -0400
commitf56aad1d98f1c0c6df513abcd275a4d914adc1ef (patch)
tree2964e69e5e24ea1dfaf7c4682b47cd04ba7aaa5b
parent7e67e239a4f32fa3e2d51dd9a7930018651635b6 (diff)
cpufreq: dt: Add generic platform-device creation support
Multiple platforms are using the generic cpufreq-dt driver now, and all of them are required to create a platform device with name "cpufreq-dt", in order to get the cpufreq-dt probed. Many of them do it from platform code, others have special drivers just to do that. It would be more sensible to do this at a generic place, where all such platform can mark their entries. This patch adds a separate file to get this device created. Currently the compat list of platforms that we support is empty, and will be filled in as and when we move platforms to use it. It always compiles as part of the kernel and so doesn't need a module-exit operation. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/Kconfig10
-rw-r--r--drivers/cpufreq/Makefile1
-rw-r--r--drivers/cpufreq/cpufreq-dt-platdev.c32
3 files changed, 43 insertions, 0 deletions
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index 5d74826d75be..b38d5028a03e 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -225,6 +225,7 @@ config CPUFREQ_DT
225 depends on HAVE_CLK && OF 225 depends on HAVE_CLK && OF
226 # if CPU_THERMAL is on and THERMAL=m, CPUFREQ_DT cannot be =y: 226 # if CPU_THERMAL is on and THERMAL=m, CPUFREQ_DT cannot be =y:
227 depends on !CPU_THERMAL || THERMAL 227 depends on !CPU_THERMAL || THERMAL
228 select CPUFREQ_DT_PLATDEV
228 select PM_OPP 229 select PM_OPP
229 help 230 help
230 This adds a generic DT based cpufreq driver for frequency management. 231 This adds a generic DT based cpufreq driver for frequency management.
@@ -233,6 +234,15 @@ config CPUFREQ_DT
233 234
234 If in doubt, say N. 235 If in doubt, say N.
235 236
237config CPUFREQ_DT_PLATDEV
238 bool
239 help
240 This adds a generic DT based cpufreq platdev driver for frequency
241 management. This creates a 'cpufreq-dt' platform device, on the
242 supported platforms.
243
244 If in doubt, say N.
245
236if X86 246if X86
237source "drivers/cpufreq/Kconfig.x86" 247source "drivers/cpufreq/Kconfig.x86"
238endif 248endif
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 6d1186701a9c..d7b646c0f2e9 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_CPU_FREQ_GOV_COMMON) += cpufreq_governor.o
14obj-$(CONFIG_CPU_FREQ_GOV_ATTR_SET) += cpufreq_governor_attr_set.o 14obj-$(CONFIG_CPU_FREQ_GOV_ATTR_SET) += cpufreq_governor_attr_set.o
15 15
16obj-$(CONFIG_CPUFREQ_DT) += cpufreq-dt.o 16obj-$(CONFIG_CPUFREQ_DT) += cpufreq-dt.o
17obj-$(CONFIG_CPUFREQ_DT_PLATDEV) += cpufreq-dt-platdev.o
17 18
18################################################################################## 19##################################################################################
19# x86 drivers. 20# x86 drivers.
diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
new file mode 100644
index 000000000000..2a3532427ecf
--- /dev/null
+++ b/drivers/cpufreq/cpufreq-dt-platdev.c
@@ -0,0 +1,32 @@
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#include <linux/err.h>
11#include <linux/of.h>
12#include <linux/platform_device.h>
13
14static const struct of_device_id machines[] = {
15};
16
17static int __init cpufreq_dt_platdev_init(void)
18{
19 struct device_node *np = of_find_node_by_path("/");
20
21 if (!np)
22 return -ENODEV;
23
24 if (!of_match_node(machines, np))
25 return -ENODEV;
26
27 of_node_put(of_root);
28
29 return PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", -1,
30 NULL, 0));
31}
32device_initcall(cpufreq_dt_platdev_init);