blob: 911896c761bcf53d91ed873d48b937ad4c9a2b6a (
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
|
#!/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}"
remove_all_video_quirks()
{
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
}
# 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.
have_kms()
{
# if we are running with a KMS-enabled video driver, we should not
# attempt to run any quirks
[ -d /sys/class/drm/card0/device/graphics/fb0 ] || return 1
remove_all_video_quirks
add_parameters --quirk-no-chvt
}
have_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_all_video_quirks
}
have_fglrx()
{
# the ATI driver is pretty good about it, too.
[ -d /sys/module/fglrx ] || return 1
remove_all_video_quirks
}
have_smart_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()
{
have_kms || have_nvidia || have_fglrx || have_smart_intel || return $NA
}
case $1 in
suspend|hibernate)
smart_kernel_video ;;
*) exit 0 ;;
esac
|