Except for a specific profile, unnecessarily duplicated codes are erased.
And same code is moved to display.c.
Change-Id: I35c6e0693fb1e9581ecefa1f03db9fa71681084f
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
* @{
*/
-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;
{ S_POWEROFF, "S_POWEROFF", NULL, NULL, NULL, NULL },
};
-#define DELAYED_INIT_WATING_TIME 60000 /* 1 minute */
-
#define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */
#define LONG_PRESS_INTERVAL 2 /* 2 seconds */
#define SAMPLING_INTERVAL 1 /* 1 sec */
return &states[state];
}
-static void init_lcd_operation(void)
-{
- const struct device_ops *ops = NULL;
-
- ops = find_device("display");
- if (!check_default(ops))
- display_register_dependent_device(ops);
-
- ops = find_device("touchkey");
- if (!check_default(ops))
- display_register_dependent_device(ops);
-
- ops = find_device("touchscreen");
- if (!check_default(ops))
- display_register_dependent_device(ops);
-}
-
-static void exit_lcd_operation(void)
-{
- display_unregister_dependent_device();
-}
-
enum {
INIT_SETTING = 0,
INIT_INTERFACE,
INIT_END
};
-static const char *errMSG[INIT_END] = {
- [INIT_SETTING] = "setting init error",
- [INIT_INTERFACE] = "lowlevel interface(sysfs or others) init error",
- [INIT_POLL] = "input devices poll init error",
- [INIT_FIFO] = "FIFO poll init error",
- [INIT_DBUS] = "d-bus init error",
-};
-
static void init_display_states(void *data)
{
struct display_plugin *dp = (struct display_plugin *) data;
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 */
if (!is_feature_display_supported())
return 0;
}
-static int input_init_handler(void)
-{
- if (!display_conf.input_support)
- remove_device_by_devname("input");
-
- return 0;
-}
-
static void display_init(void *data)
{
- int ret, i;
- unsigned int flags = (WITHOUT_STARTNOTI | FLAG_X_DPMS);
- int timeout = 0;
-
- _I("Start power manager.");
+ int ret;
/* load configutation */
ret = display_load_config(&display_conf);
if (ret < 0)
_W("Failed to load '%s', use default value: %d",
DISPLAY_CONF_FILE, ret);
-
- register_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
- register_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
- register_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
-
- init_save_userlock();
-
- for (i = INIT_SETTING; i < INIT_END; i++) {
- switch (i) {
- case INIT_SETTING:
- ret = init_setting(NULL);
- break;
- case INIT_INTERFACE:
- if (display_conf.timeout_enable)
- display_initialize_display_state_timeout_from_setting();
- ret = init_sysfs(flags);
- break;
- case INIT_POLL:
- _I("input init");
- ret = input_init_handler();
-
- pm_lock_detector_init();
- break;
- case INIT_DBUS:
- _I("Dbus init.");
- ret = init_pm_dbus();
- break;
- }
- if (ret != 0) {
- _E("Failed to init: %s", errMSG[i]);
- break;
- }
- }
-
- if (i == INIT_END) {
- display_ops_init(NULL);
-#ifdef ENABLE_PM_LOG
- pm_history_init();
-#endif
- init_lcd_operation();
- display_set_initial_brightness();
- display_set_initial_battery_flag();
- display_set_initial_lockscreen_status();
-
- /* In smd test, TSP should be turned off if display panel is not existed. */
- if (display_panel_get_dpms_cached_state() == -ENOENT) {
- _I("Display panel is not existed.");
- lcd_direct_control(DPMS_OFF, NORMAL_MODE);
- exit_lcd_operation();
- }
-
- /* wm_ready needs to be checked
- * since display manager can be launched later than deviced.
- * In the case, display cannot be turned on at the first booting */
- // wm_ready = check_wm_ready();
- if (display_panel_init_dpms()) {
- if (is_lcdon_blocked() != LCDON_BLOCK_NONE)
- display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT);
- else
- display_panel_lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
- } else {
- display_add_timer_for_waiting_dpms_init();
- }
-
- if (display_conf.lcd_always_on) {
- _I("LCD always on.");
- display_state_transition_set_transition_table_display_state(S_NORMAL, S_NORMAL, EVENT_TIMEOUT);
- }
-
- if (flags & WITHOUT_STARTNOTI) { /* start without noti */
- _I("Start Power managing without noti");
- power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL,
- HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN, NULL);
- /*
- * Lock lcd off until booting is done.
- * deviced guarantees all booting script is executing.
- * Last script of booting unlocks this suspend blocking state.
- */
- display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_OFF,
- STAY_CUR_STATE, DELAYED_INIT_WATING_TIME);
-
- /* Initial display state right after the booting done */
- if (is_lcdon_blocked())
- set_pm_cur_state(S_LCDOFF);
- else
- set_pm_cur_state(S_NORMAL);
- ret = vconf_set_int(VCONFKEY_PM_STATE, get_pm_cur_state());
- if (ret < 0)
- _E("Failed to set vconf value for pm cur state: %d", vconf_get_ext_errno());
-
- display_set_display_ops_status(DEVICE_OPS_STATUS_START);
- if (display_conf.timeout_enable) {
- timeout = states[S_NORMAL].timeout;
- /* check minimun lcd on time */
- if (timeout < SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT))
- timeout = SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT);
-
- display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
- STAY_CUR_STATE, timeout);
- }
-
- }
-
- set_display_init_direction(display_conf.display_init_direction);
- }
}
static void display_exit(void *data)
}
}
- exit_lcd_operation();
+ display_unregister_dependent_device();
free_lock_info_list();
/* free display service */
dp->backlight = &backlight_ops;
}
-int init_sysfs(unsigned int flags)
-{
- register_notifier(DEVICE_NOTIFIER_VITAL_STATE, vital_state_changed);
-
- return 0;
-}
-
int exit_sysfs(void)
{
const struct device_ops *ops = NULL;
* @{
*/
-extern void init_save_userlock(void);
-
static struct display_plugin *disp_plgn;
static struct display_backlight_ops *backlight_ops;
{ S_POWEROFF, "S_POWEROFF", NULL, NULL, NULL, NULL },
};
-#define DELAYED_INIT_WATING_TIME 60000 /* 1 minute */
-
#define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */
#define LONG_PRESS_INTERVAL 400 /* 0.4 seconds */
#define SAMPLING_INTERVAL 1 /* 1 sec */
return 0;
}
-static void init_lcd_operation(void)
-{
- const struct device_ops *ops = NULL;
-
- ops = find_device("display");
- if (!check_default(ops))
- display_register_dependent_device(ops);
-
- ops = find_device("touchkey");
- if (!check_default(ops))
- display_register_dependent_device(ops);
-
- ops = find_device("touchscreen");
- if (!check_default(ops))
- display_register_dependent_device(ops);
-}
-
-static void exit_lcd_operation(void)
-{
- display_unregister_dependent_device();
-}
-
enum {
INIT_SETTING = 0,
INIT_INTERFACE,
INIT_END
};
-static const char *errMSG[INIT_END] = {
- [INIT_SETTING] = "setting init error",
- [INIT_INTERFACE] = "lowlevel interface(sysfs or others) init error",
- [INIT_POLL] = "input devices poll init error",
- [INIT_FIFO] = "FIFO poll init error",
- [INIT_DBUS] = "d-bus init error",
-};
-
static void init_display_states(void *data)
{
struct display_plugin *dp = (struct display_plugin *) data;
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);
/**
* load display service
return 0;
}
-static int input_init_handler(void)
-{
- if (!display_conf.input_support)
- remove_device_by_devname("input");
-
- return 0;
-}
-
static void display_init(void *data)
{
- int ret, i;
- unsigned int flags = (WITHOUT_STARTNOTI | FLAG_X_DPMS);
- int timeout = 0;
-
- _I("Start power manager.");
+ int ret;
/* load configutation */
ret = display_load_config(&display_conf);
_W("Failed to load '%s', use default value: %d",
DISPLAY_CONF_FILE, ret);
- register_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
- register_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
- register_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
-
- init_save_userlock();
-
- for (i = INIT_SETTING; i < INIT_END; i++) {
- switch (i) {
- case INIT_SETTING:
- ret = init_setting(NULL);
- break;
- case INIT_INTERFACE:
- if (display_conf.timeout_enable)
- display_initialize_display_state_timeout_from_setting();
- ret = init_sysfs(flags);
- break;
- case INIT_POLL:
- _I("input init");
- ret = input_init_handler();
-
- pm_lock_detector_init();
- break;
- case INIT_DBUS:
- _I("Dbus init.");
- ret = init_pm_dbus();
- break;
- }
- if (ret != 0) {
- _E("Failed to init: %s", errMSG[i]);
- break;
- }
- }
-
- if (i == INIT_END) {
- display_ops_init(NULL);
-#ifdef ENABLE_PM_LOG
- pm_history_init();
-#endif
- init_lcd_operation();
- display_misc_set_battery_charging_status_flag();
- display_set_initial_brightness();
- display_set_initial_battery_flag();
- display_set_initial_lockscreen_status();
-
- /* In smd test, TSP should be turned off if display panel is not existed. */
- if (display_panel_get_dpms_cached_state() == -ENOENT) {
- _I("Display panel is not existed.");
- lcd_direct_control(DPMS_OFF, NORMAL_MODE);
- exit_lcd_operation();
- }
-
- /* wm_ready needs to be checked
- * since display manager can be launched later than deviced.
- * In the case, display cannot be turned on at the first booting */
- // wm_ready = check_wm_ready();
- if (display_panel_init_dpms()) {
- if (is_lcdon_blocked() != LCDON_BLOCK_NONE)
- display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT);
- else
- display_panel_lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
- } else {
- display_add_timer_for_waiting_dpms_init();
- }
-
- if (display_conf.lcd_always_on) {
- _I("LCD always on.");
- display_state_transition_set_transition_table_display_state(S_NORMAL, S_NORMAL, EVENT_TIMEOUT);
- }
-
- if (flags & WITHOUT_STARTNOTI) { /* start without noti */
- _I("Start Power managing without noti");
- power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL,
- HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN, NULL);
- /*
- * Lock lcd off until booting is done.
- * deviced guarantees all booting script is executing.
- * Last script of booting unlocks this suspend blocking state.
- */
- display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_OFF,
- STAY_CUR_STATE, DELAYED_INIT_WATING_TIME);
-
- /* Initial display state right after the booting done */
- if (is_lcdon_blocked())
- set_pm_cur_state(S_LCDOFF);
- else
- set_pm_cur_state(S_NORMAL);
- ret = vconf_set_int(VCONFKEY_PM_STATE, get_pm_cur_state());
- if (ret < 0)
- _E("Failed to set vconf value for pm cur state: %d", vconf_get_ext_errno());
-
- display_set_display_ops_status(DEVICE_OPS_STATUS_START);
- if (display_conf.timeout_enable) {
- timeout = states[S_NORMAL].timeout;
- /* check minimun lcd on time */
- if (timeout < SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT))
- timeout = SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT);
-
- display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
- STAY_CUR_STATE, timeout);
- }
-
- }
-
- set_display_init_direction(display_conf.display_init_direction);
- }
+ display_misc_set_battery_charging_status_flag();
}
static void display_exit(void *data)
}
}
- exit_lcd_operation();
+ display_unregister_dependent_device();
free_lock_info_list();
/* free display service */
dp->backlight = &backlight_ops;
}
-int init_sysfs(unsigned int flags)
-{
- register_notifier(DEVICE_NOTIFIER_VITAL_STATE, vital_state_changed);
- register_notifier(DEVICE_NOTIFIER_DELAYED_INIT, delayed_init_done);
-
- return 0;
-}
-
int exit_sysfs(void)
{
const struct device_ops *ops = NULL;
* @{
*/
-extern void init_save_userlock(void);
-
static struct display_plugin *disp_plgn;
static struct display_backlight_ops *backlight_ops;
{ S_POWEROFF, "S_POWEROFF", NULL, NULL, NULL, NULL },
};
-#define DELAYED_INIT_WATING_TIME 60000 /* 1 minute */
-
#define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */
#define LONG_PRESS_INTERVAL 2 /* 2 seconds */
#define SAMPLING_INTERVAL 1 /* 1 sec */
return &states[state];
}
-static void init_lcd_operation(void)
-{
- const struct device_ops *ops = NULL;
-
- ops = find_device("display");
- if (!check_default(ops))
- display_register_dependent_device(ops);
-
- ops = find_device("touchkey");
- if (!check_default(ops))
- display_register_dependent_device(ops);
-
- ops = find_device("touchscreen");
- if (!check_default(ops))
- display_register_dependent_device(ops);
-}
-static void exit_lcd_operation(void)
-{
- display_unregister_dependent_device();
-}
enum {
INIT_SETTING = 0,
INIT_END
};
-static const char *errMSG[INIT_END] = {
- [INIT_SETTING] = "setting init error",
- [INIT_INTERFACE] = "lowlevel interface(sysfs or others) init error",
- [INIT_POLL] = "input devices poll init error",
- [INIT_FIFO] = "FIFO poll init error",
- [INIT_DBUS] = "d-bus init error",
-};
-
static void init_display_states(void *data)
{
struct display_plugin *dp = (struct display_plugin *) data;
* Power manager Main
*
*/
-
static int display_probe(void *data)
{
int ret;
dp->default_saving_mode = NULL;
dp->is_lcdon_blocked = is_lcdon_blocked;
dp->proc_change_state = NULL;
- setup_display_plugin_backlight_ops(dp);
/**
* load display service
return 0;
}
-static int input_init_handler(void)
-{
- if (!display_conf.input_support)
- remove_device_by_devname("input");
-
- return 0;
-}
static void display_init(void *data)
{
- int ret, i;
- unsigned int flags = (WITHOUT_STARTNOTI | FLAG_X_DPMS);
- int timeout = 0;
-
- _I("Start power manager.");
+ int ret;
/* load configutation */
ret = display_load_config(&display_conf);
if (ret < 0)
_W("Failed to load '%s', use default value: %d",
DISPLAY_CONF_FILE, ret);
-
- register_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
- register_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
- register_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
-
- init_save_userlock();
-
- for (i = INIT_SETTING; i < INIT_END; i++) {
- switch (i) {
- case INIT_SETTING:
- ret = init_setting(NULL);
- break;
- case INIT_INTERFACE:
- if (display_conf.timeout_enable)
- display_initialize_display_state_timeout_from_setting();
- ret = init_sysfs(flags);
- break;
- case INIT_POLL:
- _I("input init");
- ret = input_init_handler();
-
- pm_lock_detector_init();
- break;
- case INIT_DBUS:
- _I("Dbus init.");
- ret = init_pm_dbus();
- break;
- }
- if (ret != 0) {
- _E("Failed to init: %s", errMSG[i]);
- break;
- }
- }
-
- if (i == INIT_END) {
- display_ops_init(NULL);
-#ifdef ENABLE_PM_LOG
- pm_history_init();
-#endif
- init_lcd_operation();
- display_set_initial_brightness();
- display_set_initial_battery_flag();
- display_set_initial_lockscreen_status();
-
- /* In smd test, TSP should be turned off if display panel is not existed. */
- if (display_panel_get_dpms_cached_state() == -ENOENT) {
- _I("Display panel is not existed.");
- lcd_direct_control(DPMS_OFF, NORMAL_MODE);
- exit_lcd_operation();
- }
-
- /* wm_ready needs to be checked
- * since display manager can be launched later than deviced.
- * In the case, display cannot be turned on at the first booting */
- // wm_ready = check_wm_ready();
- if (display_panel_init_dpms()) {
- if (is_lcdon_blocked() != LCDON_BLOCK_NONE)
- display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT);
- else
- display_panel_lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
- } else {
- display_add_timer_for_waiting_dpms_init();
- }
-
- if (display_conf.lcd_always_on) {
- _I("LCD always on.");
- display_state_transition_set_transition_table_display_state(S_NORMAL, S_NORMAL, EVENT_TIMEOUT);
- }
-
- if (flags & WITHOUT_STARTNOTI) { /* start without noti */
- _I("Start Power managing without noti");
- power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL,
- HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN, NULL);
- /*
- * Lock lcd off until booting is done.
- * deviced guarantees all booting script is executing.
- * Last script of booting unlocks this suspend blocking state.
- */
- display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_OFF,
- STAY_CUR_STATE, DELAYED_INIT_WATING_TIME);
-
- /* Initial display state right after the booting done */
- if (is_lcdon_blocked())
- set_pm_cur_state(S_LCDOFF);
- else
- set_pm_cur_state(S_NORMAL);
- ret = vconf_set_int(VCONFKEY_PM_STATE, get_pm_cur_state());
- if (ret < 0)
- _E("Failed to set vconf value for pm cur state: %d", vconf_get_ext_errno());
-
- display_set_display_ops_status(DEVICE_OPS_STATUS_START);
- if (display_conf.timeout_enable) {
- timeout = states[S_NORMAL].timeout;
- /* check minimun lcd on time */
- if (timeout < SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT))
- timeout = SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT);
-
- display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
- STAY_CUR_STATE, timeout);
- }
-
- }
-
- set_display_init_direction(display_conf.display_init_direction);
- }
}
static void display_exit(void *data)
}
}
- exit_lcd_operation();
+ display_unregister_dependent_device();
free_lock_info_list();
/* free display service */
dp->backlight = &backlight_ops;
}
-int init_sysfs(unsigned int flags)
-{
- register_notifier(DEVICE_NOTIFIER_VITAL_STATE, vital_state_changed);
-
- return 0;
-}
-
int exit_sysfs(void)
{
const struct device_ops *ops = NULL;
#define LATE_LCD_TRANSIT 1
-extern void init_save_userlock(void);
-
static struct display_plugin *disp_plgn;
static struct display_backlight_ops *backlight_ops;
{ S_POWEROFF, "S_POWEROFF", NULL, NULL, NULL, NULL },
};
-#define DELAYED_INIT_WATING_TIME 60000 /* 1 minute */
-
#define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */
#define LONG_PRESS_INTERVAL 500 /* 0.5 seconds */
#define SAMPLING_INTERVAL 1 /* 1 sec */
{
const struct device_ops *ops = NULL;
- ops = find_device("display");
- if (!check_default(ops))
- display_register_dependent_device(ops);
-
- ops = find_device("touchscreen");
- if (!check_default(ops))
- display_register_dependent_device(ops);
-
ops = find_device("bezel");
if (!check_default(ops))
display_register_dependent_device(ops);
}
-static void exit_lcd_operation(void)
-{
- display_unregister_dependent_device();
-}
-
enum {
INIT_SETTING = 0,
INIT_INTERFACE,
INIT_END
};
-static const char *errMSG[INIT_END] = {
- [INIT_SETTING] = "setting init error",
- [INIT_INTERFACE] = "lowlevel interface(sysfs or others) init error",
- [INIT_POLL] = "input devices poll init error",
- [INIT_FIFO] = "FIFO poll init error",
- [INIT_DBUS] = "d-bus init error",
-};
-
static void init_display_states(void *data)
{
struct display_plugin *dp = (struct display_plugin *) data;
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);
/**
* load display service
return 0;
}
-static int input_init_handler(void)
-{
- if (!display_conf.input_support)
- remove_device_by_devname("input");
-
- return 0;
-}
-
static void sec_dsim_uevent_changed(struct udev_device *dev)
{
const char *devpath;
static void display_init(void *data)
{
- int ret, i;
+ int ret;
unsigned int flags = (WITHOUT_STARTNOTI | FLAG_X_DPMS);
- int timeout = 0;
-
- _I("Start power manager.");
/* load configutation */
ret = display_load_config(&display_conf);
register_kernel_uevent_control(&sec_dsim_uevent_ops);
- register_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
- register_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
- register_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
register_notifier(DEVICE_NOTIFIER_LCD_AUTOBRT_SENSING, display_auto_brightness_sensing);
- init_save_userlock();
-
- for (i = INIT_SETTING; i < INIT_END; i++) {
- switch (i) {
- case INIT_SETTING:
- ret = init_setting(update_setting);
- break;
- case INIT_INTERFACE:
- if (display_conf.timeout_enable)
- display_initialize_display_state_timeout_from_setting();
- ret = init_sysfs(flags);
- break;
- case INIT_POLL:
- _I("input init");
- ret = input_init_handler();
-
- pm_lock_detector_init();
- break;
- case INIT_DBUS:
- _I("Dbus init.");
- ret = init_pm_dbus();
- break;
- }
- if (ret != 0) {
- _E("Failed to init: %s", errMSG[i]);
- break;
- }
- }
-
- if (i == INIT_END) {
- display_ops_init(NULL);
-#ifdef ENABLE_PM_LOG
- pm_history_init();
-#endif
- init_lcd_operation();
- display_misc_set_battery_charging_status_flag();
- display_set_initial_brightness();
- display_set_initial_battery_flag();
- display_set_initial_lockscreen_status();
-
- /* In smd test, TSP should be turned off if display panel is not existed. */
- if (display_panel_get_dpms_cached_state() == -ENOENT) {
- _I("Display panel is not existed.");
- lcd_direct_control(DPMS_OFF, NORMAL_MODE);
- exit_lcd_operation();
- }
-
- /* wm_ready needs to be checked
- * since display manager can be launched later than deviced.
- * In the case, display cannot be turned on at the first booting */
- // wm_ready = check_wm_ready();
- if (display_panel_init_dpms()) {
- if (is_lcdon_blocked() != LCDON_BLOCK_NONE)
- lcd_off_procedure(LCD_OFF_BY_EVENT);
- else
- lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
- } else {
- display_add_timer_for_waiting_dpms_init();
- }
-
- if (display_conf.lcd_always_on) {
- _I("LCD always on.");
- display_state_transition_set_transition_table_display_state(S_NORMAL, S_NORMAL, EVENT_TIMEOUT);
- }
-
- if (flags & WITHOUT_STARTNOTI) { /* start without noti */
- _I("Start Power managing without noti");
- power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL,
- HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN, NULL);
- /*
- * Lock lcd off until booting is done.
- * deviced guarantees all booting script is executing.
- * Last script of booting unlocks this suspend blocking state.
- */
- display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_OFF,
- STAY_CUR_STATE, DELAYED_INIT_WATING_TIME);
-
- /* Initial display state right after the booting done */
- if (is_lcdon_blocked())
- set_pm_cur_state(S_LCDOFF);
- else
- set_pm_cur_state(S_NORMAL);
- ret = vconf_set_int(VCONFKEY_PM_STATE, get_pm_cur_state());
- if (ret < 0)
- _E("Failed to set vconf value for pm cur state: %d", vconf_get_ext_errno());
-
- display_set_display_ops_status(DEVICE_OPS_STATUS_START);
- if (display_conf.timeout_enable) {
- timeout = states[S_NORMAL].timeout;
- /* check minimun lcd on time */
- if (timeout < SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT))
- timeout = SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT);
-
- display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
- STAY_CUR_STATE, timeout);
- }
-
- }
-
- set_display_init_direction(display_conf.display_init_direction);
- }
+ init_setting(update_setting);
+ init_sysfs(flags);
+ init_lcd_operation();
+ display_misc_set_battery_charging_status_flag();
}
static void display_exit(void *data)
}
}
- exit_lcd_operation();
+ display_unregister_dependent_device();
free_lock_info_list();
/* free display service */
dp->backlight = &backlight_ops;
}
+/* FIXME: This batterey plugin handle should be moved while battery backend separation */
int init_sysfs(unsigned int flags)
{
- register_notifier(DEVICE_NOTIFIER_VITAL_STATE, vital_state_changed);
-
if (battery_plgn->handle) {
fp_get_var_battery_status = dlsym(battery_plgn->handle, "get_var_battery_status");
if (fp_get_var_battery_status) {
#include "core/udev.h"
#include "shared/device-notifier.h"
#include "shared/log.h"
+#include "power/power.h"
+#include "power/power-suspend.h"
#include "device-interface.h"
#include "display.h"
#include "display-lock.h"
#include "display-plugin.h"
#include "display-config.h"
#include "display-misc.h"
+#include "display-ops.h"
#include "display-signal.h"
#include "display-state-transition.h"
#include "lock-detector.h"
+#define DELAYED_INIT_WATING_TIME 60000 /* 1 minute */
+
static const struct device_ops *display_plugin_device_ops;
static int pm_cur_state;
static int pm_old_state;
static GList *display_dependent_device_ops;
static enum device_ops_status display_ops_status = DEVICE_OPS_STATUS_UNINIT;
+extern void init_save_userlock(void);
+
inline int get_pm_cur_state(void)
{
return pm_cur_state;
return done;
}
+static void init_lcd_operation(void)
+{
+ const struct device_ops *ops = NULL;
+
+ ops = find_device("display");
+ if (!check_default(ops))
+ display_register_dependent_device(ops);
+
+ ops = find_device("touchkey");
+ if (!check_default(ops))
+ display_register_dependent_device(ops);
+
+ ops = find_device("touchscreen");
+ if (!check_default(ops))
+ display_register_dependent_device(ops);
+}
+
static int display_probe(void *data)
{
display_plugin_device_ops = find_device("display-plugin");
return display_plugin_device_ops->probe(&g_display_plugin);
}
+static int input_init_handler(void)
+{
+ if (!g_display_plugin.config->input_support)
+ remove_device_by_devname("input");
+
+ return 0;
+}
+
static void display_init(void *data)
{
+ bool timeout_enable = false;
+ int lcd_always_on = 0;
+ int timeout = 0;
+ int ret = 0;
+ unsigned int flags = (WITHOUT_STARTNOTI | FLAG_X_DPMS);
+
if (!display_plugin_device_ops || !display_plugin_device_ops->init)
return;
g_unix_signal_add(SIGHUP, handle_sighup, (gpointer) SIGHUP);
- register_notifier(DEVICE_NOTIFIER_DELAYED_INIT, delayed_init_done);
+ /* FIMXE: display config load should be put here*/
display_plugin_device_ops->init(data);
register_kernel_uevent_control(&lcd_uevent_ops);
+ register_notifier(DEVICE_NOTIFIER_DELAYED_INIT, delayed_init_done);
+ register_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
+ register_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
+ register_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
display_signal_register_display_brightness_notifier();
display_misc_register_battery_health_notifier();
register_notifier(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, power_resume_from_echomem_callback);
register_notifier(DEVICE_NOTIFIER_POWEROFF_TRIGGERED, poweroff_triggered_callback);
+
+ init_save_userlock();
+
+ ret = init_setting(NULL);
+ if (ret != 0)
+ _W("Failed to init: setting init error");
+
+ display_plugin_config_get_timeout_enable(&timeout_enable);
+ if (timeout_enable)
+ display_initialize_display_state_timeout_from_setting();
+
+ register_notifier(DEVICE_NOTIFIER_VITAL_STATE, vital_state_changed);
+
+ _I("input init");
+ ret = input_init_handler();
+ pm_lock_detector_init();
+ if (ret != 0)
+ _W("Failed to init: input devices poll init error");
+
+ _I("Dbus init.");
+ ret = init_pm_dbus();
+ if (ret != 0)
+ _W("Failed to init: dbus initialization error");
+
+ display_ops_init(NULL);
+#ifdef ENABLE_PM_LOG
+ pm_history_init();
+#endif
+ init_lcd_operation();
+ display_set_initial_brightness();
+ display_set_initial_battery_flag();
+ display_set_initial_lockscreen_status();
+
+ /* In smd test, TSP should be turned off if display panel is not existed. */
+ if (display_panel_get_dpms_cached_state() == -ENOENT) {
+ _I("Display panel is not existed.");
+ lcd_direct_control(DPMS_OFF, NORMAL_MODE);
+ display_unregister_dependent_device();
+ }
+
+ /* wm_ready needs to be checked
+ * since display manager can be launched later than deviced.
+ * In the case, display cannot be turned on at the first booting */
+ // wm_ready = check_wm_ready();
+ if (display_panel_init_dpms()) {
+ if (display_plugin_is_lcd_on_blocked() != LCDON_BLOCK_NONE) {
+ display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT);
+ } else {
+ display_panel_lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
+ }
+ } else {
+ display_add_timer_for_waiting_dpms_init();
+ }
+
+ display_plugin_config_get_lcd_always_on(&lcd_always_on);
+ if (lcd_always_on) {
+ _I("LCD always on.");
+ display_state_transition_set_transition_table_display_state(S_NORMAL, S_NORMAL, EVENT_TIMEOUT);
+ }
+
+ if (flags & WITHOUT_STARTNOTI) { /* start without noti */
+ _I("Start Power managing without noti");
+ power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL,
+ HAL_DEVICE_POWER_TRANSITION_REASON_UNKNOWN, NULL);
+ /*
+ * Lock lcd off until booting is done.
+ * deviced guarantees all booting script is executing.
+ * Last script of booting unlocks this suspend blocking state.
+ */
+ display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_OFF,
+ STAY_CUR_STATE, DELAYED_INIT_WATING_TIME);
+
+ /* Initial display state right after the booting done */
+ if (display_plugin_is_lcd_on_blocked())
+ set_pm_cur_state(S_LCDOFF);
+ else
+ set_pm_cur_state(S_NORMAL);
+ ret = vconf_set_int(VCONFKEY_PM_STATE, get_pm_cur_state());
+ if (ret < 0)
+ _E("Failed to set vconf value for pm cur state: %d", vconf_get_ext_errno());
+
+ display_set_display_ops_status(DEVICE_OPS_STATUS_START);
+ if (timeout_enable) {
+ display_plugin_state_get_timeout(S_NORMAL, &timeout);
+ /* check minimun lcd on time */
+ if (timeout < SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT)) {
+ timeout = SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT);
+ }
+ display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
+ STAY_CUR_STATE, timeout);
+ }
+ }
+
+ set_display_init_direction(g_display_plugin.config->display_init_direction);
}
static void display_exit(void *data)