summaryrefslogtreecommitdiffstats
path: root/power-common.c
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 /power-common.c
parent71131ea4e0f0a05a51443571970e4f74cb14de65 (diff)
downloadvendor_qcom_opensource_power-85e00bf2ce6aa080a42ad6f8dd47733b514cceac.tar.gz
vendor_qcom_opensource_power-85e00bf2ce6aa080a42ad6f8dd47733b514cceac.tar.bz2
vendor_qcom_opensource_power-85e00bf2ce6aa080a42ad6f8dd47733b514cceac.zip
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
Diffstat (limited to 'power-common.c')
-rw-r--r--power-common.c10
1 files changed, 10 insertions, 0 deletions
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