From 3bbce42414abea6c9977ff2b023ce3210d78f008 Mon Sep 17 00:00:00 2001 From: Connor Behan Date: Wed, 9 Jul 2014 11:40:35 -0700 Subject: [PATCH] Move display enabling code to DPMS This ensures that DAC, TMDS and LVDS enable bits are properly saved and only set in the dpms hook. Signed-off-by: Connor Behan Reviewed-by: Alex Deucher --- 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;