diff options
author | Peter Boonstoppel <pboonstoppel@nvidia.com> | 2011-10-13 12:41:56 -0700 |
---|---|---|
committer | Varun Wadekar <vwadekar@nvidia.com> | 2011-12-08 17:03:02 +0530 |
commit | 2da5414611eebd0ee001fb5d00833a406620927a (patch) | |
tree | 90017f6a93748fe8b126915154ecd300b1311d40 /drivers | |
parent | d807108c732e09910b2096b6665fe41b13d64717 (diff) |
cpufreq interactive governor: add max_boost sysfs node
Allows you to specify a max increase in frequency, disabled by default.
Cherry-pick from: http://git-master/r/#change,57928
Change-Id: I8174e31faceaa7c27adfe52515e951a4092a39f3
Signed-off-by: Daniel Solomon <daniels@nvidia.com>
Reviewed-on: http://git-master/r/65601
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cpufreq/cpufreq_interactive.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index 2e3d0f6a2eaf..e87942831186 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -65,6 +65,9 @@ static unsigned long go_maxspeed_load; /* Base of exponential raise to max speed; if 0 - jump to maximum */ static unsigned long boost_factor; +/* Max frequency boost in Hz; if 0 - no max is enforced */ +static unsigned long max_boost; + /* * Targeted sustainable load relatively to current frequency. * If 0, target is set realtively to the max speed @@ -114,6 +117,9 @@ static unsigned int cpufreq_interactive_get_target( return policy->max; target_freq = policy->cur * boost_factor; + + if (max_boost && target_freq > policy->cur + max_boost) + target_freq = policy->cur + max_boost; } else { if (!sustain_load) @@ -494,6 +500,22 @@ static ssize_t store_boost_factor(struct kobject *kobj, static struct global_attr boost_factor_attr = __ATTR(boost_factor, 0644, show_boost_factor, store_boost_factor); +static ssize_t show_max_boost(struct kobject *kobj, + struct attribute *attr, char *buf) +{ + return sprintf(buf, "%lu\n", max_boost); +} + +static ssize_t store_max_boost(struct kobject *kobj, + struct attribute *attr, const char *buf, size_t count) +{ + return strict_strtoul(buf, 0, &max_boost); +} + +static struct global_attr max_boost_attr = __ATTR(max_boost, 0644, + show_max_boost, store_max_boost); + + static ssize_t show_sustain_load(struct kobject *kobj, struct attribute *attr, char *buf) { @@ -556,6 +578,7 @@ static struct global_attr timer_rate_attr = __ATTR(timer_rate, 0644, static struct attribute *interactive_attributes[] = { &go_maxspeed_load_attr.attr, &boost_factor_attr.attr, + &max_boost_attr.attr, &sustain_load_attr.attr, &min_sample_time_attr.attr, &timer_rate_attr.attr, |