summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-09-09 14:48:56 -0500
committerVictor Lowther <victor.lowther@gmail.com>2008-09-09 14:48:56 -0500
commit7da41036e8c8555fea8eeddfa66307d798bcf87d (patch)
treea11a1d3f9b13f46fd0c6f38a1baa3b3bb71fb4be
parent6ab65e737b0d70c97cabb4cd795909115cbd7591 (diff)
Added support for the nofb and pci_save HAL quirks.
Right now there are no entries in any of the .fdi files that specify use of these quirks, which is why they were probably never implemented in pm-utils.
-rwxr-xr-xpm/sleep.d/99video38
1 files changed, 37 insertions, 1 deletions
diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video
index b927a1b..dc8590a 100755
--- a/pm/sleep.d/99video
+++ b/pm/sleep.d/99video
@@ -26,6 +26,8 @@ for opt in $PM_CMDLINE; do
vbemode-restore) QUIRK_VBEMODE_RESTORE="true" ;;
vbestate-restore) QUIRK_VBESTATE_RESTORE="true" ;;
vga-mode3) QUIRK_VGA_MODE_3="true" ;;
+ no-fb) QUIRK_NOFB="true" ;;
+ pci-save) QUIRK_PCI_SAVE="true" ;;
none) QUIRK_NONE="true" ;;
*) continue ;;
esac
@@ -53,6 +55,15 @@ else
radeon() { echo "radeontool not found" 1>&2; return 1; }
fi
+die_if_framebuffer()
+{
+ [ -d "/sys/class/graphics/fb0" ] || return
+ echo "--quirk-no-fb passed, but system is using a framebuffer."
+ echo "Aborting."
+ exit 1
+}
+
+
save_fbcon()
{
local con
@@ -105,6 +116,28 @@ vbe_post()
radeon_off() { radeon dac off; radeon light off; }
radeon_on() { radeon dac on; radeon light on; }
+# save and restore video card PCI config state
+save_pci()
+{
+ local pci="/sys/bus/pci/devices"
+ for dev in "${pci}"/*; do
+ [ -f "${dev}/class" ] || continue
+ [ $(cat "${dev}/class") = "0x030000" ] || continue
+ [ -f "${dev}/config" ] || continue
+ # it is a video card, it has a configuration. Save it.
+ savestate "pci_video_${dev##*/}" <${dev}/config
+ done
+}
+
+restore_pci()
+{
+ local pci="/sys/bus/pci/devices"
+ for dev in "${pci}"/*; do
+ state_exists "pci_video_${dev##*/}" || continue
+ restorestate "pci_video_${dev##*/}" > "${dev}/config"
+ done
+}
+
suspend_video()
{
# 0=nothing, 1=s3_bios, 2=s3_mode, 3=both
@@ -113,16 +146,19 @@ suspend_video()
quirk "${QUIRK_S3_MODE}" && acpi_flag=$(($acpi_flag + 2))
[ 0 -ne $acpi_flag ] && sysctl -w kernel.acpi_video_flags=$acpi_flag
+ quirk "${QUIRK_NOFB}" && die_if_framebuffer
quirk "${QUIRK_VBESTATE_RESTORE}" && vbe_savestate
quirk "${QUIRK_VBEMODE_RESTORE}" && vbe_savemode
quirk "${QUIRK_RADEON_OFF}" && radeon_off
+ quirk "${QUIRK_PCI_SAVE}" && pci_save
quirk "${QUIRK_VGA_MODE_3}" && vbe vbemode set 3
quirk "${QUIRK_DPMS_SUSPEND}" && vbe dpms suspend
- save_fbcon # there should be a quirk, but HAL does not pass it.
+ save_fbcon
}
resume_video()
{
# We might need to do one or many of these quirks
+ quirk "${QUIRK_PCI_SAVE}" && pci_restore
quirk "${QUIRK_VBE_POST}" && vbe_post
quirk "${QUIRK_VBESTATE_RESTORE}" && vbe_restorestate
quirk "${QUIRK_VBEMODE_RESTORE}" && vbe_restoremode