From: Yunhee Seo Date: Mon, 26 Jun 2023 07:29:40 +0000 (+0900) Subject: display: Relocate default_proc_change_state()/default_proc_change_state_action() X-Git-Tag: accepted/tizen/unified/dev/20230726.115933~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b8adf024aee60518f5e0dd1455f85abd2961965e;p=platform%2Fcore%2Fsystem%2Fdeviced.git display: Relocate default_proc_change_state()/default_proc_change_state_action() Above two functions are used for display-lock related functions. default_proc_change_state_action() sets pm_cur_state and occurs state_action. default_proc_change_state() occurs next state action when the specific condition is met. These functions are added to display-plugin. - bool display_plugin_state_is_there_proc_change_state(void); - int display_plugin_state_proc_change_state(unsigned int cond, pid_t pid); These functions are added to display-state-transition. - void display_state_transition_do_proc_change_state_action(enum state_t next, int timeout); - int display_state_transition_do_proc_change_state(unsigned int cond, pid_t pid); Newly added functions should also be refactored. Change-Id: I85476642bb4b4c4fc5c607ce6ce0591736d1a014 Signed-off-by: Yunhee Seo --- diff --git a/plugins/iot-headed/display/core.c b/plugins/iot-headed/display/core.c index 5828ccd..c407545 100644 --- a/plugins/iot-headed/display/core.c +++ b/plugins/iot-headed/display/core.c @@ -78,17 +78,12 @@ * @{ */ -#define LOCK_SCREEN_CONTROL_TIMEOUT 5000 - extern void init_save_userlock(void); static struct display_plugin *disp_plgn; static struct display_backlight_ops *backlight_ops; static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT; -static int default_proc_change_state(unsigned int cond, pid_t pid); -static int (*proc_change_state)(unsigned int cond, pid_t pid) = default_proc_change_state; - static struct state states[S_END] = { { S_START, "S_START", NULL, NULL, NULL, NULL }, { S_NORMAL, "S_NORMAL", NULL, NULL, NULL, NULL }, @@ -99,8 +94,6 @@ static struct state states[S_END] = { { S_POWEROFF, "S_POWEROFF", NULL, NULL, NULL, NULL }, }; -#define TIMEOUT_NONE (-1) - #define DELAYED_INIT_WATING_TIME 60000 /* 1 minute */ #define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */ @@ -169,69 +162,6 @@ static const char* __device_flags_to_string(enum device_flags flags) return UNKNOWN_STR; } -static void default_proc_change_state_action(enum state_t next, int timeout) -{ - struct state *st; - - set_pm_old_state(get_pm_cur_state()); - set_pm_cur_state(next); - - st = &states[get_pm_cur_state()]; - - if (timeout < 0) - display_state_transition_do_state_action(st->timeout); - else - display_state_transition_do_state_action(timeout); - -} - -static int default_proc_change_state(unsigned int cond, pid_t pid) -{ - enum state_t next; - - next = GET_COND_STATE(cond); - _I("Change process(%d) state to %s.", pid, states[next].name); - - switch (next) { - case S_NORMAL: - if (display_panel_get_dpms_cached_state() != DPMS_ON) - display_panel_lcd_on_direct(LCD_ON_BY_EVENT); - display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_CONTROL_TIMEOUT); - default_proc_change_state_action(next, -1); - break; - case S_LCDDIM: - default_proc_change_state_action(next, -1); - break; - case S_LCDOFF: - if (display_panel_get_dpms_cached_state() == DPMS_ON) - display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT); - if (set_custom_lcdon_timeout(0)) - display_state_transition_update_display_state_timeout_by_priority(); - default_proc_change_state_action(next, -1); - break; - case S_SLEEP: - _I("Dangerous requests."); - /* at first LCD_OFF and then goto sleep */ - /* state transition */ - default_proc_change_state_action(S_LCDOFF, TIMEOUT_NONE); - display_lock_release_lock_all(S_NORMAL); - display_lock_release_lock_all(S_LCDDIM); - display_lock_release_lock_all(S_LCDOFF); - if (display_panel_is_lcd_on_state_broadcasted()) { - _I("broadcast lcd off signal at non-lcd device"); - broadcast_lcd_off(SIGNAL_PRE, 0); - broadcast_lcd_off(SIGNAL_POST, 0); - } - default_proc_change_state_action(S_SLEEP, TIMEOUT_NONE); - break; - - default: - return -EINVAL; - } - - return 0; -} - static void proc_condition_lock(PMMsg *data) { char pname[PATH_MAX]; @@ -251,7 +181,7 @@ static void proc_condition_lock(PMMsg *data) if ((state == S_LCDOFF) && (get_pm_cur_state() == S_SLEEP) && (pm_get_power_lock() == POWER_UNLOCK)) - proc_change_state(data->cond, INTERNAL_LOCK_PM); + display_state_transition_do_proc_change_state(data->cond, INTERNAL_LOCK_PM); ret = display_lock_request_lock(state, pid, data->timeout); if (ret == -EALREADY) @@ -412,7 +342,7 @@ int poll_callback(int condition, PMMsg *data) proc_condition(data); if (IS_COND_REQUEST_CHANGE(data->cond)) - proc_change_state(data->cond, data->pid); + display_state_transition_do_proc_change_state(data->cond, data->pid); } return 0; @@ -559,6 +489,7 @@ static int display_probe(void *data) dp->display_off_by_reason = NULL; dp->default_saving_mode = NULL; dp->is_lcdon_blocked = is_lcdon_blocked; + dp->proc_change_state = NULL; setup_display_plugin_backlight_ops(dp); /* check display feature */ diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c index 71fb929..ea1349b 100644 --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -79,8 +79,6 @@ * @{ */ -#define LOCK_SCREEN_CONTROL_TIMEOUT 5000 - extern void init_save_userlock(void); static struct display_plugin *disp_plgn; @@ -88,9 +86,6 @@ static struct display_backlight_ops *backlight_ops; static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT; -static int default_proc_change_state(unsigned int cond, pid_t pid); -static int (*proc_change_state)(unsigned int cond, pid_t pid) = default_proc_change_state; - static struct state states[S_END] = { { S_START, "S_START", NULL, NULL, NULL, NULL }, { S_NORMAL, "S_NORMAL", NULL, NULL, NULL, NULL }, @@ -101,8 +96,6 @@ static struct state states[S_END] = { { S_POWEROFF, "S_POWEROFF", NULL, NULL, NULL, NULL }, }; -#define TIMEOUT_NONE (-1) - #define DELAYED_INIT_WATING_TIME 60000 /* 1 minute */ #define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */ @@ -176,21 +169,6 @@ static const char* __device_flags_to_string(enum device_flags flags) return UNKNOWN_STR; } -static void default_proc_change_state_action(enum state_t next, int timeout) -{ - struct state *st; - - set_pm_old_state(get_pm_cur_state()); - set_pm_cur_state(next); - - st = &states[get_pm_cur_state()]; - - if (timeout < 0) - display_state_transition_do_state_action(st->timeout); - else - display_state_transition_do_state_action(timeout); -} - static int default_proc_change_state(unsigned int cond, pid_t pid) { enum state_t next; @@ -203,10 +181,10 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) if (display_panel_get_dpms_cached_state() != DPMS_ON) display_panel_lcd_on_direct(LCD_ON_BY_EVENT); display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_CONTROL_TIMEOUT); - default_proc_change_state_action(next, -1); + display_state_transition_do_proc_change_state_action(next, -1); break; case S_LCDDIM: - default_proc_change_state_action(next, -1); + display_state_transition_do_proc_change_state_action(next, -1); break; case S_LCDOFF: if (display_panel_get_dpms_cached_state() == DPMS_ON) { @@ -217,13 +195,13 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) } if (set_custom_lcdon_timeout(0)) display_state_transition_update_display_state_timeout_by_priority(); - default_proc_change_state_action(next, -1); + display_state_transition_do_proc_change_state_action(next, -1); break; case S_SLEEP: _I("Dangerous requests."); /* at first LCD_OFF and then goto sleep */ /* state transition */ - default_proc_change_state_action(S_LCDOFF, TIMEOUT_NONE); + display_state_transition_do_proc_change_state_action(S_LCDOFF, TIMEOUT_NONE); display_lock_release_lock_all(S_NORMAL); display_lock_release_lock_all(S_LCDDIM); display_lock_release_lock_all(S_LCDOFF); @@ -232,7 +210,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) broadcast_lcd_off(SIGNAL_PRE, 0); broadcast_lcd_off(SIGNAL_POST, 0); } - default_proc_change_state_action(S_SLEEP, TIMEOUT_NONE); + display_state_transition_do_proc_change_state_action(S_SLEEP, TIMEOUT_NONE); break; default: @@ -261,7 +239,7 @@ static void proc_condition_lock(PMMsg *data) if ((state == S_LCDOFF) && (get_pm_cur_state() == S_SLEEP) && (pm_get_power_lock() == POWER_UNLOCK)) - proc_change_state(data->cond, INTERNAL_LOCK_PM); + display_state_transition_do_proc_change_state(data->cond, INTERNAL_LOCK_PM); ret = display_lock_request_lock(state, pid, data->timeout); if (ret == -EALREADY) @@ -421,7 +399,7 @@ int poll_callback(int condition, PMMsg *data) proc_condition(data); if (IS_COND_REQUEST_CHANGE(data->cond)) - proc_change_state(data->cond, data->pid); + display_state_transition_do_proc_change_state(data->cond, data->pid); } return 0; @@ -570,6 +548,7 @@ static int display_probe(void *data) dp->display_off_by_reason = NULL; dp->default_saving_mode = NULL; dp->is_lcdon_blocked = is_lcdon_blocked; + dp->proc_change_state = default_proc_change_state; setup_display_plugin_backlight_ops(dp); /** diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c index 223c38e..6609df9 100644 --- a/plugins/tv/display/core.c +++ b/plugins/tv/display/core.c @@ -77,8 +77,6 @@ * @{ */ -#define LOCK_SCREEN_CONTROL_TIMEOUT 5000 - extern void init_save_userlock(void); static struct display_plugin *disp_plgn; @@ -86,9 +84,6 @@ static struct display_backlight_ops *backlight_ops; static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT; -static int default_proc_change_state(unsigned int cond, pid_t pid); -static int (*proc_change_state)(unsigned int cond, pid_t pid) = default_proc_change_state; - static struct state states[S_END] = { { S_START, "S_START", NULL, NULL, NULL, NULL }, { S_NORMAL, "S_NORMAL", NULL, NULL, NULL, NULL }, @@ -99,8 +94,6 @@ static struct state states[S_END] = { { S_POWEROFF, "S_POWEROFF", NULL, NULL, NULL, NULL }, }; -#define TIMEOUT_NONE (-1) - #define DELAYED_INIT_WATING_TIME 60000 /* 1 minute */ #define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */ @@ -169,68 +162,6 @@ static const char* __device_flags_to_string(enum device_flags flags) return UNKNOWN_STR; } -static void default_proc_change_state_action(enum state_t next, int timeout) -{ - struct state *st; - - set_pm_old_state(get_pm_cur_state()); - set_pm_cur_state(next); - - st = &states[get_pm_cur_state()]; - - if (timeout < 0) - display_state_transition_do_state_action(st->timeout); - else - display_state_transition_do_state_action(timeout); -} - -static int default_proc_change_state(unsigned int cond, pid_t pid) -{ - enum state_t next; - - next = GET_COND_STATE(cond); - _I("Change process(%d) state to %s.", pid, states[next].name); - - switch (next) { - case S_NORMAL: - if (display_panel_get_dpms_cached_state() != DPMS_ON) - display_panel_lcd_on_direct(LCD_ON_BY_EVENT); - display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_CONTROL_TIMEOUT); - default_proc_change_state_action(next, -1); - break; - case S_LCDDIM: - default_proc_change_state_action(next, -1); - break; - case S_LCDOFF: - if (display_panel_get_dpms_cached_state() == DPMS_ON) - display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT); - if (set_custom_lcdon_timeout(0)) - display_state_transition_update_display_state_timeout_by_priority(); - default_proc_change_state_action(next, -1); - break; - case S_SLEEP: - _I("Dangerous requests."); - /* at first LCD_OFF and then goto sleep */ - /* state transition */ - default_proc_change_state_action(S_LCDOFF, TIMEOUT_NONE); - display_lock_release_lock_all(S_NORMAL); - display_lock_release_lock_all(S_LCDDIM); - display_lock_release_lock_all(S_LCDOFF); - if (display_panel_is_lcd_on_state_broadcasted()) { - _I("broadcast lcd off signal at non-lcd device"); - broadcast_lcd_off(SIGNAL_PRE, 0); - broadcast_lcd_off(SIGNAL_POST, 0); - } - default_proc_change_state_action(S_SLEEP, TIMEOUT_NONE); - break; - - default: - return -EINVAL; - } - - return 0; -} - static void proc_condition_lock(PMMsg *data) { char pname[PATH_MAX]; @@ -250,7 +181,7 @@ static void proc_condition_lock(PMMsg *data) if ((state == S_LCDOFF) && (get_pm_cur_state() == S_SLEEP) && (pm_get_power_lock() == POWER_UNLOCK)) - proc_change_state(data->cond, INTERNAL_LOCK_PM); + display_state_transition_do_proc_change_state(data->cond, INTERNAL_LOCK_PM); ret = display_lock_request_lock(state, pid, data->timeout); if (ret == -EALREADY) @@ -411,7 +342,7 @@ int poll_callback(int condition, PMMsg *data) proc_condition(data); if (IS_COND_REQUEST_CHANGE(data->cond)) - proc_change_state(data->cond, data->pid); + display_state_transition_do_proc_change_state(data->cond, data->pid); } return 0; @@ -559,6 +490,7 @@ static int display_probe(void *data) dp->display_off_by_reason = NULL; dp->default_saving_mode = NULL; dp->is_lcdon_blocked = is_lcdon_blocked; + dp->proc_change_state = NULL; setup_display_plugin_backlight_ops(dp); /** diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c index e5e7d73..2f4d3f0 100644 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -85,7 +85,6 @@ * @{ */ -#define LOCK_SCREEN_CONTROL_TIMEOUT 5000 #define LATE_LCD_TRANSIT 1 extern void init_save_userlock(void); @@ -106,9 +105,6 @@ static bool lcdon_broadcast = true; static int default_trans(int evt); static int default_action(int timeout); -static int default_proc_change_state(unsigned int cond, pid_t pid); -static int (*proc_change_state)(unsigned int cond, pid_t pid) = default_proc_change_state; - static struct state states[S_END] = { { S_START, "S_START", NULL, NULL, NULL, NULL }, { S_NORMAL, "S_NORMAL", default_trans, default_action, NULL, NULL }, @@ -119,8 +115,6 @@ static struct state states[S_END] = { { S_POWEROFF, "S_POWEROFF", NULL, NULL, NULL, NULL }, }; -#define TIMEOUT_NONE (-1) - #define DELAYED_INIT_WATING_TIME 60000 /* 1 minute */ #define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */ @@ -587,23 +581,6 @@ int display_off_by_reason(const char *reason) return 0; } -static void default_proc_change_state_action(enum state_t next, int timeout) -{ - struct state *st; - - set_pm_old_state(get_pm_cur_state()); - set_pm_cur_state(next); - - st = &states[get_pm_cur_state()]; - - if (st && st->action) { - if (timeout < 0) - st->action(st->timeout); - else - st->action(timeout); - } -} - static int default_proc_change_state(unsigned int cond, pid_t pid) { enum state_t next; @@ -616,23 +593,23 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) if (check_lcd_is_on() == false) display_panel_lcd_on_direct(LCD_ON_BY_EVENT); display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_CONTROL_TIMEOUT); - default_proc_change_state_action(next, -1); + display_state_transition_do_proc_change_state_action(next, -1); break; case S_LCDDIM: - default_proc_change_state_action(next, -1); + display_state_transition_do_proc_change_state_action(next, -1); break; case S_LCDOFF: if (display_panel_get_dpms_cached_state() == DPMS_ON) lcd_off_procedure(LCD_OFF_BY_EVENT); if (set_custom_lcdon_timeout(0)) display_state_transition_update_display_state_timeout_by_priority(); - default_proc_change_state_action(next, -1); + display_state_transition_do_proc_change_state_action(next, -1); break; case S_SLEEP: _I("Dangerous requests."); /* at first LCD_OFF and then goto sleep */ /* state transition */ - default_proc_change_state_action(S_LCDOFF, TIMEOUT_NONE); + display_state_transition_do_proc_change_state_action(S_LCDOFF, TIMEOUT_NONE); display_lock_release_lock_all(S_NORMAL); display_lock_release_lock_all(S_LCDDIM); display_lock_release_lock_all(S_LCDOFF); @@ -641,7 +618,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid) broadcast_lcd_off(SIGNAL_PRE, 0); broadcast_lcd_off(SIGNAL_POST, 0); } - default_proc_change_state_action(S_SLEEP, TIMEOUT_NONE); + display_state_transition_do_proc_change_state_action(S_SLEEP, TIMEOUT_NONE); break; default: @@ -670,7 +647,7 @@ static void proc_condition_lock(PMMsg *data) if ((state == S_LCDOFF) && (get_pm_cur_state() == S_SLEEP) && (pm_get_power_lock() == POWER_UNLOCK)) - proc_change_state(data->cond, INTERNAL_LOCK_PM); + display_state_transition_do_proc_change_state(data->cond, INTERNAL_LOCK_PM); ret = display_lock_request_lock(state, pid, data->timeout); if (ret == -EALREADY) @@ -1044,7 +1021,7 @@ int poll_callback(int condition, PMMsg *data) proc_condition(data); if (IS_COND_REQUEST_CHANGE(data->cond)) - proc_change_state(data->cond, data->pid); + display_state_transition_do_proc_change_state(data->cond, data->pid); } return 0; @@ -1282,6 +1259,7 @@ static int display_probe(void *data) dp->display_off_by_reason = display_off_by_reason; dp->default_saving_mode = default_saving_mode; dp->is_lcdon_blocked = is_lcdon_blocked; + dp->proc_change_state = default_proc_change_state; setup_display_plugin_backlight_ops(dp); /** diff --git a/src/display/ambient-mode.c b/src/display/ambient-mode.c index 16573e2..79b000a 100644 --- a/src/display/ambient-mode.c +++ b/src/display/ambient-mode.c @@ -44,7 +44,6 @@ #define CLOCK_START "clockstart" #define CLOCK_END "clockend" #define CLOCK_CHANGED "clockchanged" -#define TIMEOUT_NONE (-1) #define AMBIENT_CLOCK_WAITING_TIME 5000 /* ms */ static struct display_plugin *disp_plgn; diff --git a/src/display/core.h b/src/display/core.h index 4b8d73a..79679ad 100644 --- a/src/display/core.h +++ b/src/display/core.h @@ -36,6 +36,8 @@ #define MASK_OFF 0x4 /* 100 */ #define DEFAULT_NORMAL_TIMEOUT 30 +#define LOCK_SCREEN_CONTROL_TIMEOUT 5000 +#define TIMEOUT_NONE (-1) #define DIM_MASK 0x000f0000 #define MASK32 0xffffffff diff --git a/src/display/display-plugin.c b/src/display/display-plugin.c index e5df386..cd74cee 100644 --- a/src/display/display-plugin.c +++ b/src/display/display-plugin.c @@ -297,6 +297,19 @@ int display_plugin_state_get_state_by_state_index(int state_index, enum state_t return -EOPNOTSUPP; } +bool display_plugin_state_is_there_proc_change_state(void) +{ + return (g_display_plugin.proc_change_state != NULL); +} + +int display_plugin_state_proc_change_state(unsigned int cond, pid_t pid) +{ + if (!g_display_plugin.proc_change_state) + return -EOPNOTSUPP; + + return g_display_plugin.proc_change_state(cond, pid); +} + int display_plugin_config_get_timeout_enable(bool *timeout_enable) { if (!timeout_enable) diff --git a/src/display/display-plugin.h b/src/display/display-plugin.h index b2f3478..c61a156 100644 --- a/src/display/display-plugin.h +++ b/src/display/display-plugin.h @@ -75,6 +75,7 @@ struct display_plugin { int (*display_off_by_reason) (const char *reason); void (*default_saving_mode) (int onoff); int (*is_lcdon_blocked) (void); + int (*proc_change_state) (unsigned int cond, pid_t pid); struct display_config *config; struct display_backlight_ops *backlight; @@ -117,6 +118,9 @@ int display_plugin_state_get_name(enum state_t state, const char **state_name); int display_plugin_state_set_timeout(enum state_t state, int state_timeout); int display_plugin_state_get_timeout(enum state_t state, int *state_timeout); int display_plugin_state_get_state_by_state_index(int state_index, enum state_t *state); +/* FIXME: This function used in the display lock related functions */ +bool display_plugin_state_is_there_proc_change_state(void); +int display_plugin_state_proc_change_state(unsigned int cond, pid_t pid); /* FIXME: display config getter/setter is also temporary in this file */ int display_plugin_config_get_timeout_enable(bool *timeout_enable); diff --git a/src/display/display-state-transition.c b/src/display/display-state-transition.c index d633e78..4523f95 100644 --- a/src/display/display-state-transition.c +++ b/src/display/display-state-transition.c @@ -27,6 +27,7 @@ #include "display-state-transition.h" #include "display-lock.h" #include "display-plugin.h" +#include "display-signal.h" #include "extcon/extcon.h" #include "power/power.h" #include "power/power-suspend.h" @@ -526,3 +527,74 @@ go_lcd_off: } return 0; } + +/* FIXME: this function is temporary, it will be refactored */ +void display_state_transition_do_proc_change_state_action(enum state_t next, int timeout) +{ + int state_timeout = 0; + + set_pm_old_state(get_pm_cur_state()); + set_pm_cur_state(next); + + display_plugin_state_get_timeout(get_pm_cur_state(), &state_timeout); + + if (timeout < 0) + display_state_transition_do_state_action(state_timeout); + else + display_state_transition_do_state_action(timeout); + +} + +/* FIXME: this function is temporary, it will be refactored */ +int display_state_transition_do_proc_change_state(unsigned int cond, pid_t pid) +{ + enum state_t next; + const char *state_name = NULL; + + if (display_plugin_state_is_there_proc_change_state()) + return display_plugin_state_proc_change_state(cond, pid); + + next = GET_COND_STATE(cond); + display_plugin_state_get_name(next, &state_name); + _I("Change process(%d) state to %s.", pid, state_name); + + switch (next) { + case S_NORMAL: + if (display_panel_get_dpms_cached_state() != DPMS_ON) + display_panel_lcd_on_direct(LCD_ON_BY_EVENT); + display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_CONTROL_TIMEOUT); + display_state_transition_do_proc_change_state_action(next, TIMEOUT_NONE); + break; + case S_LCDDIM: + display_state_transition_do_proc_change_state_action(next, TIMEOUT_NONE); + break; + case S_LCDOFF: + if (display_panel_get_dpms_cached_state() == DPMS_ON) + display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT); + if (set_custom_lcdon_timeout(0)) + display_state_transition_update_display_state_timeout_by_priority(); + display_state_transition_do_proc_change_state_action(next, TIMEOUT_NONE); + break; + case S_SLEEP: + _I("Dangerous requests."); + /* at first LCD_OFF and then goto sleep */ + /* state transition */ + display_state_transition_do_proc_change_state_action(S_LCDOFF, TIMEOUT_NONE); + display_lock_release_lock_all(S_NORMAL); + display_lock_release_lock_all(S_LCDDIM); + display_lock_release_lock_all(S_LCDOFF); + if (display_panel_is_lcd_on_state_broadcasted()) { + _I("broadcast lcd off signal at non-lcd device"); + broadcast_lcd_off(SIGNAL_PRE, 0); + broadcast_lcd_off(SIGNAL_POST, 0); + } + display_state_transition_do_proc_change_state_action(S_SLEEP, TIMEOUT_NONE); + break; + + default: + return -EINVAL; + } + + return 0; +} + diff --git a/src/display/display-state-transition.h b/src/display/display-state-transition.h index ee1955a..d51199f 100644 --- a/src/display/display-state-transition.h +++ b/src/display/display-state-transition.h @@ -44,5 +44,7 @@ bool display_state_transition_is_possible_to_go_lcdoff(void); int display_state_transition_do_state_transition(enum state_t state, int evt_type); bool display_state_transition_is_display_state_support_transition(enum state_t state); int display_state_transition_do_state_action(int timeout); +void display_state_transition_do_proc_change_state_action(enum state_t next, int timeout); +int display_state_transition_do_proc_change_state(unsigned int cond, pid_t pid); #endif /* __DISPLAY_STATE_TRANSITION_H__ */ \ No newline at end of file