power: separate action_for_state() callback 03/288003/3
authorYoungjae Cho <y0.cho@samsung.com>
Wed, 8 Feb 2023 09:17:17 +0000 (18:17 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 13 Feb 2023 09:12:34 +0000 (18:12 +0900)
commit7ef286fc30235c93342626b9dd854e2178f55ad7
tree554a0d02ae9cba0ca457d71f5168ca2f21c30cad
parentd2627ab52cfd1bac35d7735ddeca135554adafb6
power: separate action_for_state() callback

Separated the callback action_for_state() into two type
 - pre_action_state()
 - post_action_state()
Literally, it only differs when the time it is invoked based on
completing transition, one is before and the other is after finishing
transition.

 It is necessary for echo mem. Previously, the action_for_state()
always invoked 'right before' transition completion. As it is echo mem,
system is forced to go suspend within the action_for_state() callback.
After resuming from the suspend, the processing thread still be in the
action_for_state(), which is still not having completed sleep transition.
As a result, a system is waking up but the internal power state is about
to be changed to sleep state. This is contradiction and causes various
undesirable behavior.
 To address it, move echo mem to post_action_state(). Unlike the
previous action_for_state(), the post_action_state() is invoked 'after'
the completion of transition. That is, it is natural that waking up
within the post_action_state() as it already has been finished sleep
transition. Thus it won't change the internal state to sleep anymore.

Change-Id: I49e12a19538bdb4241cba34fd536c942257ccaec
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/power/power-suspend.c
src/power/power.c