summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-05-16 21:12:47 -0500
committerVictor Lowther <victor.lowther@gmail.com>2008-05-16 21:12:47 -0500
commit8c366f223d8db7143ef7c458f0503655af5716b6 (patch)
treec39c20219628e80e35497c9c32bf8bf1f0ec12bb
parent57d53b3bcb4aa218a63b48d14dc5ca0a1caad99a (diff)
Split smart kernel video driver handling to a different hook.
The new 98-smart-kernel-video hook just disables 99video outright if we are running a video driver that is spart enough to handle its own quirks.
-rwxr-xr-xpm/sleep.d/98smart-kernel-video36
-rwxr-xr-xpm/sleep.d/99video18
-rw-r--r--pm/sleep.d/Makefile.am1
3 files changed, 37 insertions, 18 deletions
diff --git a/pm/sleep.d/98smart-kernel-video b/pm/sleep.d/98smart-kernel-video
new file mode 100755
index 0000000..d638bc4
--- /dev/null
+++ b/pm/sleep.d/98smart-kernel-video
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Copyright 2006-2007 Richard Hughes <richard@hughsie.com>
+# Copyright 2007 Peter Jones <pjones@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+
+# Handle video quirks. If you are having suspend/resume issues,
+# troubleshooting using this hook is probably the best place to start.
+# If it weren't for video card quirks, suspend/resume on Linux would be
+# a whole lot more stable.
+
+. "${PM_FUNCTIONS}"
+
+
+# Test to see if the kernel has a video driver that is smart enough
+# to handle quirks without external assistance.
+smart_kernel_video()
+{
+ # If we are using an ATI or nVidia binary driver, do nothing.
+ [ -d /sys/module/nvidia -o -d /sys/module/fglrx ] && return 0;
+
+ local kernel_rev="$(uname -r |awk -F '[_-]' '{print $1}')"
+ # Intel can to the same thing, but only at or after kernel 2.6.26.
+ # FIXME: a more accurate way of testing this?
+ [ -d /sys/module/i915 ] && \
+ [ "$kernel_rev" >= "2.6.26" ] && return 0;
+ return 1
+}
+
+case $1 in
+ suspend|hibernate) smart_kernel_video && disablehook 99video ;;
+ *) exit 0 ;;
+esac \ No newline at end of file
diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video
index 31e6de7..b927a1b 100755
--- a/pm/sleep.d/99video
+++ b/pm/sleep.d/99video
@@ -31,7 +31,6 @@ for opt in $PM_CMDLINE; do
esac
done
-
reset_brightness()
{
for bl in /sys/class/backlight/* ; do
@@ -106,21 +105,6 @@ vbe_post()
radeon_off() { radeon dac off; radeon light off; }
radeon_on() { radeon dac on; radeon light on; }
-# Test to see if the kernel has a video driver that is smart enough
-# to handle quirks without external assistance.
-smart_kernel_video()
-{
- # If we are using an ATI or nVidia binary driver, do nothing.
- [ -d /sys/module/nvidia -o -d /sys/module/fglrx ] && return 0;
-
- local kernel_rev="$(uname -r |awk -F '[_-]' '{print $1}')"
- # Intel can to the same thing, but only at or after kernel 2.6.26.
- # FIXME: a more accurate way of testing this?
- [ -d /sys/module/i915 ] && \
- [ "$kernel_rev" >= "2.6.26" ] && return 0;
- return 1
-}
-
suspend_video()
{
# 0=nothing, 1=s3_bios, 2=s3_mode, 3=both
@@ -128,7 +112,6 @@ suspend_video()
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
- smart_kernel_video && return
quirk "${QUIRK_VBESTATE_RESTORE}" && vbe_savestate
quirk "${QUIRK_VBEMODE_RESTORE}" && vbe_savemode
@@ -139,7 +122,6 @@ suspend_video()
}
resume_video()
{
- smart_kernel_video && return
# We might need to do one or many of these quirks
quirk "${QUIRK_VBE_POST}" && vbe_post
quirk "${QUIRK_VBESTATE_RESTORE}" && vbe_restorestate
diff --git a/pm/sleep.d/Makefile.am b/pm/sleep.d/Makefile.am
index 4555fe6..5a9693c 100644
--- a/pm/sleep.d/Makefile.am
+++ b/pm/sleep.d/Makefile.am
@@ -12,6 +12,7 @@ sleep_SCRIPTS = \
90clock \
94cpufreq \
95led \
+ 98smart-kernel-video \
99video
EXTRA_DIST=$(sleep_SCRIPTS)