2 * Copyright (c) 2012 NVIDIA CORPORATION. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include <linux/mutex.h>
20 #include <linux/module.h>
21 #include <linux/cpuquiet.h>
22 #include <linux/sysfs.h>
24 static DEFINE_MUTEX(userspace_mutex);
26 static int governor_set(unsigned int cpu, bool active)
28 mutex_lock(&userspace_mutex);
30 cpuquiet_wake_cpu(cpu);
32 cpuquiet_quiesence_cpu(cpu);
33 mutex_unlock(&userspace_mutex);
38 struct cpuquiet_governor userspace_governor = {
40 .store_active = governor_set,
44 static int __init init_usermode(void)
46 return cpuquiet_register_governor(&userspace_governor);
49 static void __exit exit_usermode(void)
51 cpuquiet_unregister_governor(&userspace_governor);
54 MODULE_LICENSE("GPL");
55 #ifdef CONFIG_CPUQUIET_DEFAULT_GOV_USERSPACE
56 fs_initcall(init_usermode);
58 module_init(init_usermode);
60 module_exit(exit_usermode);