[Pm-utils] [PATCH]: Support in-kernel suspend to both (i.e. hybrid suspend)

Bojan Smojver bojan at rexursive.com
Thu Jun 28 02:21:27 PDT 2012


Hi,

The in-kernel suspend to both should surface soon (hopefully in 3.6), so
here is a patch (untested) for pm-utils.

-------------------------
 pm/pm-functions.in |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/pm/pm-functions.in b/pm/pm-functions.in
index c82be30..50cde73 100644
--- a/pm/pm-functions.in
+++ b/pm/pm-functions.in
@@ -317,6 +317,20 @@ if [ -z "$HIBERNATE_MODULE" ] && \
 	}
 fi
 
+# for kernels that support suspend to both (i.e hybrid suspend)
+# since kernel 3.6
+if [ -z "$SUSPEND_HYBRID_MODULE" ] && \
+	[ -f /sys/power/disk ] && \
+	grep -q disk /sys/power/state && \
+	grep -q suspend /sys/power/disk; then
+	SUSPEND_HYBRID_MODULE="kernel"
+	do_suspend_hybrid()
+	{
+		HIBERNATE_MODE="suspend"
+		do_hibernate
+	}
+fi
+
 # since the kernel does not directly support hybrid sleep, we do
 # something else -- suspend and schedule an alarm to go into
 # hibernate if we have slept long enough.
-------------------------

-- 
Bojan



More information about the Pm-utils mailing list