summaryrefslogtreecommitdiff
path: root/pm
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-03-19 19:50:53 -0500
committerVictor Lowther <victor.lowther@gmail.com>2008-03-19 19:50:53 -0500
commit616c86edd7030f3cb1eaf7e08444f8882830977a (patch)
tree7f2d0a2f7f6ef70c1155459303fb29340b9c9700 /pm
parent53743fa7e2f1248fcaf1e6fe62a8390dcfadffcf (diff)
parent2d224fc56941d6c6c65b51d0e9943b331b8e69b8 (diff)
Merge branch 'master' into vlowther-stabilization-bugfixes
Diffstat (limited to 'pm')
-rw-r--r--pm/module.d/README.uswsusp6
-rwxr-xr-xpm/module.d/kernel9
-rwxr-xr-xpm/module.d/tuxonice9
-rwxr-xr-xpm/module.d/uswsusp56
-rwxr-xr-xpm/sleep.d/99video6
5 files changed, 68 insertions, 18 deletions
diff --git a/pm/module.d/README.uswsusp b/pm/module.d/README.uswsusp
deleted file mode 100644
index 836d7ce..0000000
--- a/pm/module.d/README.uswsusp
+++ /dev/null
@@ -1,6 +0,0 @@
-Currently, the uswsusp module does not use s2ram and forces s2both to skip
-the video quirk handling it implements internally. This is because we already
-handle video quirks in 20video and 99video.
-
-If you would prefer to use the s2ram/s2both video quirk handling, edit
-uswsusp appropriately and delete pm/sleep.d/20video and pm/sleep.d/99video.
diff --git a/pm/module.d/kernel b/pm/module.d/kernel
index dc6724e..9a6b5ad 100755
--- a/pm/module.d/kernel
+++ b/pm/module.d/kernel
@@ -2,12 +2,17 @@
check_suspend()
{
- grep -q mem /sys/power/state
+ [ -e /dev/pmu ] && return 0
+ grep -q mem /sys/power/state && return 0
}
do_suspend()
{
- pm-pmu --suspend || echo -n "mem" > /sys/power/state
+ if [ -e /dev/pmu ]; then
+ pm-pmu --suspend
+ else
+ echo -n "mem" > /sys/power/state
+ fi
}
check_hibernate()
diff --git a/pm/module.d/tuxonice b/pm/module.d/tuxonice
index 568faec..cc32f60 100755
--- a/pm/module.d/tuxonice
+++ b/pm/module.d/tuxonice
@@ -13,12 +13,17 @@ done
check_suspend()
{
- grep -q mem /sys/power/state
+ [ -e /dev/pmu ] && return 0
+ grep -q mem /sys/power/state && return 0
}
do_suspend()
{
- echo "mem" >/sys/power/state
+ if [ -e /dev/pmu ]; then
+ pm-pmu --suspend
+ else
+ echo -n "mem" > /sys/power/state
+ fi
}
check_hibernate()
diff --git a/pm/module.d/uswsusp b/pm/module.d/uswsusp
index 711761c..371bb04 100755
--- a/pm/module.d/uswsusp
+++ b/pm/module.d/uswsusp
@@ -6,14 +6,42 @@ before_hooks()
disablehook 99video "disabled by uswsusp"
}
+get_quirks()
+{
+ OPTS=""
+ ACPI_SLEEP=0
+ for opt in $PM_CMDLINE; do
+ case "${opt##--quirk-}" in # just quirks, please
+ dpms-on) ;; # no-op
+ dpms-suspend) ;; # no-op
+ radeon-off) OPTS="$OPTS --radeontool" ;;
+ reset-brightness) ;; # no-op
+ s3-bios) ACPI_SLEEP=$((ACPI_SLEEP + 1)) ;;
+ s3-mode) ACPI_SLEEP=$((ACPI_SLEEP + 2)) ;;
+ vbe-post) OPTS="$OPTS --vbe_post" ;;
+ vbemode-restore) OPTS="$OPTS --vbe_mode" ;;
+ vbestate-restore) OPTS="$OPTS --vbe_save" ;;
+ vga-mode3) ;; # no-op
+ save-pci) OPTS="$OPTS --pci_save" ;;
+ none) QUIRK_NONE="true" ;;
+ *) continue ;;
+ esac
+ done
+ [ $ACPI_SLEEP -ne 0 ] && OPTS="$OPTS --acpi_sleep $ACPI_SLEEP"
+ # if we were told to ignore quirks, do so.
+ [ "$QUIRK_NONE" = "true" ] && OPTS=""
+}
+
check_suspend()
{
- grep -q mem /sys/power/state
+ [ -e /dev/pmu ] && return 0
+ grep -q mem /sys/power/state && return 0
}
do_suspend()
{
- echo "mem" >/sys/power/state
+ get_quirks
+ s2ram --force $OPTS
}
check_hibernate()
@@ -38,7 +66,25 @@ check_suspend_hybrid()
do_suspend_hybrid()
{
- # a brief perusal of the source indicates that -f bypasses
- # quirks application and the whitelist.
- s2both -f
+ get_quirks
+ s2both --force $OPTS
+}
+
+sleep_method_help()
+{
+ echo # first echo makes it look nicer.
+ echo "Video quirk handler options:"
+ echo
+ echo " --quirk-dpms-on"
+ echo " --quirk-dpms-suspend"
+ echo " --quirk-radeon-off"
+ echo " --quirk-reset-brightness"
+ echo " --quirk-s3-bios"
+ echo " --quirk-s3-mode"
+ echo " --quirk-vbe-post"
+ echo " --quirk-vbemode-restore"
+ echo " --quirk-vbestate-restore"
+ echo " --quirk-vga-mode3"
+ echo " --quirk-save-pci"
+ echo " --quirk-none"
}
diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video
index 690a4dd..1663dff 100755
--- a/pm/sleep.d/99video
+++ b/pm/sleep.d/99video
@@ -89,9 +89,9 @@ suspend_video()
{
# 0=nothing, 1=s3_bios, 2=s3_mode, 3=both
local acpi_flag=0
- [ "${QUIRK_S3_BIOS}" = "true" ] && acpi_flag=$(($acpi_flag + 1))
- [ "${QUIRK_S3_MODE}" = "true" ] && acpi_flag=$(($acpi_flag + 2))
- sysctl -w kernel.acpi_video_flags=$acpi_flag
+ quirk "${QUIRK_S3_BIOS}" && acpi_flag=$(($acpi_flag + 1))
+ quirk "${QUIRK_S3_MODE}" && acpi_flag=$(($acpi_flag + 2))
+ [ 0 -ne $acpi_flag ] && sysctl -w kernel.acpi_video_flags=$acpi_flag
quirk "${QUIRK_VBESTATE_RESTORE}" && vbe_savestate
quirk "${QUIRK_VBEMODE_RESTORE}" && vbe_savemode