summaryrefslogtreecommitdiff
path: root/drivers/cpuquiet
diff options
context:
space:
mode:
authorPeter De Schrijver <pdeschrijver@nvidia.com>2012-03-30 11:44:32 +0300
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 01:33:36 -0700
commitf2243a5793236bae659632a9191c6d4e48a34f47 (patch)
tree02d451b08b338b307f6d28c50027f709d1373ea1 /drivers/cpuquiet
parent7b6628fdc15e15a6c4c7b0896571c1c7222a763f (diff)
cpuquiet: userspace governor
Change-Id: If9830d423b1751cbe9493eda0a85f88e7003173f Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com> Reviewed-on: http://git-master/r/105270 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Sai Gurrappadi <sgurrappadi@nvidia.com> Tested-by: Sai Gurrappadi <sgurrappadi@nvidia.com> Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com> Rebase-Id: R382af37ab50a08c17c635bb1fee7e16afd0d9a18
Diffstat (limited to 'drivers/cpuquiet')
-rw-r--r--drivers/cpuquiet/governors/userspace.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/cpuquiet/governors/userspace.c b/drivers/cpuquiet/governors/userspace.c
new file mode 100644
index 000000000000..470056c5e32a
--- /dev/null
+++ b/drivers/cpuquiet/governors/userspace.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012 NVIDIA CORPORATION. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <linux/mutex.h>
+#include <linux/module.h>
+#include <linux/cpuquiet.h>
+#include <linux/sysfs.h>
+
+static DEFINE_MUTEX(userspace_mutex);
+
+static int governor_set(unsigned int cpu, bool active)
+{
+ mutex_lock(&userspace_mutex);
+ if (active)
+ cpuquiet_wake_cpu(cpu);
+ else
+ cpuquiet_quiesence_cpu(cpu);
+ mutex_unlock(&userspace_mutex);
+
+ return 0;
+}
+
+struct cpuquiet_governor userspace_governor = {
+ .name = "userspace",
+ .store_active = governor_set,
+ .owner = THIS_MODULE,
+};
+
+static int __init init_usermode(void)
+{
+ return cpuquiet_register_governor(&userspace_governor);
+}
+
+static void __exit exit_usermode(void)
+{
+ cpuquiet_unregister_governor(&userspace_governor);
+}
+
+MODULE_LICENSE("GPL");
+module_init(init_usermode);
+module_exit(exit_usermode);