Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4681963c authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Todd Kjos
Browse files

UPSTREAM: PM / sleep: Re-implement suspend-to-idle handling



In preparation for adding support for quiescing timers in the final
stage of suspend-to-idle transitions, rework the freeze_enter()
function making the system wait on a wakeup event, the freeze_wake()
function terminating the suspend-to-idle loop and the mechanism by
which deep idle states are entered during suspend-to-idle.

First of all, introduce a simple state machine for suspend-to-idle
and make the code in question use it.

Second, prevent freeze_enter() from losing wakeup events due to race
conditions and ensure that the number of online CPUs won't change
while it is being executed.  In addition to that, make it force
all of the CPUs re-enter the idle loop in case they are in idle
states already (so they can enter deeper idle states if possible).

Next, drop cpuidle_use_deepest_state() and replace use_deepest_state
checks in cpuidle_select() and cpuidle_reflect() with a single
suspend-to-idle state check in cpuidle_idle_call().

Finally, introduce cpuidle_enter_freeze() that will simply find the
deepest idle state available to the given CPU and enter it using
cpuidle_enter().

Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm


br: linux-next
(cherry picked from commit 3810631332465d967ba5e27ea2c7dff2c9afac6c)

BUG=None
TEST=1) Change power state of system to "freeze"
     2) Use echo freeze > /sys/power/state
     3) Check whether system wakes up on any interrupt(set rtc timer)

Change-Id: I895e0649549abdff8d618fb0967f32d550fd2b39
Signed-off-by: default avatarJay Patel <jay.p.patel@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/282852


Reviewed-by: default avatarEric Caruso <ejcaruso@chromium.org>
Tested-by: default avatarPrathyushi Nangia <prathyushi.nangia@intel.com>
parent dc76226d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment