2 Haiku S3 Savage driver adapted from the X.org Savage driver.
4 Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
5 Copyright (c) 2003-2006, X.Org Foundation
7 Copyright 2007-2008 Haiku, Inc. All rights reserved.
8 Distributed under the terms of the MIT license.
11 Gerald Zajac 2006-2008
21 Savage_DPMSCapabilities(void)
23 // Return DPMS modes supported by this device.
25 return B_DPMS_ON
| B_DPMS_STAND_BY
| B_DPMS_SUSPEND
| B_DPMS_OFF
;
30 Savage_GetDPMSMode(void)
32 // Return the current DPMS mode.
34 // Note: I do not know whether the following code is correctly reading
35 // the current DPMS mode. I'm assuming that reading back the bits that
36 // were set by function SET_DPMS_MODE will give the current DPMS mode.
38 SharedInfo
& si
= *gInfo
.sharedInfo
;
39 uint32 mode
= B_DPMS_ON
;
41 if (si
.displayType
== MT_CRT
) {
42 switch (ReadSeqReg(0x0d) & 0x70) {
47 mode
= B_DPMS_STAND_BY
;
50 mode
= B_DPMS_SUSPEND
;
56 TRACE("Unknown DPMS mode, reg sr0D: 0x%X\n", ReadSeqReg(0x0d));
58 } else if (si
.displayType
== MT_LCD
|| si
.displayType
== MT_DFP
) {
59 mode
= ((ReadSeqReg(0x31) & 0x10) ? B_DPMS_ON
: B_DPMS_OFF
);
62 TRACE("Savage_GetDPMSMode() mode: %d\n", mode
);
68 Savage_SetDPMSMode(uint32 dpmsMode
)
70 // Set the display into one of the Display Power Management modes,
71 // and return B_OK if successful, else return B_ERROR.
73 SharedInfo
& si
= *gInfo
.sharedInfo
;
75 TRACE("Savage_SetDPMSMode() mode: %d, display type: %d\n", dpmsMode
, si
.displayType
);
77 if (si
.displayType
== MT_CRT
) {
78 WriteSeqReg(0x08, 0x06); // unlock extended sequencer regs
80 uint8 sr0D
= ReadSeqReg(0x0d) & 0x03;
95 TRACE("Invalid DPMS mode %d\n", dpmsMode
);
99 WriteSeqReg(0x0d, sr0D
);
100 } else if (si
.displayType
== MT_LCD
|| si
.displayType
== MT_DFP
) {
103 WriteSeqReg(0x31, 0x10, 0x10); // SR31 bit 4 - FP enable
105 case B_DPMS_STAND_BY
:
108 WriteSeqReg(0x31, 0x00, 0x10); // SR31 bit 4 - FP enable
111 TRACE("Invalid DPMS mode %d\n", dpmsMode
);