summaryrefslogtreecommitdiffstats
path: root/power
diff options
context:
space:
mode:
authorZiyann <jaraidaniel@gmail.com>2014-10-07 21:48:15 +0200
committerZiyann <jaraidaniel@gmail.com>2014-11-14 09:05:12 +0100
commit392ceec578ad4cdf77cee24801f8b588274dbd05 (patch)
treee413c9441069e69c0e0a36fab91a3f88de1b5165 /power
parentd04712d6739ee8f73b5a568c14348e8a975ff653 (diff)
downloaddevice_samsung_tuna-392ceec578ad4cdf77cee24801f8b588274dbd05.zip
device_samsung_tuna-392ceec578ad4cdf77cee24801f8b588274dbd05.tar.gz
device_samsung_tuna-392ceec578ad4cdf77cee24801f8b588274dbd05.tar.bz2
tuna: PowerHAL: Check that PowerHAL is successfully initialized
It doesn't make any sense to do something if PowerHAL couldn't setup initial parameters successfully. Cherry-picked and adjusted for tuna from http://omapzoom.org/?p=device/ti/blaze_tablet.git;a=commit;h=5b250f0dbc8fa43f8ff9e45151730b5b733c5ed0 Change-Id: I4e87f6b7be53e52f21f02cc500c8a1096f70df5f
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) {