[PATCH r128] Move display enabling code to DPMS

Connor Behan connor.behan at gmail.com
Wed Jul 9 02:23:25 PDT 2014


This ensures that DAC, TMDS and LVDS enable bits are properly saved and
only set in the dpms hook.

Signed-off-by: Connor Behan <connor.behan at gmail.com>
---
 src/r128_driver.c | 10 ++--------
 src/r128_output.c | 18 ++++++++++++++++--
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/r128_driver.c b/src/r128_driver.c
index 8e15b0c..4c03060 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -3083,9 +3083,7 @@ Bool R128InitCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr save,
                                   R128_CRTC_INTERLACE_EN);
     }
 
-    save->crtc_ext_cntl = R128_VGA_ATI_LINEAR |
-			      R128_XCRT_CNT_EN |
-			      R128_CRTC_CRT_ON;
+    save->crtc_ext_cntl |= R128_VGA_ATI_LINEAR | R128_XCRT_CNT_EN;
 
     if(info->isDFP && !info->isPro2)
     {
@@ -3332,9 +3330,7 @@ void R128InitFPRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr outpu
                                      R128_FP_CRT_SYNC_SEL |
                                      R128_FP_USE_SHADOW_EN);
 
-    save->fp_gen_cntl           |=  (R128_FP_FPON |
-                                     R128_FP_TDMS_EN |
-                                     R128_FP_CRTC_DONT_SHADOW_VPAR |
+    save->fp_gen_cntl           |=  (R128_FP_CRTC_DONT_SHADOW_VPAR |
                                      R128_FP_CRTC_DONT_SHADOW_HEND);
 
     save->fp_panel_cntl         |=  (R128_FP_DIGON | R128_FP_BLON);
@@ -3354,8 +3350,6 @@ void R128InitLVDSRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr out
         save->lvds_gen_cntl |=  R128_LVDS_SEL_CRTC2;
     else
         save->lvds_gen_cntl &= ~R128_LVDS_SEL_CRTC2;
-
-    save->lvds_gen_cntl     |= (R128_LVDS_ON | R128_LVDS_BLON);
 }
 
 /* Define PLL registers for requested video mode. */
diff --git a/src/r128_output.c b/src/r128_output.c
index 4638067..79c80bf 100644
--- a/src/r128_output.c
+++ b/src/r128_output.c
@@ -176,15 +176,22 @@ void R128DPMSSetOn(xf86OutputPtr output)
     unsigned char *R128MMIO = info->MMIO;
     R128OutputPrivatePtr r128_output = output->driver_private;
     R128MonitorType MonType = r128_output->MonType;
+    R128SavePtr save = &info->ModeReg;
 
     switch(MonType) {
     case MT_LCD:
         OUTREGP(R128_LVDS_GEN_CNTL, R128_LVDS_BLON, ~R128_LVDS_BLON);
         usleep(info->PanelPwrDly * 1000);
         OUTREGP(R128_LVDS_GEN_CNTL, R128_LVDS_ON, ~R128_LVDS_ON);
+        save->lvds_gen_cntl |=     (R128_LVDS_ON | R128_LVDS_BLON);
         break;
     case MT_DFP:
-        OUTREGP(R128_FP_GEN_CNTL, (R128_FP_FPON | R128_FP_TDMS_EN), ~(R128_FP_FPON | R128_FP_TDMS_EN));
+        OUTREGP(R128_FP_GEN_CNTL,  (R128_FP_FPON | R128_FP_TDMS_EN), ~(R128_FP_FPON | R128_FP_TDMS_EN));
+        save->fp_gen_cntl   |=     (R128_FP_FPON | R128_FP_TDMS_EN);
+        break;
+    case MT_CRT:
+        OUTREGP(R128_CRTC_EXT_CNTL, R128_CRTC_CRT_ON, ~R128_CRTC_CRT_ON);
+        save->crtc_ext_cntl |=      R128_CRTC_CRT_ON;
         break;
     default:
         break;
@@ -198,13 +205,20 @@ void R128DPMSSetOff(xf86OutputPtr output)
     unsigned char *R128MMIO = info->MMIO;
     R128OutputPrivatePtr r128_output = output->driver_private;
     R128MonitorType MonType = r128_output->MonType;
+    R128SavePtr save = &info->ModeReg;
 
     switch(MonType) {
     case MT_LCD:
         OUTREGP(R128_LVDS_GEN_CNTL, 0, ~(R128_LVDS_BLON | R128_LVDS_ON));
+        save->lvds_gen_cntl &=         ~(R128_LVDS_BLON | R128_LVDS_ON);
         break;
     case MT_DFP:
-        OUTREGP(R128_FP_GEN_CNTL, 0, ~(R128_FP_FPON | R128_FP_TDMS_EN));
+        OUTREGP(R128_FP_GEN_CNTL,   0, ~(R128_FP_FPON | R128_FP_TDMS_EN));
+        save->fp_gen_cntl   &=         ~(R128_FP_FPON | R128_FP_TDMS_EN);
+        break;
+    case MT_CRT:
+        OUTREGP(R128_CRTC_EXT_CNTL, 0, ~(R128_CRTC_CRT_ON));
+        save->crtc_ext_cntl &=         ~(R128_CRTC_CRT_ON);
         break;
     default:
         break;
-- 
2.0.0



More information about the xorg-driver-ati mailing list