diff --git a/power-660.c b/power-660.c index 627d15b..028cfcf 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 void process_video_encode_hint(void* metadata); @@ -134,17 +133,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-8937.c b/power-8937.c index f02cfb2..d6d7f21 100644 --- a/power-8937.c +++ b/power-8937.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 void process_video_encode_hint(void* metadata); @@ -108,18 +107,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 f7f785a..40f4e2e 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 void process_video_encode_hint(void* metadata); @@ -110,18 +109,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-common.c b/power-common.c index 8d7df69..0a4fe04 100644 --- a/power-common.c +++ b/power-common.c @@ -128,6 +128,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); @@ -136,6 +138,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