From: Youngjae Cho Date: Fri, 14 Apr 2023 08:22:43 +0000 (+0900) Subject: display: Relocate wakeup to where subroutine must go through X-Git-Tag: accepted/tizen/7.0/unified/20230424.020447~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F291428%2F3;p=platform%2Fcore%2Fsystem%2Fdeviced.git display: Relocate wakeup to where subroutine must go through Wakeup request via power_request_change_state_strict() has moved to location where all request must go through so that redundant requests could be removed. There are the two points: - lcd_on_procedure() - proc_condition_lock() Those two are the essential point considering both autosleep and echomem in that system must remain wakeup on that point. Change-Id: Ie257403c8f04fd8aac63f588d120858b7d1006e9 Signed-off-by: Youngjae Cho --- diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c index a5117605..83d4672a 100644 --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -350,20 +350,31 @@ void lcd_on_procedure(int state, enum device_flags flag) GList *l = NULL; const struct device_ops *ops = NULL; unsigned long flags = get_lcd_on_flags(); + enum hal_device_power_transition_reason reason; flags |= flag; /* * Display on procedure - * step 1. leave doze - * step 2. broadcast lcd on signal with cause - * step 3. set brightness - * step 4. set pmstate of vconf - * step 5. display on operate + * step 1. change power state to normal + * step 2. leave doze + * step 3. broadcast lcd on signal with cause + * step 4. set brightness + * step 5. set pmstate of vconf + * step 6. display on operate * - a. display on * - b. TSP(touch screen) and touchkey enable - * step 6. broadcast lcd on complete signal - * step 7. key backlight enable + * step 7. broadcast lcd on complete signal + * step 8. key backlight enable */ + + 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); leave_doze(); _I("[lcdstep] 0x%lx", flags); @@ -727,16 +738,6 @@ void set_dim_state(bool on) 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"); @@ -1012,8 +1013,14 @@ static void proc_condition_lock(PMMsg *data) get_pname(pid, pname); if ((state == S_LCDOFF) && (get_pm_cur_state() == S_SLEEP) && - (pm_get_power_lock() == POWER_UNLOCK)) + (pm_get_power_lock() == POWER_UNLOCK)) { + /** + * To escape from display state S_SLEEP, + * it must precede that change power state from SLEEP to NORAML + */ + power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL, 0, NULL); proc_change_state(data->cond, INTERNAL_LOCK_PM); + } if (data->timeout > 0) { /* To pass a pid_t data through the timer infrastructure @@ -1460,8 +1467,6 @@ static int default_action(int timeout) } if ((get_pm_cur_state() != get_pm_old_state()) && (get_pm_cur_state() != S_SLEEP)) { - power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL, - power_get_wakeup_reason(), NULL); set_setting_pmstate(get_pm_cur_state()); pm_cur_state = get_pm_cur_state(); device_notify(DEVICE_NOTIFIER_LCD, (void *)&pm_cur_state); @@ -2190,8 +2195,6 @@ static void display_init(void *data) 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.