From 5fada9b0c83ab53e06a6e95f4c7eb271f8b9422d Mon Sep 17 00:00:00 2001 From: "Christopher N. Hesse" Date: Mon, 16 Jan 2017 23:39:48 +0100 Subject: [PATCH] power: Add support for POWER_HINT_CPU_BOOST Change-Id: I75030eb2dabfed518e961d71efb9d55670d2808a --- power/include/samsung_power.h | 1 + power/power.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/power/include/samsung_power.h b/power/include/samsung_power.h index ffc46b11..93752df6 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 d75b4057..5856e1f3 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);