• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (C) 2019 Google, Inc.
4  */
5 #include <linux/cpufreq.h>
6 #include <linux/module.h>
7 
8 static struct cpufreq_frequency_table freq_table[] = {
9 	{ .frequency = 1 },
10 	{ .frequency = 2 },
11 	{ .frequency = CPUFREQ_TABLE_END },
12 };
13 
dummy_cpufreq_target_index(struct cpufreq_policy * policy,unsigned int index)14 static int dummy_cpufreq_target_index(struct cpufreq_policy *policy,
15 				   unsigned int index)
16 {
17 	return 0;
18 }
19 
dummy_cpufreq_driver_init(struct cpufreq_policy * policy)20 static int dummy_cpufreq_driver_init(struct cpufreq_policy *policy)
21 {
22 	policy->freq_table = freq_table;
23 	return 0;
24 }
25 
dummy_cpufreq_get(unsigned int cpu)26 static unsigned int dummy_cpufreq_get(unsigned int cpu)
27 {
28 	return 1;
29 }
30 
dummy_cpufreq_verify(struct cpufreq_policy * policy)31 static int dummy_cpufreq_verify(struct cpufreq_policy *policy)
32 {
33 	return 0;
34 }
35 
36 static struct cpufreq_driver dummy_cpufreq_driver = {
37 	.name = "dummy",
38 	.target_index = dummy_cpufreq_target_index,
39 	.init = dummy_cpufreq_driver_init,
40 	.get = dummy_cpufreq_get,
41 	.verify = dummy_cpufreq_verify,
42 	.attr = cpufreq_generic_attr,
43 };
44 
dummy_cpufreq_init(void)45 static int __init dummy_cpufreq_init(void)
46 {
47 	return cpufreq_register_driver(&dummy_cpufreq_driver);
48 }
49 
dummy_cpufreq_exit(void)50 static void __exit dummy_cpufreq_exit(void)
51 {
52 	cpufreq_unregister_driver(&dummy_cpufreq_driver);
53 }
54 
55 module_init(dummy_cpufreq_init);
56 module_exit(dummy_cpufreq_exit);
57 
58 MODULE_AUTHOR("Connor O'Brien <connoro@google.com>");
59 MODULE_DESCRIPTION("dummy cpufreq driver");
60 MODULE_LICENSE("GPL");
61