Skip to content

Commit

Permalink
Use single state machine for both display and suspend policy
Browse files Browse the repository at this point in the history
As fb suspend and wakeup are not immediate, display state requests
must be handled separately from actual state transition processing.

A new data pipe display_state_req_pipe is used for making display
state requests and filtering them.

The state machine takes data from display_state_req_pipe and
makes changes known to existing triggers via display_state_pipe.

The suspend policy is integrated to display state handling, which
allows better control over sharing update enable/disable state
with ui side (lipstick).

[mce] Use single state machine for both display and suspend policy
  • Loading branch information
spiiroin committed Aug 26, 2013
1 parent 8aad132 commit 3a6eae2
Show file tree
Hide file tree
Showing 6 changed files with 902 additions and 288 deletions.
4 changes: 2 additions & 2 deletions mce-dsme.c
Expand Up @@ -254,7 +254,7 @@ void request_soft_poweron(void)
USE_INDATA);

mce_rem_submode_int32(MCE_SOFTOFF_SUBMODE);
execute_datapipe(&display_state_pipe,
execute_datapipe(&display_state_req_pipe,
GINT_TO_POINTER(MCE_DISPLAY_ON),
USE_INDATA, CACHE_INDATA);
}
Expand All @@ -265,7 +265,7 @@ void request_soft_poweron(void)
void request_soft_poweroff(void)
{
mce_add_submode_int32(MCE_SOFTOFF_SUBMODE);
execute_datapipe(&display_state_pipe,
execute_datapipe(&display_state_req_pipe,
GINT_TO_POINTER(MCE_DISPLAY_LPM_OFF),
USE_INDATA, CACHE_INDATA);

Expand Down
2 changes: 2 additions & 0 deletions mce.c
Expand Up @@ -907,6 +907,8 @@ int main(int argc, char **argv)
0, GINT_TO_POINTER(MCE_NORMAL_SUBMODE));
setup_datapipe(&display_state_pipe, READ_WRITE, DONT_FREE_CACHE,
0, GINT_TO_POINTER(MCE_DISPLAY_UNDEF));
setup_datapipe(&display_state_req_pipe, READ_WRITE, DONT_FREE_CACHE,
0, GINT_TO_POINTER(MCE_DISPLAY_UNDEF));
setup_datapipe(&display_brightness_pipe, READ_WRITE, DONT_FREE_CACHE,
0, GINT_TO_POINTER(0));
setup_datapipe(&led_brightness_pipe, READ_WRITE, DONT_FREE_CACHE,
Expand Down
2 changes: 2 additions & 0 deletions mce.h
Expand Up @@ -270,6 +270,8 @@ datapipe_struct led_pattern_activate_pipe;
datapipe_struct led_pattern_deactivate_pipe;
/** State of display; read only */
datapipe_struct display_state_pipe;
/** Desired state of display */
datapipe_struct display_state_req_pipe;
/**
* Display brightness;
* bits 0-7 is brightness in percent (0-100)
Expand Down
2 changes: 1 addition & 1 deletion modetransition.c
Expand Up @@ -147,7 +147,7 @@ static void system_state_trigger(gconstpointer data)
* blank the screen
*/
if (old_system_state == MCE_STATE_ACTDEAD) {
execute_datapipe(&display_state_pipe,
execute_datapipe(&display_state_req_pipe,
GINT_TO_POINTER(MCE_DISPLAY_LPM_OFF),
USE_INDATA, CACHE_INDATA);
}
Expand Down

0 comments on commit 3a6eae2

Please sign in to comment.