2 Haiku ATI video driver adapted from the X.org ATI driver.
4 Copyright 1992,1993,1994,1995,1996,1997 by Kevin E. Martin, Chapel Hill, North Carolina.
5 Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org
7 Copyright 2009 Haiku, Inc. All rights reserved.
8 Distributed under the terms of the MIT license.
15 #include "accelerant.h"
21 Mach64_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 Mach64_GetDPMSMode(void)
32 // Return the current DPMS mode.
34 uint32 tmp
= INREG(CRTC_GEN_CNTL
);
37 if( (tmp
& CRTC_DISPLAY_DIS
) == 0 )
39 else if( (tmp
& CRTC_VSYNC_DIS
) == 0 )
40 mode
= B_DPMS_STAND_BY
;
41 else if( (tmp
& CRTC_HSYNC_DIS
) == 0 )
42 mode
= B_DPMS_SUSPEND
;
46 TRACE("Mach64_DPMSMode() mode: %d\n", mode
);
52 Mach64_SetDPMSMode(uint32 dpmsMode
)
54 // Set the display into one of the Display Power Management modes,
55 // and return B_OK if successful, else return B_ERROR.
57 TRACE("Mach64_SetDPMSMode() mode: %d, display type: %d\n", dpmsMode
, gInfo
.sharedInfo
->displayType
);
59 int mask
= (CRTC_HSYNC_DIS
| CRTC_VSYNC_DIS
);
63 // Screen: On; HSync: On, VSync: On.
64 OUTREGM(CRTC_GEN_CNTL
, 0, mask
);
68 // Screen: Off; HSync: Off, VSync: On.
69 OUTREGM(CRTC_GEN_CNTL
, CRTC_HSYNC_DIS
, mask
);
73 // Screen: Off; HSync: On, VSync: Off.
74 OUTREGM(CRTC_GEN_CNTL
, CRTC_VSYNC_DIS
, mask
);
78 // Screen: Off; HSync: Off, VSync: Off.
79 OUTREGM(CRTC_GEN_CNTL
, mask
, mask
);
83 TRACE("Invalid DPMS mode %d\n", dpmsMode
);
87 if (gInfo
.sharedInfo
->displayType
== MT_LAPTOP
) {
88 uint32 powerMgmt
= (Mach64_GetLCDReg(LCD_POWER_MANAGEMENT
)
89 & ~(STANDBY_NOW
| SUSPEND_NOW
| POWER_BLON
| AUTO_POWER_UP
));
93 powerMgmt
|= (POWER_BLON
| AUTO_POWER_UP
);
97 powerMgmt
|= STANDBY_NOW
;
101 powerMgmt
|= SUSPEND_NOW
;
105 powerMgmt
|= STANDBY_NOW
| SUSPEND_NOW
;
109 Mach64_PutLCDReg(LCD_POWER_MANAGEMENT
, powerMgmt
);