Move all Smartass settings to Kconfig and fix the smartass sysfs interface

file:7efd3a9d0554ddbee2d173236f4cb5f9e54fe5e2 -> file:1bf113db3b97a307fc7fece5b096f5a5f9a0b613
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -146,6 +146,76 @@ config CPU_FREQ_GOV_SMARTASS
If in doubt, say N.
+config SMARTASS_SLEEP_MAX
+ int "Sleep Max Freq"
+ default 245000
+ depends on CPU_FREQ_GOV_SMARTASS
+ help
+ When sleep_max_freq>0 the frequency when suspended will be capped
+ by this frequency. Also will wake up at max frequency of policy
+ to minimize wakeup issues.
+ Set sleep_max_freq=0 to disable this behavior.
+
+config SMARTASS_SLEEP_WAKEUP
+ int "Sleep Wakeup Freq"
+ default CPU_FREQ_MAX_FREQ
+ depends on CPU_FREQ_GOV_SMARTASS
+ help
+ The frequency to set when waking up from sleep.
+ When sleep_max_freq=0 this will have no effect.
+
+config SMARTASS_DEFAULT_SAMPLE_RATE_JIFFIES
+ int "Default sample rate jiffies"
+ default 2
+ depends on CPU_FREQ_GOV_SMARTASS
+ help
+ Sampling rate, I highly recommend to leave it at 2.
+
+config SMARTASS_DEFAULT_RAMP_UP_STEP
+ int "Default ramp up step"
+ default 38400
+ depends on CPU_FREQ_GOV_SMARTASS
+ help
+ Freqeuncy delta when ramping up.
+ zero disables causes to always jump straight to max frequency.
+
+config SMARTASS_DEFAULT_MAX_RAMP_DOWN
+ int "Default ramp down step"
+ default 38400
+ depends on CPU_FREQ_GOV_SMARTASS
+ help
+ Max freqeuncy delta when ramping down. zero disables.
+
+config SMARTASS_DEFAULT_MAX_CPU_LOAD
+ int "Default max cpu load"
+ default 80
+ depends on CPU_FREQ_GOV_SMARTASS
+ help
+ CPU freq will be increased if measured load > max_cpu_load;
+
+config SMARTASS_DEFAULT_MIN_CPU_LOAD
+ int "Default min cpu load"
+ default 30
+ depends on CPU_FREQ_GOV_SMARTASS
+ help
+ CPU freq will be decreased if measured load < min_cpu_load;
+
+config SMARTASS_DEFAULT_DOWN_RATE_US
+ int "Default down rate in us"
+ default 45
+ depends on CPU_FREQ_GOV_SMARTASS
+ help
+ The minimum amount of time to spend at a frequency before we can ramp down,
+ default is 45ms
+
+config SMARTASS_DEFAULT_UP_MIN_FREQ
+ int "Default up minimum frequency"
+ default CPU_FREQ_MAX_FREQ
+ depends on CPU_FREQ_GOV_SMARTASS
+ help
+ When ramping up frequency with no idle cycles jump to at least this frequency.
+ Zero disables. Set a very high value to jump to policy max freqeuncy.
+
config CPU_FREQ_GOV_PERFORMANCE
tristate "'performance' governor"
help
file:597e25491b320739357d00486f3cf4cff98bf2ed -> file:12d1d5db7e3ce39d2ec69e4da722ddded1b7a472
--- a/drivers/cpufreq/cpufreq_smartass.c
+++ b/drivers/cpufreq/cpufreq_smartass.c
@@ -62,14 +62,14 @@ static unsigned int suspended;
* The minimum amount of time to spend at a frequency before we can ramp down,
* default is 45ms.
*/
-#define DEFAULT_DOWN_RATE_US 99000;
+#define DEFAULT_DOWN_RATE_US CONFIG_SMARTASS_DEFAULT_DOWN_RATE_US * 1000;
static unsigned long down_rate_us;
/*
* When ramping up frequency with no idle cycles jump to at least this frequency.
* Zero disables. Set a very high value to jump to policy max freqeuncy.
*/
-#define DEFAULT_UP_MIN_FREQ 0
+#define DEFAULT_UP_MIN_FREQ CONFIG_SMARTASS_DEFAULT_UP_MIN_FREQ
static unsigned int up_min_freq;
/*
@@ -78,45 +78,45 @@ static unsigned int up_min_freq;
* to minimize wakeup issues.
* Set sleep_max_freq=0 to disable this behavior.
*/
-#define DEFAULT_SLEEP_MAX_FREQ CONFIG_MSM_CPU_FREQ_ONDEMAND_MIN
+#define DEFAULT_SLEEP_MAX_FREQ CONFIG_SMARTASS_SLEEP_MAX
static unsigned int sleep_max_freq;
/*
* The frequency to set when waking up from sleep.
* When sleep_max_freq=0 this will have no effect.
*/
-#define DEFAULT_SLEEP_WAKEUP_FREQ CONFIG_MSM_CPU_FREQ_ONDEMAND_MAX
+#define DEFAULT_SLEEP_WAKEUP_FREQ CONFIG_SMARTASS_SLEEP_WAKEUP
static unsigned int sleep_wakeup_freq;
/*
* Sampling rate, I highly recommend to leave it at 2.
*/
-#define DEFAULT_SAMPLE_RATE_JIFFIES 2
+#define DEFAULT_SAMPLE_RATE_JIFFIES CONFIG_SMARTASS_DEFAULT_SAMPLE_RATE_JIFFIES
static unsigned int sample_rate_jiffies;
/*
* Freqeuncy delta when ramping up.
* zero disables causes to always jump straight to max frequency.
*/
-#define DEFAULT_RAMP_UP_STEP 384000
+#define DEFAULT_RAMP_UP_STEP CONFIG_SMARTASS_DEFAULT_RAMP_UP_STEP
static unsigned int ramp_up_step;
/*
* Max freqeuncy delta when ramping down. zero disables.
*/
-#define DEFAULT_MAX_RAMP_DOWN 384000
+#define DEFAULT_MAX_RAMP_DOWN CONFIG_SMARTASS_DEFAULT_MAX_RAMP_DOWN
static unsigned int max_ramp_down;
/*
* CPU freq will be increased if measured load > max_cpu_load;
*/
-#define DEFAULT_MAX_CPU_LOAD 55
+#define DEFAULT_MAX_CPU_LOAD CONFIG_SMARTASS_DEFAULT_MAX_CPU_LOAD
static unsigned long max_cpu_load;
/*
* CPU freq will be decreased if measured load < min_cpu_load;
*/
-#define DEFAULT_MIN_CPU_LOAD 35
+#define DEFAULT_MIN_CPU_LOAD CONFIG_SMARTASS_DEFAULT_MIN_CPU_LOAD
static unsigned long min_cpu_load;
@@ -320,7 +320,10 @@ static ssize_t store_down_rate_us(struct
res = strict_strtoul(buf, 0, &input);
if (res >= 0 && input >= 1000 && input <= 100000000)
down_rate_us = input;
- return res;
+ if (res)
+ return res;
+ else
+ return count;
}
static struct freq_attr down_rate_us_attr = __ATTR(down_rate_us, 0644,
@@ -338,7 +341,10 @@ static ssize_t store_up_min_freq(struct
res = strict_strtoul(buf, 0, &input);
if (res >= 0 && input >= 0)
up_min_freq = input;
- return res;
+ if (res)
+ return res;
+ else
+ return count;
}
static struct freq_attr up_min_freq_attr = __ATTR(up_min_freq, 0644,
@@ -356,7 +362,10 @@ static ssize_t store_sleep_max_freq(stru
res = strict_strtoul(buf, 0, &input);
if (res >= 0 && input >= 0)
sleep_max_freq = input;
- return res;
+ if (res)
+ return res;
+ else
+ return count;
}
static struct freq_attr sleep_max_freq_attr = __ATTR(sleep_max_freq, 0644,
@@ -374,7 +383,10 @@ static ssize_t store_sleep_wakeup_freq(s
res = strict_strtoul(buf, 0, &input);
if (res >= 0 && input >= 0)
sleep_wakeup_freq = input;
- return res;
+ if (res)
+ return res;
+ else
+ return count;
}
static struct freq_attr sleep_wakeup_freq_attr = __ATTR(sleep_wakeup_freq, 0644,
@@ -392,7 +404,10 @@ static ssize_t store_sample_rate_jiffies
res = strict_strtoul(buf, 0, &input);
if (res >= 0 && input > 0 && input <= 1000)
sample_rate_jiffies = input;
- return res;
+ if (res)
+ return res;
+ else
+ return count;
}
static struct freq_attr sample_rate_jiffies_attr = __ATTR(sample_rate_jiffies, 0644,
@@ -410,7 +425,10 @@ static ssize_t store_ramp_up_step(struct
res = strict_strtoul(buf, 0, &input);
if (res >= 0)
ramp_up_step = input;
- return res;
+ if (res)
+ return res;
+ else
+ return count;
}
static struct freq_attr ramp_up_step_attr = __ATTR(ramp_up_step, 0644,
@@ -428,7 +446,10 @@ static ssize_t store_max_ramp_down(struc
res = strict_strtoul(buf, 0, &input);
if (res >= 0)
max_ramp_down = input;
- return res;
+ if (res)
+ return res;
+ else
+ return count;
}
static struct freq_attr max_ramp_down_attr = __ATTR(max_ramp_down, 0644,
@@ -446,7 +467,10 @@ static ssize_t store_max_cpu_load(struct
res = strict_strtoul(buf, 0, &input);
if (res >= 0 && input > 0 && input <= 100)
max_cpu_load = input;
- return res;
+ if (res)
+ return res;
+ else
+ return count;
}
static struct freq_attr max_cpu_load_attr = __ATTR(max_cpu_load, 0644,
@@ -464,7 +488,10 @@ static ssize_t store_min_cpu_load(struct
res = strict_strtoul(buf, 0, &input);
if (res >= 0 && input > 0 && input < 100)
min_cpu_load = input;
- return res;
+ if (res)
+ return res;
+ else
+ return count;
}
static struct freq_attr min_cpu_load_attr = __ATTR(min_cpu_load, 0644,