From e9716f9df0cf4e406b31d68307e8805d59c90b66 Mon Sep 17 00:00:00 2001 From: Fei Yang Date: Mon, 6 Feb 2012 14:04:10 -0800 Subject: [PATCH] CPUFREQ: PORT FROM R2: expose DOWN_DIFFERENTIAL via sysfs BZ: 22582 Expose down_differential through sysfs for experiment with CPU freq using different workload. Change-Id: Ic0f4cf55a6a641b42aeed77101d51bb7298c8b73 Signed-off-by: Winson Yung Signed-off-by: Fei Yang Reviewed-on: http://android.intel.com:8080/34161 Reviewed-by: Gross, Mark Tested-by: Ng, Cheon-woei Reviewed-by: buildbot Tested-by: buildbot --- drivers/cpufreq/cpufreq_ondemand.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 891360e..0c5a16a 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -37,6 +37,8 @@ #define MICRO_FREQUENCY_MIN_SAMPLE_RATE (10000) #define MIN_FREQUENCY_UP_THRESHOLD (11) #define MAX_FREQUENCY_UP_THRESHOLD (100) +#define MAX_FREQUENCY_DOWN_DIFFERENTIAL (30) +#define MIN_FREQUENCY_DOWN_DIFFERENTIAL MICRO_FREQUENCY_DOWN_DIFFERENTIAL /* * The polling frequency of this governor depends on the capability of @@ -255,6 +257,7 @@ show_one(up_threshold, up_threshold); show_one(sampling_down_factor, sampling_down_factor); show_one(ignore_nice_load, ignore_nice); show_one(powersave_bias, powersave_bias); +show_one(down_differential, down_differential); static ssize_t store_sampling_rate(struct kobject *a, struct attribute *b, const char *buf, size_t count) @@ -281,6 +284,25 @@ static ssize_t store_io_is_busy(struct kobject *a, struct attribute *b, return count; } +static ssize_t store_down_differential(struct kobject *a, struct attribute *b, + const char *buf, size_t count) +{ + unsigned int input; + int ret = sscanf(buf, "%u", &input); + + if (ret != 1 || input < MIN_FREQUENCY_DOWN_DIFFERENTIAL || + input > MAX_FREQUENCY_DOWN_DIFFERENTIAL || + input >= dbs_tuners_ins.up_threshold) { + return -EINVAL; + } + + mutex_lock(&dbs_mutex); + dbs_tuners_ins.down_differential = input; + mutex_unlock(&dbs_mutex); + + return count; +} + static ssize_t store_up_threshold(struct kobject *a, struct attribute *b, const char *buf, size_t count) { @@ -373,12 +395,14 @@ define_one_global_rw(up_threshold); define_one_global_rw(sampling_down_factor); define_one_global_rw(ignore_nice_load); define_one_global_rw(powersave_bias); +define_one_global_rw(down_differential); static struct attribute *dbs_attributes[] = { &sampling_rate_min.attr, &sampling_rate.attr, &up_threshold.attr, &sampling_down_factor.attr, + &down_differential.attr, &ignore_nice_load.attr, &powersave_bias.attr, &io_is_busy.attr, -- 2.7.4