blob: 1043e94c70da3de210334428b28716dbec526bdb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#!/bin/sh
#
# Copyright 2008 Victor Lowther <victor.lowther@gmail.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.
. "${PM_FUNCTIONS}"
# Test to see if the kernel has a video driver that is smart enough to
# handle quirks without external assistance. If it is, remove the quirks.
smart_kernel_nvidia()
{
# despite the bad rep the nvidia driver has, it is miles better than
# any other video driver when it comes to handling power managment and
# suspend/resume in a quirk-free manner.
[ -d /sys/module/nvidia ] || return 1
remove_parameters --quirk-dpms-on \
--quirk-dpms-suspend \
--quirk-s3-mode \
--quirk-s3-bios \
--quirk-vbe-post \
--quirk-vbe-post \
--quirk-vga-mode3 \
--quirk-vbemode-restore \
--quirk-vbestate-restore \
--quirk-reset-brightness \
--quirk-radeon-off \
--quirk-no-fb \
--quirk-pci-save
}
smart_kernel_fglrx()
{
# the ATI driver is pretty good about it, too.
[ -d /sys/module/fglrx ] || return 1
remove_parameters --quirk-dpms-on \
--quirk-dpms-suspend \
--quirk-s3-mode \
--quirk-s3-bios \
--quirk-vbe-post \
--quirk-vbe-post \
--quirk-vga-mode3 \
--quirk-vbemode-restore \
--quirk-vbestate-restore \
--quirk-reset-brightness \
--quirk-radeon-off \
--quirk-no-fb \
--quirk-pci-save
}
smart_kernel_intel()
{
# currently, intel kernel modesetting is not quite smart enough
# we still need acpi s3 kernel modesetting hooks, so don't remove those
# options if they were passed.
[ -d /sys/module/i915 ] || return 1
local kernel_rev="$(uname -r |awk -F '[_-]' '{print $1}')"
[ "$kernel_rev" \> "2.6.26" -o "$kernel_rev" = "2.6.26" ] || return 1
remove_parameters --quirk-dpms-on \
--quirk-dpms-suspend \
--quirk-vbe-post \
--quirk-vbe-post \
--quirk-vga-mode3 \
--quirk-vbemode-restore \
--quirk-vbestate-restore \
--quirk-reset-brightness \
--quirk-radeon-off \
--quirk-no-fb \
--quirk-pci-save
}
smart_kernel_video()
{
smart_kernel_nvidia || smart_kernel_fglrx || smart_kernel_intel || \
return $NA
}
case $1 in
suspend|hibernate)
smart_kernel_video ;;
*) exit 0 ;;
esac
|