diff options
author | Jordan Crouse <jordan.crouse@amd.com> | 2006-01-06 03:12:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:39 -0500 |
commit | 3841b0a173cb6fc52163e67c03280543f2412db3 (patch) | |
tree | 38b55ab607add98d3423e6b6b7ef63c1b8a19b47 /arch/i386/kernel/apm.c | |
parent | a7a4ad0998dcd682f4968e8ec5fc1259914a1c4a (diff) |
[PATCH] APM Screen Blanking fix
- Fix screen blanking on BIOSes that return APM_NOT_ENGAGED when APM enabled
screen blanking is not turned on.
The original code only tried to set the state on device 0x100, and then
0x1FF, and I added 0x101 to the mix too.
- Clean up logic in apm_console_blank().
- Prevent the error message from printing out twice.
Cc: Jordan Crouse <jordan.crouse@amd.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/apm.c')
-rw-r--r-- | arch/i386/kernel/apm.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index d0b488056cc4..2d793d4aef1a 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c | |||
@@ -1064,22 +1064,23 @@ static int apm_engage_power_management(u_short device, int enable) | |||
1064 | 1064 | ||
1065 | static int apm_console_blank(int blank) | 1065 | static int apm_console_blank(int blank) |
1066 | { | 1066 | { |
1067 | int error; | 1067 | int error, i; |
1068 | u_short state; | 1068 | u_short state; |
1069 | static const u_short dev[3] = { 0x100, 0x1FF, 0x101 }; | ||
1069 | 1070 | ||
1070 | state = blank ? APM_STATE_STANDBY : APM_STATE_READY; | 1071 | state = blank ? APM_STATE_STANDBY : APM_STATE_READY; |
1071 | /* Blank the first display device */ | 1072 | |
1072 | error = set_power_state(0x100, state); | 1073 | for (i = 0; i < ARRAY_SIZE(dev); i++) { |
1073 | if ((error != APM_SUCCESS) && (error != APM_NO_ERROR)) { | 1074 | error = set_power_state(dev[i], state); |
1074 | /* try to blank them all instead */ | 1075 | |
1075 | error = set_power_state(0x1ff, state); | 1076 | if ((error == APM_SUCCESS) || (error == APM_NO_ERROR)) |
1076 | if ((error != APM_SUCCESS) && (error != APM_NO_ERROR)) | 1077 | return 1; |
1077 | /* try to blank device one instead */ | 1078 | |
1078 | error = set_power_state(0x101, state); | 1079 | if (error == APM_NOT_ENGAGED) |
1080 | break; | ||
1079 | } | 1081 | } |
1080 | if ((error == APM_SUCCESS) || (error == APM_NO_ERROR)) | 1082 | |
1081 | return 1; | 1083 | if (error == APM_NOT_ENGAGED && state != APM_STATE_READY) { |
1082 | if (error == APM_NOT_ENGAGED) { | ||
1083 | static int tried; | 1084 | static int tried; |
1084 | int eng_error; | 1085 | int eng_error; |
1085 | if (tried++ == 0) { | 1086 | if (tried++ == 0) { |