2 * Vexpress big.LITTLE CPUFreq Interface driver
4 * It provides necessary ops to arm_big_little cpufreq driver and gets
5 * Frequency information from Device Tree. Freq table in DT must be in KHz.
7 * Copyright (C) 2013 Linaro.
8 * Viresh Kumar <viresh.kumar@linaro.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
15 * kind, whether express or implied; without even the implied warranty
16 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
20 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22 #include <linux/cpufreq.h>
23 #include <linux/export.h>
24 #include <linux/opp.h>
25 #include <linux/module.h>
26 #include <linux/types.h>
27 #include <linux/vexpress.h>
28 #include "arm_big_little.h"
30 static int vexpress_init_opp_table(struct device *cpu_dev)
32 int i = -1, count, cluster = cpu_to_cluster(cpu_dev->id);
36 count = vexpress_spc_get_freq_table(cluster, &table);
37 if (!table || !count) {
38 pr_err("SPC controller returned invalid freq table");
43 /* FIXME: Voltage value */
44 ret = opp_add(cpu_dev, table[i] * 1000, 900000);
46 dev_warn(cpu_dev, "%s: Failed to add OPP %d, err: %d\n",
47 __func__, table[i] * 1000, ret);
55 static int vexpress_get_transition_latency(struct device *cpu_dev)
61 static struct cpufreq_arm_bL_ops vexpress_bL_ops = {
62 .name = "vexpress-bL",
63 .get_transition_latency = vexpress_get_transition_latency,
64 .init_opp_table = vexpress_init_opp_table,
67 static int vexpress_bL_init(void)
69 if (!vexpress_spc_check_loaded()) {
70 pr_info("%s: No SPC found\n", __func__);
74 return bL_cpufreq_register(&vexpress_bL_ops);
76 module_init(vexpress_bL_init);
78 static void vexpress_bL_exit(void)
80 return bL_cpufreq_unregister(&vexpress_bL_ops);
82 module_exit(vexpress_bL_exit);
84 MODULE_AUTHOR("Viresh Kumar <viresh.kumar@linaro.org>");
85 MODULE_DESCRIPTION("ARM Vexpress big LITTLE cpufreq driver");
86 MODULE_LICENSE("GPL");