From fe60d0ef7042f6845103c42ce1a305745467046f Mon Sep 17 00:00:00 2001 From: Zhoulu Luo Date: Fri, 6 Dec 2013 16:32:10 -0800 Subject: [PATCH] Revert "Revert "power: keep two cores online when display is on"" This reverts commit 1b147f354e0da3ca98b909357191a4c90b6665b9. --- power/hint-data.h | 1 + power/power-8974.c | 26 ++++++++++++++++++++++++++ power/power.c | 19 ++++++++++++++++++- power/utils.c | 13 +++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/power/hint-data.h b/power/hint-data.h index e205c9e8..2a8113a2 100644 --- a/power/hint-data.h +++ b/power/hint-data.h @@ -31,6 +31,7 @@ #define DEFAULT_VIDEO_ENCODE_HINT_ID (0x0A00) #define DEFAULT_VIDEO_DECODE_HINT_ID (0x0B00) #define DISPLAY_STATE_HINT_ID (0x0C00) +#define DISPLAY_STATE_HINT_ID_2 (0x0D00) struct hint_data { unsigned long hint_id; /* This is our key. */ diff --git a/power/power-8974.c b/power/power-8974.c index 91a40451..7aa15294 100644 --- a/power/power-8974.c +++ b/power/power-8974.c @@ -48,6 +48,9 @@ #include "power-common.h" static int display_hint_sent; +static int display_hint2_sent; +static int first_display_off_hint; +extern int display_boost; int set_interactive_override(struct power_module *module, int on) { @@ -61,6 +64,22 @@ int set_interactive_override(struct power_module *module, int on) if (!on) { /* Display off. */ + /* + * We need to be able to identify the first display off hint + * and release the current lock holder + */ + if (display_boost) { + if (!first_display_off_hint) { + undo_initial_hint_action(); + first_display_off_hint = 1; + } + /* used for all subsequent toggles to the display */ + if (!display_hint2_sent) { + undo_hint_action(DISPLAY_STATE_HINT_ID_2); + display_hint2_sent = 1; + } + } + if ((strncmp(governor, ONDEMAND_GOVERNOR, strlen(ONDEMAND_GOVERNOR)) == 0) && (strlen(governor) == strlen(ONDEMAND_GOVERNOR))) { int resource_values[] = {MS_500, SYNC_FREQ_600, OPTIMAL_FREQ_600, THREAD_MIGRATION_SYNC_OFF}; @@ -75,6 +94,13 @@ int set_interactive_override(struct power_module *module, int on) } } else { /* Display on */ + if (display_boost && display_hint2_sent) { + int resource_values2[] = {CPUS_ONLINE_MIN_2}; + perform_hint_action(DISPLAY_STATE_HINT_ID_2, + resource_values2, sizeof(resource_values2)/sizeof(resource_values2[0])); + display_hint2_sent = 0; + } + if ((strncmp(governor, ONDEMAND_GOVERNOR, strlen(ONDEMAND_GOVERNOR)) == 0) && (strlen(governor) == strlen(ONDEMAND_GOVERNOR))) { undo_hint_action(DISPLAY_STATE_HINT_ID); diff --git a/power/power.c b/power/power.c index 3cd44732..970a9d73 100644 --- a/power/power.c +++ b/power/power.c @@ -55,6 +55,7 @@ static int saved_mpdecision_slack_min = -1; static int saved_interactive_mode = -1; static int slack_node_rw_failed = 0; static int display_hint_sent; +int display_boost; static struct hw_module_methods_t power_module_methods = { .open = NULL, @@ -63,6 +64,22 @@ static struct hw_module_methods_t power_module_methods = { static void power_init(struct power_module *module) { ALOGI("QCOM power HAL initing."); + + int fd; + char buf[10] = {0}; + + fd = open("/sys/devices/soc0/soc_id", O_RDONLY); + if (fd >= 0) { + if (read(fd, buf, sizeof(buf) - 1) == -1) { + ALOGW("Unable to read soc_id"); + } else { + int soc_id = atoi(buf); + if (soc_id == 194 || (soc_id >= 208 && soc_id <= 218)) { + display_boost = 1; + } + } + close(fd); + } } static void process_video_decode_hint(void *metadata) @@ -242,7 +259,7 @@ void set_interactive(struct power_module *module, int on) } } else if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) && (strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) { - int resource_values[] = {DISPLAY_OFF, TR_MS_500, THREAD_MIGRATION_SYNC_OFF}; + int resource_values[] = {TR_MS_500, THREAD_MIGRATION_SYNC_OFF}; if (!display_hint_sent) { perform_hint_action(DISPLAY_STATE_HINT_ID, diff --git a/power/utils.c b/power/utils.c index 15f7aed1..5c7863e8 100644 --- a/power/utils.c +++ b/power/utils.c @@ -269,3 +269,16 @@ void undo_hint_action(int hint_id) } } } + +/* + * Used to release initial lock holding + * two cores online when the display is on + */ +void undo_initial_hint_action() +{ + if (qcopt_handle) { + if (perf_lock_rel) { + perf_lock_rel(1); + } + } +}