summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Paik2018-01-03 22:27:58 -0600
committerSteve Paik2018-01-19 14:30:39 -0600
commit10b149f18f1751e98c750b91e11adb51fb7bb836 (patch)
tree13118618e524bea94c7a21517f3a32e82b219ecf /libsuspend/include
parent765516ecafced7f7cb82c992dee810583890ea2d (diff)
downloadplatform-system-core-10b149f18f1751e98c750b91e11adb51fb7bb836.tar.gz
platform-system-core-10b149f18f1751e98c750b91e11adb51fb7bb836.tar.xz
platform-system-core-10b149f18f1751e98c750b91e11adb51fb7bb836.zip
Add force_suspend function
This CL implements a simple force_suspend(). This function takes a timeoutMs argument that is currently ignored. It also uses a two-stage init process that spawns the suspend_thread when autosuspend is in use. Follow-up CLs will: - Implement file locking to prevent multiple libsuspend instances from starting multiple suspend threads in the system. - Fully implement timout for force_suspend. - Integrate force_suspend with suspend_thred. Bug: 70669809 Test: autosuspend still works Change-Id: I6b2c72d0c61d1bec6db0f0b28481ffe0e20ec615
Diffstat (limited to 'libsuspend/include')
-rw-r--r--libsuspend/include/suspend/autosuspend.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libsuspend/include/suspend/autosuspend.h b/libsuspend/include/suspend/autosuspend.h
index e130ca3df..21f4d61bf 100644
--- a/libsuspend/include/suspend/autosuspend.h
+++ b/libsuspend/include/suspend/autosuspend.h
@@ -45,6 +45,17 @@ int autosuspend_enable(void);
45int autosuspend_disable(void); 45int autosuspend_disable(void);
46 46
47/* 47/*
48 * force_suspend
49 *
50 * Forces suspend to happen. timeout_ms is used to give system a chance to suspend gracefully.
51 * When timeout expires, suspend will be forced via mem --> /sys/power/state. timeout_ms of 0
52 * will force suspend immediately.
53 *
54 * Returns 0 if system suspended, -1 if suspend did not occur.
55 */
56int autosuspend_force_suspend(int timeout_ms);
57
58/*
48 * set_wakeup_callback 59 * set_wakeup_callback
49 * 60 *
50 * Set a function to be called each time the device returns from suspend. 61 * Set a function to be called each time the device returns from suspend.