autosuspend calls the presuspend check when the kernel locks are clear,
and it hasn't been called recently. If we always call it, there's a risk
that running all checks could take too long and we'll fail to suspend
often.
Successfully exiting means that there is nothing going on, so the system is
free to suspend within a reasonable timeframe (something like < 10 seconds).
All the checks currently use the (default) delay wait mechanism, but I
would like to try to write others. For example `playerctl -F` could be
used when playerctl is blocking suspend. Unfortunately managing spawned
jobs and race conditions is harder than it seems at first glance.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Mostly a cleanup. We now have sxmo_wakeup.sh so the hook should bear
that name somehow (although sxmo_hook_suspendblockers might fit too)
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
The approach sxmo_wakeafter uses is flawed because the kernel isn't
obligated to pass control to it after suspend. I'm pretty sure it
normally gets called when the kernel updates the system clock.
Since we're waiting for some time after every suspend we're not actually
using opportunistic suspend. It's much simpler to read wakeup_count to
ask the kernel to wait until there's no active locks.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>