summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher N. Hesse <raymanfx@gmail.com>2017-01-16 23:39:48 +0100
committerChristopher N. Hesse <raymanfx@gmail.com>2017-02-09 19:54:30 +0000
commit5fada9b0c83ab53e06a6e95f4c7eb271f8b9422d (patch)
treed650d384de205246532f6d2aea5a2179b8d2ab49
parentc7dd07ab9beb58fb93841d6702b0e58667448af5 (diff)
downloadandroid_hardware_samsung-5fada9b0c83ab53e06a6e95f4c7eb271f8b9422d.tar.gz
android_hardware_samsung-5fada9b0c83ab53e06a6e95f4c7eb271f8b9422d.tar.bz2
android_hardware_samsung-5fada9b0c83ab53e06a6e95f4c7eb271f8b9422d.zip
power: Add support for POWER_HINT_CPU_BOOST
Change-Id: I75030eb2dabfed518e961d71efb9d55670d2808a
-rw-r--r--power/include/samsung_power.h1
-rw-r--r--power/power.c25
2 files changed, 26 insertions, 0 deletions
diff --git a/power/include/samsung_power.h b/power/include/samsung_power.h
index ffc46b1..93752df 100644
--- a/power/include/samsung_power.h
+++ b/power/include/samsung_power.h
@@ -24,6 +24,7 @@
* symlink to the locations given here, or override this header in your
* device tree.
*/
+#define BOOST_PATH "/sys/devices/system/cpu/cpu0/cpufreq/interactive/boost"
#define BOOSTPULSE_PATH "/sys/devices/system/cpu/cpu0/cpufreq/interactive/boostpulse"
#define IO_IS_BUSY_PATH "/sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy"
diff --git a/power/power.c b/power/power.c
index d75b405..5856e1f 100644
--- a/power/power.c
+++ b/power/power.c
@@ -119,6 +119,26 @@ static void sysfs_write(const char *path, char *s)
close(fd);
}
+static void boost(int32_t duration_us)
+{
+ int fd;
+
+ if (duration_us <= 0)
+ return;
+
+ fd = open(BOOST_PATH, O_WRONLY);
+ if (fd < 0) {
+ ALOGE("Error opening %s\n", BOOST_PATH);
+ return;
+ }
+
+ write(fd, "1", 1);
+ usleep(duration_us);
+ write(fd, "0", 1);
+
+ close(fd);
+}
+
/**********************************************************
*** POWER FUNCTIONS
**********************************************************/
@@ -393,6 +413,11 @@ static void samsung_power_hint(struct power_module *module,
ALOGV("%s: POWER_HINT_VSYNC", __func__);
break;
}
+#ifdef POWER_HINT_CPU_BOOST
+ case POWER_HINT_CPU_BOOST:
+ boost((*(int32_t *)data));
+ break;
+#endif
case POWER_HINT_SET_PROFILE: {
int profile = *((intptr_t *)data);