Release 4.7 drivers/cpufreq/cpufreq_userspace.c
/*
* linux/drivers/cpufreq/cpufreq_userspace.c
*
* Copyright (C) 2001 Russell King
* (C) 2002 - 2004 Dominik Brodowski <linux@brodo.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/cpufreq.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>
static DEFINE_PER_CPU(unsigned int, cpu_is_managed);
static DEFINE_MUTEX(userspace_mutex);
/**
* cpufreq_set - set the CPU frequency
* @policy: pointer to policy struct where freq is being set
* @freq: target frequency in kHz
*
* Sets the CPU frequency to freq.
*/
static int cpufreq_set(struct cpufreq_policy *policy, unsigned int freq)
{
int ret = -EINVAL;
unsigned int *setspeed = policy->governor_data;
pr_debug("cpufreq_set for cpu %u, freq %u kHz\n", policy->cpu, freq);
mutex_lock(&userspace_mutex);
if (!per_cpu(cpu_is_managed, policy->cpu))
goto err;
*setspeed = freq;
ret = __cpufreq_driver_target(policy, freq, CPUFREQ_RELATION_L);
err:
mutex_unlock(&userspace_mutex);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
dave jones | dave jones | 45 | 50.56% | 1 | 12.50% |
sai gurrappadi | sai gurrappadi | 14 | 15.73% | 1 | 12.50% |
dominik brodowski | dominik brodowski | 9 | 10.11% | 2 | 25.00% |
thomas renninger | thomas renninger | 9 | 10.11% | 1 | 12.50% |
mike travis | mike travis | 4 | 4.49% | 1 | 12.50% |
andrew morton | andrew morton | 4 | 4.49% | 1 | 12.50% |
venkatesh pallipadi | venkatesh pallipadi | 4 | 4.49% | 1 | 12.50% |
| Total | 89 | 100.00% | 8 | 100.00% |
static ssize_t show_speed(struct cpufreq_policy *policy, char *buf)
{
return sprintf(buf, "%u\n", policy->cur);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
dominik brodowski | dominik brodowski | 22 | 81.48% | 1 | 33.33% |
dave jones | dave jones | 4 | 14.81% | 1 | 33.33% |
viresh kumar | viresh kumar | 1 | 3.70% | 1 | 33.33% |
| Total | 27 | 100.00% | 3 | 100.00% |
static int cpufreq_userspace_policy_init(struct cpufreq_policy *policy)
{
unsigned int *setspeed;
setspeed = kzalloc(sizeof(*setspeed), GFP_KERNEL);
if (!setspeed)
return -ENOMEM;
policy->governor_data = setspeed;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
sai gurrappadi | sai gurrappadi | 47 | 100.00% | 1 | 100.00% |
| Total | 47 | 100.00% | 1 | 100.00% |
static int cpufreq_governor_userspace(struct cpufreq_policy *policy,
unsigned int event)
{
unsigned int *setspeed = policy->governor_data;
unsigned int cpu = policy->cpu;
int rc = 0;
if (event == CPUFREQ_GOV_POLICY_INIT)
return cpufreq_userspace_policy_init(policy);
if (!setspeed)
return -EINVAL;
switch (event) {
case CPUFREQ_GOV_POLICY_EXIT:
mutex_lock(&userspace_mutex);
policy->governor_data = NULL;
kfree(setspeed);
mutex_unlock(&userspace_mutex);
break;
case CPUFREQ_GOV_START:
BUG_ON(!policy->cur);
pr_debug("started managing cpu %u\n", cpu);
mutex_lock(&userspace_mutex);
per_cpu(cpu_is_managed, cpu) = 1;
*setspeed = policy->cur;
mutex_unlock(&userspace_mutex);
break;
case CPUFREQ_GOV_STOP:
pr_debug("managing cpu %u stopped\n", cpu);
mutex_lock(&userspace_mutex);
per_cpu(cpu_is_managed, cpu) = 0;
*setspeed = 0;
mutex_unlock(&userspace_mutex);
break;
case CPUFREQ_GOV_LIMITS:
mutex_lock(&userspace_mutex);
pr_debug("limit event for cpu %u: %u - %u kHz, currently %u kHz, last set to %u kHz\n",
cpu, policy->min, policy->max, policy->cur, *setspeed);
if (policy->max < *setspeed)
__cpufreq_driver_target(policy, policy->max,
CPUFREQ_RELATION_H);
else if (policy->min > *setspeed)
__cpufreq_driver_target(policy, policy->min,
CPUFREQ_RELATION_L);
else
__cpufreq_driver_target(policy, *setspeed,
CPUFREQ_RELATION_L);
mutex_unlock(&userspace_mutex);
break;
}
return rc;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
dominik brodowski | dominik brodowski | 103 | 38.43% | 2 | 14.29% |
sai gurrappadi | sai gurrappadi | 88 | 32.84% | 1 | 7.14% |
dave jones | dave jones | 19 | 7.09% | 5 | 35.71% |
viresh kumar | viresh kumar | 17 | 6.34% | 1 | 7.14% |
mike travis | mike travis | 15 | 5.60% | 1 | 7.14% |
thomas renninger | thomas renninger | 8 | 2.99% | 1 | 7.14% |
andrew morton | andrew morton | 8 | 2.99% | 1 | 7.14% |
jeff garzik | jeff garzik | 6 | 2.24% | 1 | 7.14% |
venkatesh pallipadi | venkatesh pallipadi | 4 | 1.49% | 1 | 7.14% |
| Total | 268 | 100.00% | 14 | 100.00% |
static struct cpufreq_governor cpufreq_gov_userspace = {
.name = "userspace",
.governor = cpufreq_governor_userspace,
.store_setspeed = cpufreq_set,
.show_setspeed = show_speed,
.owner = THIS_MODULE,
};
static int __init cpufreq_gov_userspace_init(void)
{
return cpufreq_register_governor(&cpufreq_gov_userspace);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
dominik brodowski | dominik brodowski | 14 | 87.50% | 1 | 50.00% |
dave jones | dave jones | 2 | 12.50% | 1 | 50.00% |
| Total | 16 | 100.00% | 2 | 100.00% |
static void __exit cpufreq_gov_userspace_exit(void)
{
cpufreq_unregister_governor(&cpufreq_gov_userspace);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
dominik brodowski | dominik brodowski | 15 | 100.00% | 1 | 100.00% |
| Total | 15 | 100.00% | 1 | 100.00% |
MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>, "
"Russell King <rmk@arm.linux.org.uk>");
MODULE_DESCRIPTION("CPUfreq policy governor 'userspace'");
MODULE_LICENSE("GPL");
#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE
struct cpufreq_governor *cpufreq_default_governor(void)
{
return &cpufreq_gov_userspace;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rafael j. wysocki | rafael j. wysocki | 13 | 100.00% | 1 | 100.00% |
| Total | 13 | 100.00% | 1 | 100.00% |
fs_initcall(cpufreq_gov_userspace_init);
#else
module_init(cpufreq_gov_userspace_init);
#endif
module_exit(cpufreq_gov_userspace_exit);
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
dominik brodowski | dominik brodowski | 215 | 36.88% | 2 | 8.70% |
sai gurrappadi | sai gurrappadi | 152 | 26.07% | 1 | 4.35% |
dave jones | dave jones | 80 | 13.72% | 10 | 43.48% |
viresh kumar | viresh kumar | 27 | 4.63% | 2 | 8.70% |
mike travis | mike travis | 26 | 4.46% | 1 | 4.35% |
venkatesh pallipadi | venkatesh pallipadi | 19 | 3.26% | 2 | 8.70% |
thomas renninger | thomas renninger | 17 | 2.92% | 1 | 4.35% |
andrew morton | andrew morton | 15 | 2.57% | 1 | 4.35% |
rafael j. wysocki | rafael j. wysocki | 14 | 2.40% | 1 | 4.35% |
johannes weiner | johannes weiner | 12 | 2.06% | 1 | 4.35% |
jeff garzik | jeff garzik | 6 | 1.03% | 1 | 4.35% |
| Total | 583 | 100.00% | 23 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.