summaryrefslogtreecommitdiffstats
path: root/power
diff options
context:
space:
mode:
Diffstat (limited to 'power')
-rw-r--r--power/power_tuna.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/power/power_tuna.c b/power/power_tuna.c
index 34b488f..a544f9a 100644
--- a/power/power_tuna.c
+++ b/power/power_tuna.c
@@ -40,6 +40,7 @@ struct tuna_power_module {
pthread_mutex_t lock;
int boostpulse_fd;
int boostpulse_warned;
+ int inited;
};
static void sysfs_write(char *path, char *s)
@@ -82,6 +83,8 @@ int sysfs_read(const char *path, char *buf, size_t size)
static void tuna_power_init(struct power_module *module)
{
+ struct tuna_power_module *tuna = (struct tuna_power_module *) module;
+
sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/timer_rate",
"20000");
sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/min_sample_time",
@@ -94,6 +97,9 @@ static void tuna_power_init(struct power_module *module)
"99");
sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay",
"80000");
+
+ ALOGI("Initialized successfully");
+ tuna->inited = 1;
}
static int boostpulse_open(struct tuna_power_module *tuna)
@@ -120,10 +126,14 @@ static int boostpulse_open(struct tuna_power_module *tuna)
static void tuna_power_set_interactive(struct power_module *module, int on)
{
+ struct tuna_power_module *tuna = (struct tuna_power_module *) module;
int len;
-
char buf[MAX_BUF_SZ];
+ if (!tuna->inited) {
+ return;
+ }
+
/*
* Lower maximum frequency when screen is off. CPU 0 and 1 share a
* cpufreq policy.
@@ -150,6 +160,10 @@ static void tuna_power_hint(struct power_module *module, power_hint_t hint,
char buf[80];
int len;
+ if (!tuna->inited) {
+ return;
+ }
+
switch (hint) {
case POWER_HINT_INTERACTION:
if (boostpulse_open(tuna) >= 0) {