diff options
author | Todd Poynor <toddpoynor@google.com> | 2012-04-23 20:42:41 -0700 |
---|---|---|
committer | Todd Poynor <toddpoynor@google.com> | 2012-04-24 20:25:03 -0700 |
commit | 5d61d3a6e2103801565048202999423657b4430a (patch) | |
tree | de1803f62809a68c8ed868bafc0979a8ea5b3d1f /drivers/cpufreq/cpufreq_interactive.c | |
parent | 66510aa1148e3457e7d46e0a2582dac7c591b95d (diff) | |
download | kernel_samsung_tuna-5d61d3a6e2103801565048202999423657b4430a.zip kernel_samsung_tuna-5d61d3a6e2103801565048202999423657b4430a.tar.gz kernel_samsung_tuna-5d61d3a6e2103801565048202999423657b4430a.tar.bz2 |
cpufreq: interactive: Add sysfs boost interface for hints from userspace
The explicit hint on/off version.
Change-Id: Ibf62b6d45bf6fb8c9c055b9bdaf074ce9374c04f
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq_interactive.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_interactive.c | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index 52d2fe8..10a31db 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -29,12 +29,11 @@ #include <linux/mutex.h> #include <linux/slab.h> #include <linux/input.h> +#include <asm/cputime.h> #define CREATE_TRACE_POINTS #include <trace/events/cpufreq_interactive.h> -#include <asm/cputime.h> - static atomic_t active_count = ATOMIC_INIT(0); struct cpufreq_interactive_cpuinfo { @@ -92,7 +91,7 @@ static unsigned long timer_rate; static unsigned long above_hispeed_delay_val; /* - * Boost to hispeed on touchscreen input. + * Boost pulse to hispeed on touchscreen input. */ static int input_boost_val; @@ -104,6 +103,12 @@ struct cpufreq_interactive_inputopen { static struct cpufreq_interactive_inputopen inputopen; +/* + * Non-zero means longer-term speed boost active. + */ + +static int boost_val; + static int cpufreq_governor_interactive(struct cpufreq_policy *policy, unsigned int event); @@ -189,7 +194,7 @@ static void cpufreq_interactive_timer(unsigned long data) if (load_since_change > cpu_load) cpu_load = load_since_change; - if (cpu_load >= go_hispeed_load) { + if (cpu_load >= go_hispeed_load || boost_val) { if (pcpu->target_freq <= pcpu->policy->min) { new_freq = hispeed_freq; } else { @@ -519,6 +524,12 @@ static void cpufreq_interactive_boost(void) wake_up_process(up_task); } +/* + * Pulsed boost on input event raises CPUs to hispeed_freq and lets + * usual algorithm of min_sample_time decide when to allow speed + * to drop. + */ + static void cpufreq_interactive_input_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) @@ -734,6 +745,34 @@ static ssize_t store_input_boost(struct kobject *kobj, struct attribute *attr, define_one_global_rw(input_boost); +static ssize_t show_boost(struct kobject *kobj, struct attribute *attr, + char *buf) +{ + return sprintf(buf, "%d\n", boost_val); +} + +static ssize_t store_boost(struct kobject *kobj, struct attribute *attr, + const char *buf, size_t count) +{ + int ret; + unsigned long val; + + ret = kstrtoul(buf, 0, &val); + if (ret < 0) + return ret; + + boost_val = val; + + if (boost_val) + cpufreq_interactive_boost(); + else + trace_cpufreq_interactive_unboost(hispeed_freq); + + return count; +} + +define_one_global_rw(boost); + static struct attribute *interactive_attributes[] = { &hispeed_freq_attr.attr, &go_hispeed_load_attr.attr, @@ -741,6 +780,7 @@ static struct attribute *interactive_attributes[] = { &min_sample_time_attr.attr, &timer_rate_attr.attr, &input_boost.attr, + &boost.attr, NULL, }; |