The role of poll_callback() is only causing transition according to the conditions.
To replace this function, poll_callback() is separated into two funcs and added.
These are added to display-state-transition.
- int display_state_transition_do_state_transition_by_input_poll_event(void);
- int display_state_transition_do_state_transition_by_pm_control_event(PMMsg *data);
-> It causes display state transition by a specific trigger condition.
To refactor these functions, this function is also added to display.
- bool display_is_display_ops_started_status(void);
-> It checks if display ops status is DEVICE_OPS_STATUS_START or not.
Change-Id: I3833e7881101bfd81c7855b14ffdf4aa74a590bf
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
pm_save_logdump();
}
-int poll_callback(int condition, PMMsg *data)
-{
- static time_t last_t;
- time_t now;
-
- display_get_display_ops_status(&status);
- if (status != DEVICE_OPS_STATUS_START) {
- _E("Display logic is not started.");
- return -ECANCELED;
- }
-
- if (condition == INPUT_POLL_EVENT) {
- if ((get_pm_cur_state() == S_LCDOFF) || (get_pm_cur_state() == S_SLEEP))
- _I("Input event signal at Display Off");
- time(&now);
- if ((last_t != now) ||
- (get_pm_cur_state() == S_LCDOFF) ||
- (get_pm_cur_state() == S_SLEEP)) {
- display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
- last_t = now;
- }
- }
-
- if (condition == PM_CONTROL_EVENT) {
- display_lock_proc_condition(data);
-
- if (IS_COND_REQUEST_CHANGE(data->cond))
- display_state_transition_do_proc_change_state(data->cond, data->pid);
- }
-
- return 0;
-}
-
static void check_seed_status(void)
{
int ret = -1;
/* change state - LCD on */
if (disp_plgn->pm_change_internal)
disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
- poll_callback(INPUT_POLL_EVENT, NULL);
+ display_state_transition_do_state_transition_by_input_poll_event();
}
if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
return;
/* lcd on or update lcd timeout */
- poll_callback(INPUT_POLL_EVENT, NULL);
+ display_state_transition_do_state_transition_by_input_poll_event();
}
static int delayed_init_done(void *data)
pm_save_logdump();
}
-int poll_callback(int condition, PMMsg *data)
-{
- static time_t last_t;
- time_t now;
-
- display_get_display_ops_status(&status);
- if (status != DEVICE_OPS_STATUS_START) {
- _E("Display logic is not started.");
- return -ECANCELED;
- }
-
- if (condition == INPUT_POLL_EVENT) {
- if ((get_pm_cur_state() == S_LCDOFF) || (get_pm_cur_state() == S_SLEEP))
- _I("Input event signal at Display Off");
- time(&now);
- if ((last_t != now) ||
- (get_pm_cur_state() == S_LCDOFF) ||
- (get_pm_cur_state() == S_SLEEP)) {
- display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
- last_t = now;
- }
- }
-
- if (condition == PM_CONTROL_EVENT) {
- display_lock_proc_condition(data);
-
- if (IS_COND_REQUEST_CHANGE(data->cond))
- display_state_transition_do_proc_change_state(data->cond, data->pid);
- }
-
- return 0;
-}
-
static void check_seed_status(void)
{
int ret = -1;
/* change state - LCD on */
if (disp_plgn->pm_change_internal)
disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
- poll_callback(INPUT_POLL_EVENT, NULL);
+ display_state_transition_do_state_transition_by_input_poll_event();
}
if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
current_state_in_on() == false) {
broadcast_lcdon_by_powerkey();
display_panel_lcd_on_direct(LCD_ON_BY_POWER_KEY);
-
- poll_callback(INPUT_POLL_EVENT, NULL);
+ display_state_transition_do_state_transition_by_input_poll_event();
}
return G_SOURCE_REMOVE;
return;
/* lcd on or update lcd timeout */
- poll_callback(INPUT_POLL_EVENT, NULL);
+ display_state_transition_do_state_transition_by_input_poll_event();
}
static int delayed_init_done(void *data)
pm_save_logdump();
}
-int poll_callback(int condition, PMMsg *data)
-{
- static time_t last_t;
- time_t now;
-
- display_get_display_ops_status(&status);
- if (status != DEVICE_OPS_STATUS_START) {
- _E("Display logic is not started.");
- return -ECANCELED;
- }
-
- if (condition == INPUT_POLL_EVENT) {
- if ((get_pm_cur_state() == S_LCDOFF) || (get_pm_cur_state() == S_SLEEP))
- _I("Input event signal at Display Off");
- time(&now);
- if ((last_t != now) ||
- (get_pm_cur_state() == S_LCDOFF) ||
- (get_pm_cur_state() == S_SLEEP)) {
- display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
- last_t = now;
- }
- }
-
- if (condition == PM_CONTROL_EVENT) {
- display_lock_proc_condition(data);
-
- if (IS_COND_REQUEST_CHANGE(data->cond))
- display_state_transition_do_proc_change_state(data->cond, data->pid);
- }
-
- return 0;
-}
-
static void check_seed_status(void)
{
int ret = -1;
/* change state - LCD on */
if (disp_plgn->pm_change_internal)
disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
- poll_callback(INPUT_POLL_EVENT, NULL);
+ display_state_transition_do_state_transition_by_input_poll_event();
}
if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
return;
/* lcd on or update lcd timeout */
- poll_callback(INPUT_POLL_EVENT, NULL);
+ display_state_transition_do_state_transition_by_input_poll_event();
}
static int delayed_init_done(void *data)
}
}
-int poll_callback(int condition, PMMsg *data)
-{
- static time_t last_t;
- time_t now;
-
- display_get_display_ops_status(&status);
- if (status != DEVICE_OPS_STATUS_START) {
- _E("Display logic is not started.");
- return -ECANCELED;
- }
-
- if (condition == INPUT_POLL_EVENT) {
- if ((get_pm_cur_state() == S_LCDOFF) || (get_pm_cur_state() == S_SLEEP))
- _I("Input event signal at Display Off");
- time(&now);
- if ((last_t != now) ||
- (get_pm_cur_state() == S_LCDOFF) ||
- (get_pm_cur_state() == S_SLEEP)) {
- states[get_pm_cur_state()].trans(EVENT_INPUT);
- last_t = now;
- }
- }
-
- if (condition == PM_CONTROL_EVENT) {
- display_lock_proc_condition(data);
-
- if (IS_COND_REQUEST_CHANGE(data->cond))
- display_state_transition_do_proc_change_state(data->cond, data->pid);
- }
-
- return 0;
-}
-
static int update_setting(int key_idx, int val)
{
int ret;
/* change state - LCD on */
if (disp_plgn->pm_change_internal)
disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
- poll_callback(INPUT_POLL_EVENT, NULL);
+ display_state_transition_do_state_transition_by_input_poll_event();
}
if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
return;
/* lcd on or update lcd timeout */
- poll_callback(INPUT_POLL_EVENT, NULL);
+ display_state_transition_do_state_transition_by_input_poll_event();
}
static int delayed_init_done(void *data)
unsigned int timeout;
unsigned int timeout2;
} PMMsg;
-extern int poll_callback(int condition, PMMsg *data);
extern struct state state[S_END];
return 0;
}
+int display_state_transition_do_state_transition_by_input_poll_event(void)
+{
+ static time_t last_time;
+ time_t now;
+
+ if (!display_is_display_ops_started_status()) {
+ _E("Display logic is not started.");
+ return -ECANCELED;
+ }
+
+ if ((get_pm_cur_state() == S_LCDOFF) || (get_pm_cur_state() == S_SLEEP))
+ _I("Input event signal at Display Off");
+
+ time(&now);
+ if ((last_time != now) || (get_pm_cur_state() == S_LCDOFF) || (get_pm_cur_state() == S_SLEEP)) {
+ display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
+ last_time = now;
+ }
+
+ return 0;
+}
+
+int display_state_transition_do_state_transition_by_pm_control_event(PMMsg *data)
+{
+ if (!display_is_display_ops_started_status()) {
+ _E("Display logic is not started.");
+ return -ECANCELED;
+ }
+ display_lock_proc_condition(data);
+
+ if (IS_COND_REQUEST_CHANGE(data->cond))
+ display_state_transition_do_proc_change_state(data->cond, data->pid);
+
+ return 0;
+}
+
/* FIXME: diff time calculation, set_wakeup_count should be discussed again later */
int display_state_transition_do_state_action(int timeout)
{
return 0;
}
-
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_transition_by_input_poll_event(void);
+int display_state_transition_do_state_transition_by_pm_control_event(PMMsg *data);
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);
/** FIXME: display_ops_status getter/setter will be removed after plugin-core separation
This work should be proceeded in the display core
*/
+bool display_is_display_ops_started_status(void)
+{
+ return (display_ops_status == DEVICE_OPS_STATUS_START);
+}
+
void display_set_display_ops_status(enum device_ops_status dev_ops_status)
{
display_ops_status = dev_ops_status;
void display_unregister_dependent_device(void);
bool display_dimstay_check(void);
int display_initialize_display_state_timeout_from_setting(void);
+bool display_is_display_ops_started_status(void);
void display_set_display_ops_status(enum device_ops_status dev_ops_status);
int display_get_display_ops_status(enum device_ops_status *dev_ops_status);
void display_set_power_save_mode_flag(int onoff);
recv_data.cond = cond;
recv_data.timeout = timeout;
- poll_callback(PM_CONTROL_EVENT, &recv_data);
+ display_state_transition_do_state_transition_by_pm_control_event(&recv_data);
return 0;
}
recv_data.cond = cond;
recv_data.timeout = 0;
- poll_callback(PM_CONTROL_EVENT, &recv_data);
+ display_state_transition_do_state_transition_by_pm_control_event(&recv_data);
return 0;
}
recv_data.cond = cond;
recv_data.timeout = 0;
- poll_callback(PM_CONTROL_EVENT, &recv_data);
+ display_state_transition_do_state_transition_by_pm_control_event(&recv_data);
return 0;
}