lcd_on_direct() is used to lcd turn on directly by key-event, proc_change_state.. etc.
It is called under the specific condition.
To relocate lcd_on_direct(), update_display_locktime() is also relocated.
For wearable plugin, this wrapper is added.
- int display_plugin_lcd_on_procedure(int state, enum device_flags flag);
New functions are added below display-state-transition
- void display_state_transition_update_lock_screen_timeout(int timeout);
-> This function sets lock screen timeout value and update.
It replaces update_display_locktime()
New function is added below display-panel
- void display_panel_lcd_on_direct(enum device_flags flags);
-> This replaces lcd_on_direct()
Change-Id: I5628e230ec0fcc9a0ff36b31966ffbda85d92d69
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
return UNKNOWN_STR;
}
-static void update_display_locktime(int time)
-{
- display_state_transition_set_lock_screen_timeout(time);
- display_state_transition_update_display_state_timeout_by_priority();
-}
-
-void lcd_on_direct(enum device_flags flags)
-{
- enum hal_device_power_transition_reason reason;
-
- if (flags & LCD_ON_BY_POWER_KEY)
- reason = HAL_DEVICE_POWER_TRANSITION_REASON_POWER_KEY;
- else if (flags & LCD_ON_BY_TOUCH)
- reason = HAL_DEVICE_POWER_TRANSITION_REASON_TOUCH_SCREEN;
- else
- reason = HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN;
-
- power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL, reason, NULL);
- set_pm_cur_state(S_NORMAL);
-
- _D("lcd is on directly");
- display_panel_update_lcd_on_timeval();
- display_panel_lcd_on_procedure(LCD_NORMAL, flags);
-
- update_display_locktime(LOCK_SCREEN_INPUT_TIMEOUT);
-}
-
static gboolean timer_refresh_cb(gpointer data)
{
struct state *st;
return -EINVAL;
if (display_panel_get_dpms_cached_state() != DPMS_ON)
- lcd_on_direct(LCD_ON_BY_GESTURE);
+ display_panel_lcd_on_direct(LCD_ON_BY_GESTURE);
_I("Custom lcd on timeout(%d ms).", timeout);
if (set_custom_lcdon_timeout(timeout) == true)
}
if (display_panel_get_dpms_cached_state() != DPMS_ON)
- lcd_on_direct(flag);
+ display_panel_lcd_on_direct(flag);
_I("platform lcd on by %s (%d ms)", reason, timeout);
if (set_custom_lcdon_timeout(timeout) == true)
switch (next) {
case S_NORMAL:
if (display_panel_get_dpms_cached_state() != DPMS_ON)
- lcd_on_direct(LCD_ON_BY_EVENT);
- update_display_locktime(LOCK_SCREEN_CONTROL_TIMEOUT);
+ 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:
setup_display_plugin_backlight_ops(dp);
dp->set_dim_state = NULL;
dp->get_device_flags = NULL;
+ dp->lcd_on_procedure = NULL;
dp->lcd_off_procedure = NULL;
setup_display_plugin_backlight_ops(dp);
else if (flags & LCD_ON_BY_TOUCH)
_I("Display on by Touch_wakeup event");
- lcd_on_direct(flags);
+ display_panel_lcd_on_direct(flags);
return true;
}
return UNKNOWN_STR;
}
-static void update_display_locktime(int time)
-{
- display_state_transition_set_lock_screen_timeout(time);
- display_state_transition_update_display_state_timeout_by_priority();
-}
-
-void lcd_on_direct(enum device_flags flags)
-{
- enum hal_device_power_transition_reason reason;
-
- if (flags & LCD_ON_BY_POWER_KEY)
- reason = HAL_DEVICE_POWER_TRANSITION_REASON_POWER_KEY;
- else if (flags & LCD_ON_BY_TOUCH)
- reason = HAL_DEVICE_POWER_TRANSITION_REASON_TOUCH_SCREEN;
- else
- reason = HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN;
-
- power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL, reason, NULL);
- set_pm_cur_state(S_NORMAL);
-
- _D("lcd is on directly");
- display_panel_update_lcd_on_timeval();
- display_panel_lcd_on_procedure(LCD_NORMAL, flags);
-
- update_display_locktime(LOCK_SCREEN_INPUT_TIMEOUT);
-}
-
static gboolean timer_refresh_cb(gpointer data)
{
struct state *st;
return -EINVAL;
if (display_panel_get_dpms_cached_state() != DPMS_ON)
- lcd_on_direct(LCD_ON_BY_GESTURE);
+ display_panel_lcd_on_direct(LCD_ON_BY_GESTURE);
_I("Custom lcd on timeout(%d ms).", timeout);
if (set_custom_lcdon_timeout(timeout) == true)
}
if (display_panel_get_dpms_cached_state() != DPMS_ON)
- lcd_on_direct(flag);
+ display_panel_lcd_on_direct(flag);
_I("platform lcd on by %s (%d ms)", reason, timeout);
if (set_custom_lcdon_timeout(timeout) == true)
switch (next) {
case S_NORMAL:
if (display_panel_get_dpms_cached_state() != DPMS_ON)
- lcd_on_direct(LCD_ON_BY_EVENT);
- update_display_locktime(LOCK_SCREEN_CONTROL_TIMEOUT);
+ 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:
setup_display_plugin_backlight_ops(dp);
dp->set_dim_state = NULL;
dp->get_device_flags = NULL;
+ dp->lcd_on_procedure = NULL;
dp->lcd_off_procedure = NULL;
setup_display_plugin_backlight_ops(dp);
else if (flags & LCD_ON_BY_TOUCH)
_I("Display on by Touch_wakeup event");
- lcd_on_direct(flags);
+ display_panel_lcd_on_direct(flags);
return true;
}
if (display_panel_get_dpms_cached_state() != DPMS_ON ||
current_state_in_on() == false) {
broadcast_lcdon_by_powerkey();
- lcd_on_direct(LCD_ON_BY_POWER_KEY);
+ display_panel_lcd_on_direct(LCD_ON_BY_POWER_KEY);
poll_callback(INPUT_POLL_EVENT, NULL);
}
return UNKNOWN_STR;
}
-static void update_display_locktime(int time)
-{
- display_state_transition_set_lock_screen_timeout(time);
- display_state_transition_update_display_state_timeout_by_priority();
-}
-
-void lcd_on_direct(enum device_flags flags)
-{
- enum hal_device_power_transition_reason reason;
-
- if (flags & LCD_ON_BY_POWER_KEY)
- reason = HAL_DEVICE_POWER_TRANSITION_REASON_POWER_KEY;
- else if (flags & LCD_ON_BY_TOUCH)
- reason = HAL_DEVICE_POWER_TRANSITION_REASON_TOUCH_SCREEN;
- else
- reason = HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN;
-
- power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL, reason, NULL);
- set_pm_cur_state(S_NORMAL);
-
- _D("lcd is on directly");
- display_panel_update_lcd_on_timeval();
- display_panel_lcd_on_procedure(LCD_NORMAL, flags);
-
- update_display_locktime(LOCK_SCREEN_INPUT_TIMEOUT);
-}
-
static gboolean timer_refresh_cb(gpointer data)
{
struct state *st;
return -EINVAL;
if (display_panel_get_dpms_cached_state() != DPMS_ON)
- lcd_on_direct(LCD_ON_BY_GESTURE);
+ display_panel_lcd_on_direct(LCD_ON_BY_GESTURE);
_I("Custom lcd on timeout(%d ms).", timeout);
if (set_custom_lcdon_timeout(timeout) == true)
}
if (display_panel_get_dpms_cached_state() != DPMS_ON)
- lcd_on_direct(flag);
+ display_panel_lcd_on_direct(flag);
_I("platform lcd on by %s (%d ms)", reason, timeout);
if (set_custom_lcdon_timeout(timeout) == true)
switch (next) {
case S_NORMAL:
if (display_panel_get_dpms_cached_state() != DPMS_ON)
- lcd_on_direct(LCD_ON_BY_EVENT);
- update_display_locktime(LOCK_SCREEN_CONTROL_TIMEOUT);
+ 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:
setup_display_plugin_backlight_ops(dp);
dp->set_dim_state = NULL;
dp->get_device_flags = NULL;
+ dp->lcd_on_procedure = NULL;
dp->lcd_off_procedure = NULL;
setup_display_plugin_backlight_ops(dp);
else if (flags & LCD_ON_BY_TOUCH)
_I("Display on by Touch_wakeup event");
- lcd_on_direct(flags);
+ display_panel_lcd_on_direct(flags);
return true;
}
enter_doze();
}
-static void update_display_locktime(int time)
-{
- display_state_transition_set_lock_screen_timeout(time);
- display_state_transition_update_display_state_timeout_by_priority();
-}
-
static void set_dim_state(bool on)
{
_I("Dim state is %d.", on);
states[get_pm_cur_state()].trans(EVENT_INPUT);
}
-void lcd_on_direct(enum device_flags flags)
-{
- enum hal_device_power_transition_reason reason;
-
- if (flags & LCD_ON_BY_POWER_KEY)
- reason = HAL_DEVICE_POWER_TRANSITION_REASON_POWER_KEY;
- else if (flags & LCD_ON_BY_TOUCH)
- reason = HAL_DEVICE_POWER_TRANSITION_REASON_TOUCH_SCREEN;
- else
- reason = HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN;
-
- power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL, reason, NULL);
- set_pm_cur_state(S_NORMAL);
-
- _D("lcd is on directly");
- display_panel_update_lcd_on_timeval();
- lcd_on_procedure(LCD_NORMAL, flags);
-
- update_display_locktime(LOCK_SCREEN_INPUT_TIMEOUT);
-}
-
static inline bool check_lcd_is_on(void)
{
if (display_panel_get_dpms_cached_state() != DPMS_ON)
return -EINVAL;
if (check_lcd_is_on() == false)
- lcd_on_direct(LCD_ON_BY_GESTURE);
+ display_panel_lcd_on_direct(LCD_ON_BY_GESTURE);
/* Exceptional case:
* During tutorial, reset timeout by default timeout, not the given timeout */
}
if (check_lcd_is_on() == false)
- lcd_on_direct(flag);
+ display_panel_lcd_on_direct(flag);
_I("platform lcd on by %s (%d ms)", reason, timeout);
if (set_custom_lcdon_timeout(timeout) == true)
switch (next) {
case S_NORMAL:
if (check_lcd_is_on() == false)
- lcd_on_direct(LCD_ON_BY_EVENT);
- update_display_locktime(LOCK_SCREEN_CONTROL_TIMEOUT);
+ 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:
setup_display_plugin_backlight_ops(dp);
dp->set_dim_state = set_dim_state;
dp->get_device_flags = get_device_flags;
+ dp->lcd_on_procedure = lcd_on_procedure;
dp->lcd_off_procedure = lcd_off_procedure;
setup_display_plugin_backlight_ops(dp);
else if (flags & LCD_ON_BY_TOUCH)
_I("Display on by Touch_wakeup event");
- lcd_on_direct(flags);
+ display_panel_lcd_on_direct(flags);
return true;
}
int display_off_by_reason(const char *reason);
int set_lcd_timeout(int on, int dim, const char *name);
int custom_lcdon(int timeout);
-void lcd_on_direct(enum device_flags flags);
void broadcast_lcd_off_late(enum device_flags flags);
/* auto-brightness.c */
#include <sys/time.h>
#include "shared/log.h"
+#include "power/power.h"
#include "power/power-suspend.h"
#include "power/power-doze.h"
#include "ambient-mode.h"
#include "display-misc.h"
#include "display-panel.h"
#include "display-signal.h"
+#include "display-state-transition.h"
#include "led/touch-key.h"
#define MAX_WHITE_BALANCE_GAIN 2047
display_plugin_get_device_flags(&flags);
flags |= flag;
+ if (display_plugin_lcd_on_procedure(state, flag) == 0)
+ return;
/*
* Display on procedure
* step 1. leave doze
enter_doze();
}
+void display_panel_lcd_on_direct(enum device_flags flags)
+{
+ enum hal_device_power_transition_reason reason;
+
+ if (flags & LCD_ON_BY_POWER_KEY)
+ reason = HAL_DEVICE_POWER_TRANSITION_REASON_POWER_KEY;
+ else if (flags & LCD_ON_BY_TOUCH)
+ reason = HAL_DEVICE_POWER_TRANSITION_REASON_TOUCH_SCREEN;
+ else
+ reason = HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN;
+
+ power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL, reason, NULL);
+ set_pm_cur_state(S_NORMAL);
+
+ _D("lcd is on directly");
+ display_panel_update_lcd_on_timeval();
+ display_panel_lcd_on_procedure(LCD_NORMAL, flags);
+
+ display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_INPUT_TIMEOUT);
+}
+
bool display_panel_is_lcd_on_state_broadcasted(void)
{
return lcd_on_broadcasted;
void display_panel_get_lcd_paneloff_mode(bool *on);
void display_panel_lcd_on_procedure(int state, enum device_flags flag);
void display_panel_lcd_off_procedure(enum device_flags flag);
+void display_panel_lcd_on_direct(enum device_flags flags);
bool display_panel_is_lcd_on_state_broadcasted(void);
void display_panel_update_lcd_on_timeval(void);
int display_panel_calculate_diff_time_between_lcd_on_direct_and_state_action(int *diff_time);
return 0;
}
+int display_plugin_lcd_on_procedure(int state, enum device_flags flag)
+{
+ if (g_display_plugin.lcd_on_procedure) {
+ g_display_plugin.lcd_on_procedure(state, flag);
+ return 0;
+ }
+
+ return -EOPNOTSUPP;
+}
+
int display_plugin_lcd_off_procedure(enum device_flags flag)
{
if (g_display_plugin.lcd_off_procedure) {
/* FIXME: function names will be redefined */
void (*set_dim_state) (bool on);
int (*get_device_flags) (unsigned long *device_flags);
+ void (*lcd_on_procedure) (int state, enum device_flags flag);
void (*lcd_off_procedure) (enum device_flags flag);
struct display_config *config;
int display_plugin_auto_brightness_control(enum brightness_request_e request, int set_brightness);
int display_plugin_set_dim_state(bool on);
int display_plugin_get_device_flags(unsigned long *device_flags);
+int display_plugin_lcd_on_procedure(int state, enum device_flags flag);
int display_plugin_lcd_off_procedure(enum device_flags flag);
int display_plugin_backlight_get_lcd_power(void);
return 0;
}
+void display_state_transition_update_lock_screen_timeout(int timeout)
+{
+ display_state_transition_set_lock_screen_timeout(time);
+ display_state_transition_update_display_state_timeout_by_priority();
+}
+
void display_state_transition_update_display_state_timeout_by_priority(void)
{
int run_timeout, val;
int display_state_transition_get_custom_timeout(enum state_t state, unsigned int *timeout);
int display_state_transition_set_lock_screen_timeout(int timeout);
int display_state_transition_get_lock_screen_timeout(int *timeout);
+void display_state_transition_update_lock_screen_timeout(int timeout);
void display_state_transition_update_display_state_timeout_by_priority(void);
int display_state_transition_check_state_transition_condition(enum state_t cur_state, enum state_t next_state);
int display_state_transition_update_lcdoff_reason(int source);