display: Relocate wakeup to where subroutine must go through 28/291428/3
authorYoungjae Cho <y0.cho@samsung.com>
Fri, 14 Apr 2023 08:22:43 +0000 (17:22 +0900)
committeryoungjae <y0.cho@samsung.com>
Tue, 18 Apr 2023 00:30:36 +0000 (09:30 +0900)
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 <y0.cho@samsung.com>
plugins/mobile/display/core.c

index a511760..83d4672 100644 (file)
@@ -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.