summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVince Leung <vincentl@codeaurora.org>2013-05-22 20:04:41 -0700
committerThe Android Automerger <android-build@android.com>2013-05-23 20:00:19 -0700
commit54617c959f4ba2bf799d80947353d5276660ba1e (patch)
treeb507ead228a479eecc5c5415d8dbd7ee37691b73
parentc0973cab514ca6476d01186d09076d3490c0d4cb (diff)
downloadpower-54617c959f4ba2bf799d80947353d5276660ba1e.tar.gz
add coreboost feature and enable it when display is on
Change-Id: I12aec9092142a162b0ea42b8dc2ae94677549b0a
-rw-r--r--power.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/power.c b/power.c
index a4569a5..ac26e21 100644
--- a/power.c
+++ b/power.c
@@ -27,7 +27,7 @@
#include <hardware/hardware.h>
#include <hardware/power.h>
-#define TOUCHBOOST_SOCKET "/dev/socket/mpdecision/touchboost"
+#define BOOST_SOCKET "/dev/socket/mpdecision/boost"
static int client_sockfd;
static struct sockaddr_un client_addr;
@@ -42,7 +42,7 @@ static void power_init(struct power_module *module)
}
memset(&client_addr, 0, sizeof(struct sockaddr_un));
client_addr.sun_family = AF_UNIX;
- snprintf(client_addr.sun_path, UNIX_PATH_MAX, TOUCHBOOST_SOCKET);
+ snprintf(client_addr.sun_path, UNIX_PATH_MAX, BOOST_SOCKET);
}
static void touch_boost()
@@ -60,11 +60,35 @@ static void touch_boost()
}
}
+static void core_boost(int on)
+{
+ int rc;
+
+ if (client_sockfd < 0) {
+ ALOGE("%s: touchboost socket not created", __func__);
+ return;
+ }
+
+ if (!on) {
+ rc = sendto(client_sockfd, "2", 1, 0, (const struct sockaddr *)&client_addr, sizeof(struct sockaddr_un));
+ } else {
+ rc = sendto(client_sockfd, "3", 1, 0, (const struct sockaddr *)&client_addr, sizeof(struct sockaddr_un));
+ }
+
+ if (rc < 0) {
+ ALOGE("%s: failed to send: %s", __func__, strerror(errno));
+ }
+}
+
static void power_set_interactive(struct power_module *module, int on)
{
ALOGV("%s %s", __func__, (on ? "ON" : "OFF"));
- if (on)
+ if (on) {
+ core_boost(1);
touch_boost();
+ } else {
+ core_boost(0);
+ }
}
static void power_hint(struct power_module *module, power_hint_t hint,