2 Haiku ATI video driver adapted from the X.org ATI driver.
4 Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
5 Precision Insight, Inc., Cedar Park, Texas, and
6 VA Linux Systems Inc., Fremont, California.
8 Copyright 2009 Haiku, Inc. All rights reserved.
9 Distributed under the terms of the MIT license.
16 #include "accelerant.h"
22 Rage128_DPMSCapabilities(void)
24 // Return DPMS modes supported by this device.
26 return B_DPMS_ON
| B_DPMS_STAND_BY
| B_DPMS_SUSPEND
| B_DPMS_OFF
;
31 Rage128_GetDPMSMode(void)
33 // Return the current DPMS mode.
35 uint32 tmp
= INREG(R128_CRTC_EXT_CNTL
);
38 if( (tmp
& R128_CRTC_DISPLAY_DIS
) == 0 )
40 else if( (tmp
& R128_CRTC_VSYNC_DIS
) == 0 )
41 mode
= B_DPMS_STAND_BY
;
42 else if( (tmp
& R128_CRTC_HSYNC_DIS
) == 0 )
43 mode
= B_DPMS_SUSPEND
;
47 TRACE("Rage128_DPMSMode() mode: %d\n", mode
);
53 Rage128_SetDPMSMode(uint32 dpmsMode
)
55 // Set the display into one of the Display Power Management modes,
56 // and return B_OK if successful, else return B_ERROR.
58 SharedInfo
& si
= *gInfo
.sharedInfo
;
60 TRACE("Rage128_SetDPMSMode() mode: %d, display type: %d\n", dpmsMode
, si
.displayType
);
62 int mask
= (R128_CRTC_DISPLAY_DIS
64 | R128_CRTC_VSYNC_DIS
);
68 // Screen: On; HSync: On, VSync: On.
69 OUTREGM(R128_CRTC_EXT_CNTL
, 0, mask
);
73 // Screen: Off; HSync: Off, VSync: On.
74 OUTREGM(R128_CRTC_EXT_CNTL
,
75 R128_CRTC_DISPLAY_DIS
| R128_CRTC_HSYNC_DIS
, mask
);
79 // Screen: Off; HSync: On, VSync: Off.
80 OUTREGM(R128_CRTC_EXT_CNTL
,
81 R128_CRTC_DISPLAY_DIS
| R128_CRTC_VSYNC_DIS
, mask
);
85 // Screen: Off; HSync: Off, VSync: Off.
86 OUTREGM(R128_CRTC_EXT_CNTL
, mask
, mask
);
90 TRACE("Invalid DPMS mode %d\n", dpmsMode
);
94 if (si
.displayType
== MT_LAPTOP
) {
99 genCtrl
= INREG(R128_LVDS_GEN_CNTL
);
100 genCtrl
|= R128_LVDS_ON
| R128_LVDS_EN
| R128_LVDS_BLON
| R128_LVDS_DIGON
;
101 genCtrl
&= ~R128_LVDS_DISPLAY_DIS
;
102 OUTREG(R128_LVDS_GEN_CNTL
, genCtrl
);
105 case B_DPMS_STAND_BY
:
108 genCtrl
= INREG(R128_LVDS_GEN_CNTL
);
109 genCtrl
|= R128_LVDS_DISPLAY_DIS
;
110 OUTREG(R128_LVDS_GEN_CNTL
, genCtrl
);
112 genCtrl
&= ~(R128_LVDS_ON
| R128_LVDS_EN
| R128_LVDS_BLON
| R128_LVDS_DIGON
);
113 OUTREG(R128_LVDS_GEN_CNTL
, genCtrl
);
117 TRACE("Invalid DPMS mode %d\n", dpmsMode
);
122 if (gInfo
.sharedInfo
->displayType
== MT_DVI
) {
125 OUTREG(R128_FP_GEN_CNTL
, INREG(R128_FP_GEN_CNTL
)
126 | (R128_FP_FPON
| R128_FP_TDMS_EN
));
129 case B_DPMS_STAND_BY
:
132 OUTREG(R128_FP_GEN_CNTL
, INREG(R128_FP_GEN_CNTL
)
133 & ~(R128_FP_FPON
| R128_FP_TDMS_EN
));
137 TRACE("Invalid DPMS mode %d\n", dpmsMode
);