summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhao Wei Liew <zhaoweiliew@gmail.com>2016-06-26 21:29:34 +0800
committerMichael Bestas <mkbestas@lineageos.org>2019-10-23 01:12:56 +0300
commit85e00bf2ce6aa080a42ad6f8dd47733b514cceac (patch)
tree446e1b971b363adedd0ffc0e5e942a6bd07eaa0a
parent71131ea4e0f0a05a51443571970e4f74cb14de65 (diff)
downloadvendor_qcom_opensource_power-85e00bf2ce6aa080a42ad6f8dd47733b514cceac.zip
vendor_qcom_opensource_power-85e00bf2ce6aa080a42ad6f8dd47733b514cceac.tar.gz
vendor_qcom_opensource_power-85e00bf2ce6aa080a42ad6f8dd47733b514cceac.tar.bz2
power: Simplify display_hint_sent
Check for whether the display hint has been sent at the start of the set_interactive() function in the common powerHAL. This gets rid of the need to replicate the same variable in every target-specific powerHAL that implements the set_interactive_override() function. Change-Id: If7dd11fcb578211f4f83847f9257232c4138ce53
-rw-r--r--power-660.c7
-rw-r--r--power-8084.c9
-rw-r--r--power-8226.c2
-rw-r--r--power-8610.c2
-rw-r--r--power-8916.c17
-rw-r--r--power-8952.c9
-rw-r--r--power-8953.c9
-rw-r--r--power-8974.c9
-rw-r--r--power-8992.c12
-rw-r--r--power-8994.c12
-rw-r--r--power-8996.c13
-rw-r--r--power-common.c10
12 files changed, 33 insertions, 78 deletions
diff --git a/power-660.c b/power-660.c
index 56c5d7c..b2870bd 100644
--- a/power-660.c
+++ b/power-660.c
@@ -51,7 +51,6 @@
#define MIN_VAL(X, Y) ((X > Y) ? (Y) : (X))
-static int display_hint_sent;
static int video_encode_hint_sent;
static int cam_preview_hint_sent;
@@ -139,17 +138,13 @@ int set_interactive_override(int on) {
memcpy(resource_values, res, MIN_VAL(sizeof(resource_values), sizeof(res)));
num_resources = sizeof(res) / sizeof(res[0]);
}
- if (!display_hint_sent) {
- perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values, num_resources);
- display_hint_sent = 1;
- }
+ perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values, num_resources);
}
} else {
/* Display on. */
if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
- display_hint_sent = 0;
}
}
return HINT_HANDLED;
diff --git a/power-8084.c b/power-8084.c
index f82283b..e7d26e7 100644
--- a/power-8084.c
+++ b/power-8084.c
@@ -47,7 +47,6 @@
#include "power-common.h"
#include "utils.h"
-static int display_hint2_sent;
static int first_display_off_hint;
extern int display_boost;
@@ -72,18 +71,14 @@ int set_interactive_override(int on) {
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;
- }
+ undo_hint_action(DISPLAY_STATE_HINT_ID_2);
}
} else {
/* Display on */
- if (display_boost && display_hint2_sent) {
+ if (display_boost) {
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;
}
}
diff --git a/power-8226.c b/power-8226.c
index 8c3a445..310a3db 100644
--- a/power-8226.c
+++ b/power-8226.c
@@ -47,8 +47,6 @@
#include "power-common.h"
#include "utils.h"
-static int display_hint_sent;
-
int power_hint_override(power_hint_t hint, void* data) {
switch (hint) {
case POWER_HINT_INTERACTION: {
diff --git a/power-8610.c b/power-8610.c
index 8c3a445..310a3db 100644
--- a/power-8610.c
+++ b/power-8610.c
@@ -47,8 +47,6 @@
#include "power-common.h"
#include "utils.h"
-static int display_hint_sent;
-
int power_hint_override(power_hint_t hint, void* data) {
switch (hint) {
case POWER_HINT_INTERACTION: {
diff --git a/power-8916.c b/power-8916.c
index 8241aeb..39f46e3 100644
--- a/power-8916.c
+++ b/power-8916.c
@@ -57,7 +57,6 @@ char scaling_min_freq[4][80] = {"sys/devices/system/cpu/cpu0/cpufreq/scaling_min
"sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq"};
static int slack_node_rw_failed = 0;
-static int display_hint_sent;
int display_boost;
/**
@@ -121,11 +120,8 @@ int set_interactive_override(int on) {
if (is_interactive_governor(governor)) {
int resource_values[] = {TR_MS_50, THREAD_MIGRATION_SYNC_OFF};
- if (!display_hint_sent) {
- perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
- sizeof(resource_values) / sizeof(resource_values[0]));
- display_hint_sent = 1;
- }
+ perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
+ sizeof(resource_values) / sizeof(resource_values[0]));
} /* Perf time rate set for 8916 target*/
/* End of display hint for 8916 */
} else {
@@ -148,11 +144,8 @@ int set_interactive_override(int on) {
}
}
- if (!display_hint_sent) {
- perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
- sizeof(resource_values) / sizeof(resource_values[0]));
- display_hint_sent = 1;
- }
+ perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
+ sizeof(resource_values) / sizeof(resource_values[0]));
} /* Perf time rate set for CORE0,CORE4 8939 target*/
/* End of display hint for 8939 */
}
@@ -161,7 +154,6 @@ int set_interactive_override(int on) {
if (is_target_8916()) {
if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
- display_hint_sent = 0;
}
} else {
if (is_interactive_governor(governor)) {
@@ -180,7 +172,6 @@ int set_interactive_override(int on) {
}
}
undo_hint_action(DISPLAY_STATE_HINT_ID);
- display_hint_sent = 0;
}
} /* End of check condition during the DISPLAY ON case */
}
diff --git a/power-8952.c b/power-8952.c
index f598fae..2fb3b19 100644
--- a/power-8952.c
+++ b/power-8952.c
@@ -51,7 +51,6 @@
#define MIN_VAL(X, Y) ((X > Y) ? (Y) : (X))
-static int display_hint_sent;
static int video_encode_hint_sent;
static int camera_hint_ref_count;
static void process_video_encode_hint(void* metadata);
@@ -118,18 +117,14 @@ int set_interactive_override(int on) {
INT_OP_CLUSTER1_TIMER_RATE, BIG_LITTLE_TR_MS_50,
INT_OP_NOTIFY_ON_MIGRATE, 0x00};
- if (!display_hint_sent) {
- perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
- sizeof(resource_values) / sizeof(resource_values[0]));
- display_hint_sent = 1;
- }
+ perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
+ sizeof(resource_values) / sizeof(resource_values[0]));
} /* Perf time rate set for CORE0,CORE4 8952 target*/
} else {
/* Display on. */
if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
- display_hint_sent = 0;
}
}
diff --git a/power-8953.c b/power-8953.c
index 1cdd01d..cd372d7 100644
--- a/power-8953.c
+++ b/power-8953.c
@@ -51,7 +51,6 @@
#define MIN_VAL(X, Y) ((X > Y) ? (Y) : (X))
-static int display_hint_sent;
static int video_encode_hint_sent;
static int cam_preview_hint_sent;
@@ -123,18 +122,14 @@ int set_interactive_override(int on) {
0x41424000,
0x28,
};
- if (!display_hint_sent) {
- perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
- sizeof(resource_values) / sizeof(resource_values[0]));
- display_hint_sent = 1;
- }
+ perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
+ sizeof(resource_values) / sizeof(resource_values[0]));
} /* Perf time rate set for CORE0,CORE4 8952 target*/
} else {
/* Display on. */
if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
- display_hint_sent = 0;
}
}
diff --git a/power-8974.c b/power-8974.c
index 6186818..effc422 100644
--- a/power-8974.c
+++ b/power-8974.c
@@ -47,7 +47,6 @@
#include "power-common.h"
#include "utils.h"
-static int display_hint2_sent;
static int first_display_off_hint;
extern int display_boost;
@@ -72,18 +71,14 @@ int set_interactive_override(int on) {
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;
- }
+ undo_hint_action(DISPLAY_STATE_HINT_ID_2);
}
} else {
/* Display on */
- if (display_boost && display_hint2_sent) {
+ if (display_boost) {
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;
}
}
diff --git a/power-8992.c b/power-8992.c
index 49e73c6..f41d537 100644
--- a/power-8992.c
+++ b/power-8992.c
@@ -47,8 +47,6 @@
#include "power-common.h"
#include "utils.h"
-static int display_hint_sent;
-
static int process_video_encode_hint(void* metadata) {
char governor[80];
struct video_encode_metadata_t video_encode_metadata;
@@ -121,18 +119,14 @@ int set_interactive_override(int on) {
/* Display off */
if (is_interactive_governor(governor)) {
int resource_values[] = {0x777}; /* 4+0 core config in display off */
- if (!display_hint_sent) {
- perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
- sizeof(resource_values) / sizeof(resource_values[0]));
- display_hint_sent = 1;
- return HINT_HANDLED;
- }
+ perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
+ sizeof(resource_values) / sizeof(resource_values[0]));
+ return HINT_HANDLED;
}
} else {
/* Display on */
if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
- display_hint_sent = 0;
return HINT_HANDLED;
}
}
diff --git a/power-8994.c b/power-8994.c
index 7a04722..89dd11c 100644
--- a/power-8994.c
+++ b/power-8994.c
@@ -47,8 +47,6 @@
#include "power-common.h"
#include "utils.h"
-static int display_hint_sent;
-
static int process_video_encode_hint(void* metadata) {
char governor[80];
struct video_encode_metadata_t video_encode_metadata;
@@ -121,18 +119,14 @@ int set_interactive_override(int on) {
/* Display off */
if (is_interactive_governor(governor)) {
int resource_values[] = {0x777}; /* 4+0 core config in display off */
- if (!display_hint_sent) {
- perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
- sizeof(resource_values) / sizeof(resource_values[0]));
- display_hint_sent = 1;
- return HINT_HANDLED;
- }
+ perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
+ sizeof(resource_values) / sizeof(resource_values[0]));
+ return HINT_HANDLED;
}
} else {
/* Display on */
if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
- display_hint_sent = 0;
return HINT_HANDLED;
}
}
diff --git a/power-8996.c b/power-8996.c
index 2cd8339..f5b20d0 100644
--- a/power-8996.c
+++ b/power-8996.c
@@ -47,7 +47,6 @@
#include "power-common.h"
#include "utils.h"
-static int display_hint_sent;
static int camera_hint_ref_count;
static int process_video_encode_hint(void* metadata) {
@@ -146,19 +145,15 @@ int set_interactive_override(int on) {
/* Display off */
if (is_interactive_governor(governor)) {
int resource_values[] = {}; /* dummy node */
- if (!display_hint_sent) {
- perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
- sizeof(resource_values) / sizeof(resource_values[0]));
- display_hint_sent = 1;
- ALOGI("Display Off hint start");
- return HINT_HANDLED;
- }
+ perform_hint_action(DISPLAY_STATE_HINT_ID, resource_values,
+ sizeof(resource_values) / sizeof(resource_values[0]));
+ ALOGI("Display Off hint start");
+ return HINT_HANDLED;
}
} else {
/* Display on */
if (is_interactive_governor(governor)) {
undo_hint_action(DISPLAY_STATE_HINT_ID);
- display_hint_sent = 0;
ALOGI("Display Off hint stop");
return HINT_HANDLED;
}
diff --git a/power-common.c b/power-common.c
index 2e5b8c8..c820972 100644
--- a/power-common.c
+++ b/power-common.c
@@ -113,6 +113,8 @@ extern void power_set_interactive_ext(int on);
#endif
void set_interactive(int on) {
+ static int display_hint_sent;
+
if (!on) {
/* Send Display OFF hint to perf HAL */
perf_hint_enable(VENDOR_HINT_DISPLAY_OFF, 0);
@@ -121,6 +123,14 @@ void set_interactive(int on) {
perf_hint_enable(VENDOR_HINT_DISPLAY_ON, 0);
}
+ /**
+ * Ignore consecutive display-off hints
+ * Consecutive display-on hints are already handled
+ */
+ if (display_hint_sent && !on) return;
+
+ display_hint_sent = !on;
+
#ifdef SET_INTERACTIVE_EXT
power_set_interactive_ext(on);
#endif