diff options
author | Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> | 2013-10-29 08:18:39 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-10-29 19:48:26 -0400 |
commit | 47ac9aa165540b43deb3582f186073884de1cf3b (patch) | |
tree | b191ae170496778588b34c8150015a7ac353d6a1 /drivers/cpufreq | |
parent | 4d910d5bb56c870e5a737b71d4130ec38dc4faea (diff) |
cpufreq: arm_big_little: add vexpress SPC interface driver
The TC2(i.e. CA15_A7) Versatile Express has external Cortex M3 based
power controller which is responsible for CPU DVFS and SPC provides
the interface for the same.
This patch adds a tiny interface driver to check if OPPs are
initialised by SPC platform code and register the arm_big_little
cpufreq driver.
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/Kconfig.arm | 8 | ||||
-rw-r--r-- | drivers/cpufreq/Makefile | 1 | ||||
-rw-r--r-- | drivers/cpufreq/vexpress-spc-cpufreq.c | 70 |
3 files changed, 79 insertions, 0 deletions
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 701ec95ce954..ce52ed949249 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
@@ -224,3 +224,11 @@ config ARM_TEGRA_CPUFREQ | |||
224 | default y | 224 | default y |
225 | help | 225 | help |
226 | This adds the CPUFreq driver support for TEGRA SOCs. | 226 | This adds the CPUFreq driver support for TEGRA SOCs. |
227 | |||
228 | config ARM_VEXPRESS_SPC_CPUFREQ | ||
229 | tristate "Versatile Express SPC based CPUfreq driver" | ||
230 | select ARM_BIG_LITTLE_CPUFREQ | ||
231 | depends on ARCH_VEXPRESS_SPC | ||
232 | help | ||
233 | This add the CPUfreq driver support for Versatile Express | ||
234 | big.LITTLE platforms using SPC for power management. | ||
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index b7948bbbbf1f..74945652dd7a 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile | |||
@@ -74,6 +74,7 @@ obj-$(CONFIG_ARM_SA1100_CPUFREQ) += sa1100-cpufreq.o | |||
74 | obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o | 74 | obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o |
75 | obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o | 75 | obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o |
76 | obj-$(CONFIG_ARM_TEGRA_CPUFREQ) += tegra-cpufreq.o | 76 | obj-$(CONFIG_ARM_TEGRA_CPUFREQ) += tegra-cpufreq.o |
77 | obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o | ||
77 | 78 | ||
78 | ################################################################################## | 79 | ################################################################################## |
79 | # PowerPC platform drivers | 80 | # PowerPC platform drivers |
diff --git a/drivers/cpufreq/vexpress-spc-cpufreq.c b/drivers/cpufreq/vexpress-spc-cpufreq.c new file mode 100644 index 000000000000..7f7c9c01b44e --- /dev/null +++ b/drivers/cpufreq/vexpress-spc-cpufreq.c | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Versatile Express SPC CPUFreq Interface driver | ||
3 | * | ||
4 | * It provides necessary ops to arm_big_little cpufreq driver. | ||
5 | * | ||
6 | * Copyright (C) 2013 ARM Ltd. | ||
7 | * Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
14 | * kind, whether express or implied; without even the implied warranty | ||
15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | */ | ||
18 | |||
19 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
20 | |||
21 | #include <linux/cpufreq.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/pm_opp.h> | ||
25 | #include <linux/types.h> | ||
26 | |||
27 | #include "arm_big_little.h" | ||
28 | |||
29 | static int ve_spc_init_opp_table(struct device *cpu_dev) | ||
30 | { | ||
31 | /* | ||
32 | * platform specific SPC code must initialise the opp table | ||
33 | * so just check if the OPP count is non-zero | ||
34 | */ | ||
35 | return dev_pm_opp_get_opp_count(cpu_dev) <= 0; | ||
36 | } | ||
37 | |||
38 | static int ve_spc_get_transition_latency(struct device *cpu_dev) | ||
39 | { | ||
40 | return 1000000; /* 1 ms */ | ||
41 | } | ||
42 | |||
43 | static struct cpufreq_arm_bL_ops ve_spc_cpufreq_ops = { | ||
44 | .name = "vexpress-spc", | ||
45 | .get_transition_latency = ve_spc_get_transition_latency, | ||
46 | .init_opp_table = ve_spc_init_opp_table, | ||
47 | }; | ||
48 | |||
49 | static int ve_spc_cpufreq_probe(struct platform_device *pdev) | ||
50 | { | ||
51 | return bL_cpufreq_register(&ve_spc_cpufreq_ops); | ||
52 | } | ||
53 | |||
54 | static int ve_spc_cpufreq_remove(struct platform_device *pdev) | ||
55 | { | ||
56 | bL_cpufreq_unregister(&ve_spc_cpufreq_ops); | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | static struct platform_driver ve_spc_cpufreq_platdrv = { | ||
61 | .driver = { | ||
62 | .name = "vexpress-spc-cpufreq", | ||
63 | .owner = THIS_MODULE, | ||
64 | }, | ||
65 | .probe = ve_spc_cpufreq_probe, | ||
66 | .remove = ve_spc_cpufreq_remove, | ||
67 | }; | ||
68 | module_platform_driver(ve_spc_cpufreq_platdrv); | ||
69 | |||
70 | MODULE_LICENSE("GPL"); | ||