Sudeep KarkadaNagesha | 47ac9aa | 2013-10-29 12:18:39 +0000 | [diff] [blame] | 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"); |