Merge "Revert "Revert "power: keep two cores online when display is on"""

This commit is contained in:
Linux Build Service Account 2013-12-07 11:10:22 -08:00 committed by Gerrit - the friendly Code Review server
commit 38f68f1b81
4 changed files with 58 additions and 1 deletions

View File

@ -31,6 +31,7 @@
#define DEFAULT_VIDEO_ENCODE_HINT_ID (0x0A00) #define DEFAULT_VIDEO_ENCODE_HINT_ID (0x0A00)
#define DEFAULT_VIDEO_DECODE_HINT_ID (0x0B00) #define DEFAULT_VIDEO_DECODE_HINT_ID (0x0B00)
#define DISPLAY_STATE_HINT_ID (0x0C00) #define DISPLAY_STATE_HINT_ID (0x0C00)
#define DISPLAY_STATE_HINT_ID_2 (0x0D00)
struct hint_data { struct hint_data {
unsigned long hint_id; /* This is our key. */ unsigned long hint_id; /* This is our key. */

View File

@ -48,6 +48,9 @@
#include "power-common.h" #include "power-common.h"
static int display_hint_sent; 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) 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) { if (!on) {
/* Display off. */ /* 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) && if ((strncmp(governor, ONDEMAND_GOVERNOR, strlen(ONDEMAND_GOVERNOR)) == 0) &&
(strlen(governor) == strlen(ONDEMAND_GOVERNOR))) { (strlen(governor) == strlen(ONDEMAND_GOVERNOR))) {
int resource_values[] = {MS_500, SYNC_FREQ_600, OPTIMAL_FREQ_600, THREAD_MIGRATION_SYNC_OFF}; 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 { } else {
/* Display on */ /* 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) && if ((strncmp(governor, ONDEMAND_GOVERNOR, strlen(ONDEMAND_GOVERNOR)) == 0) &&
(strlen(governor) == strlen(ONDEMAND_GOVERNOR))) { (strlen(governor) == strlen(ONDEMAND_GOVERNOR))) {
undo_hint_action(DISPLAY_STATE_HINT_ID); undo_hint_action(DISPLAY_STATE_HINT_ID);

View File

@ -55,6 +55,7 @@ static int saved_mpdecision_slack_min = -1;
static int saved_interactive_mode = -1; static int saved_interactive_mode = -1;
static int slack_node_rw_failed = 0; static int slack_node_rw_failed = 0;
static int display_hint_sent; static int display_hint_sent;
int display_boost;
static struct hw_module_methods_t power_module_methods = { static struct hw_module_methods_t power_module_methods = {
.open = NULL, .open = NULL,
@ -63,6 +64,22 @@ static struct hw_module_methods_t power_module_methods = {
static void power_init(struct power_module *module) static void power_init(struct power_module *module)
{ {
ALOGI("QCOM power HAL initing."); 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) 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) && } else if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
(strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) { (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) { if (!display_hint_sent) {
perform_hint_action(DISPLAY_STATE_HINT_ID, perform_hint_action(DISPLAY_STATE_HINT_ID,

View File

@ -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);
}
}
}