xf86-video-ati: Branch 'master' - 2 commits

Alex Deucher agd5f at kemper.freedesktop.org
Wed Oct 10 21:17:21 PDT 2007


 src/radeon.h        |    2 ++
 src/radeon_crtc.c   |   18 ++++++++++++++++++
 src/radeon_driver.c |   34 +++++++++++++++++++++++++++-------
 src/radeon_output.c |   14 ++++++++++++--
 4 files changed, 59 insertions(+), 9 deletions(-)

New commits:
diff-tree 7afd04c1e4ffa6e4e5ba08ae90ba002237dc282b (from 1b231d28fdda5cdc44bb9d2075d4edfd8f17e21f)
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Thu Oct 11 00:16:45 2007 -0400

    RADEON: tell the bios not to muck with the hardware while the driver is active
    
    by toggling the appropriate bios scratch regs you can tell
    the bios not the touch the hw while the driver is active.
    This should prevent the bios from scrambling the hardware
    when users open the lid or toggle bios hotkeys.
    
    fixes bug 12567

diff --git a/src/radeon.h b/src/radeon.h
index 7248291..6ee43b2 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -913,6 +913,8 @@ extern void        RADEONRestoreFP2Regis
 					     RADEONSavePtr restore);
 extern void        RADEONRestoreLVDSRegisters(ScrnInfoPtr pScrn,
 					      RADEONSavePtr restore);
+extern void        RADEONRestoreBIOSRegisters(ScrnInfoPtr pScrn,
+					      RADEONSavePtr restore);
 extern void        RADEONRestoreRMXRegisters(ScrnInfoPtr pScrn,
 					     RADEONSavePtr restore);
 extern void        RADEONRestorePLLRegisters(ScrnInfoPtr pScrn,
diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c
index 47e46f3..ca554d2 100644
--- a/src/radeon_crtc.c
+++ b/src/radeon_crtc.c
@@ -768,6 +768,18 @@ RADEONInitPLL2Registers(ScrnInfoPtr pScr
 }
 
 static void
+RADEONInitBIOSRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save)
+{
+    RADEONInfoPtr  info      = RADEONPTR(pScrn);
+
+    /* tell the bios not to muck with the hardware on events */
+    save->bios_4_scratch = 0;
+    save->bios_5_scratch = 0xff00;
+    save->bios_6_scratch = info->SavedReg.bios_6_scratch | 0x40000000;
+
+}
+
+static void
 radeon_update_tv_routing(ScrnInfoPtr pScrn, RADEONSavePtr restore)
 {
     /* pixclks_cntl controls tv clock routing */
@@ -813,6 +825,9 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, D
 	}
     }
 
+    if (info->IsMobility)
+	RADEONInitBIOSRegisters(pScrn, &info->ModeReg);
+
     ErrorF("init memmap\n");
     RADEONInitMemMapRegisters(pScrn, &info->ModeReg, info);
     ErrorF("init common\n");
@@ -868,6 +883,9 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, D
 	}
     }
 
+    if (info->IsMobility)
+	RADEONRestoreBIOSRegisters(pScrn, &info->ModeReg);
+
     ErrorF("restore memmap\n");
     RADEONRestoreMemMapRegisters(pScrn, &info->ModeReg);
     ErrorF("restore common\n");
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 7149b12..10223f4 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -4236,14 +4236,25 @@ void RADEONRestoreLVDSRegisters(ScrnInfo
 
     if (info->IsMobility) {
 	OUTREG(RADEON_LVDS_GEN_CNTL,  restore->lvds_gen_cntl);
-	OUTREG(RADEON_LVDS_PLL_CNTL,  restore->lvds_pll_cntl);  
-	/*OUTREG(RADEON_BIOS_4_SCRATCH, restore->bios_4_scratch);
-	OUTREG(RADEON_BIOS_5_SCRATCH, restore->bios_5_scratch);
-	OUTREG(RADEON_BIOS_6_SCRATCH, restore->bios_6_scratch);*/
+	OUTREG(RADEON_LVDS_PLL_CNTL,  restore->lvds_pll_cntl);
     }
 
 }
 
+void RADEONRestoreBIOSRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore)
+{
+    RADEONInfoPtr  info       = RADEONPTR(pScrn);
+    unsigned char *RADEONMMIO = info->MMIO;
+    CARD32 bios_6_scratch = INREG(RADEON_BIOS_6_SCRATCH);
+
+    OUTREG(RADEON_BIOS_4_SCRATCH, restore->bios_4_scratch);
+    OUTREG(RADEON_BIOS_5_SCRATCH, restore->bios_5_scratch);
+    if (restore->bios_6_scratch & 0x40000000)
+	bios_6_scratch |= 0x40000000;
+    OUTREG(RADEON_BIOS_6_SCRATCH, bios_6_scratch);
+
+}
+
 /* Write to TV FIFO RAM */
 static void RADEONWriteTVFIFO(ScrnInfoPtr pScrn, CARD16 addr,
 			      CARD32 value)
@@ -5083,6 +5094,16 @@ static void RADEONSaveDACRegisters(ScrnI
 
 }
 
+static void RADEONSaveBIOSRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save)
+{
+    RADEONInfoPtr  info       = RADEONPTR(pScrn);
+    unsigned char *RADEONMMIO = info->MMIO;
+
+    save->bios_4_scratch       = INREG(RADEON_BIOS_4_SCRATCH);
+    save->bios_5_scratch       = INREG(RADEON_BIOS_5_SCRATCH);
+    save->bios_6_scratch       = INREG(RADEON_BIOS_6_SCRATCH);
+}
+
 /* Read flat panel registers */
 static void RADEONSaveFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save)
 {
@@ -5097,9 +5118,6 @@ static void RADEONSaveFPRegisters(ScrnIn
     save->lvds_pll_cntl        = INREG(RADEON_LVDS_PLL_CNTL);
     save->tmds_pll_cntl        = INREG(RADEON_TMDS_PLL_CNTL);
     save->tmds_transmitter_cntl= INREG(RADEON_TMDS_TRANSMITTER_CNTL);
-    save->bios_4_scratch       = INREG(RADEON_BIOS_4_SCRATCH);
-    save->bios_5_scratch       = INREG(RADEON_BIOS_5_SCRATCH);
-    save->bios_6_scratch       = INREG(RADEON_BIOS_6_SCRATCH);
 
     if (info->ChipFamily == CHIP_FAMILY_RV280) {
 	/* bit 22 of TMDS_PLL_CNTL is read-back inverted */
@@ -5341,6 +5359,7 @@ static void RADEONSave(ScrnInfoPtr pScrn
     RADEONSavePLLRegisters(pScrn, save);
     RADEONSaveCrtcRegisters(pScrn, save);
     RADEONSaveFPRegisters(pScrn, save);
+    RADEONSaveBIOSRegisters(pScrn, save);
     RADEONSaveDACRegisters(pScrn, save);
     if (pRADEONEnt->HasCRTC2) {
 	RADEONSaveCrtc2Registers(pScrn, save);
@@ -5387,6 +5406,7 @@ void RADEONRestore(ScrnInfoPtr pScrn)
 	RADEONRestorePLL2Registers(pScrn, restore);
     }
 
+    RADEONRestoreBIOSRegisters(pScrn, restore);
     RADEONRestoreCrtcRegisters(pScrn, restore);
     RADEONRestorePLLRegisters(pScrn, restore);
     RADEONRestoreRMXRegisters(pScrn, restore);
diff-tree 1b231d28fdda5cdc44bb9d2075d4edfd8f17e21f (from 47ef583b993607bc3a372dd125c6e5228c4ec7bf)
Author: Alex Deucher <alex at t41p.hsd1.va.comcast.net>
Date:   Wed Oct 10 21:54:46 2007 -0400

    RADEON: attempt to detect lid status on legacy bios
    
    I'm not sure how reliable this is.  The lid closed
    bit only seems to be set if the lid is closed at boot
    so LVDS will default to on if you restart X with the
    lid closed after boot.

diff --git a/src/radeon_output.c b/src/radeon_output.c
index 0836005..643cbc4 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -670,9 +670,19 @@ static RADEONMonitorType RADEONPortCheck
     RADEONOutputPrivatePtr radeon_output = output->driver_private;
     RADEONMonitorType MonType = MT_NONE;
 
-
     if (radeon_output->type == OUTPUT_LVDS) {
-	    MonType =  MT_LCD;
+#if defined(__powerpc__)
+	/* not sure on ppc, OF? */
+#else
+	if (!info->IsAtomBios) {
+	    /* see if the lid is closed -- only works at boot */
+	    if (INREG(RADEON_BIOS_6_SCRATCH) & 0x10)
+		MonType = MT_NONE;
+	    else
+		MonType = MT_LCD;
+	} else
+#endif
+	    MonType = MT_LCD;
     } else if (radeon_output->type == OUTPUT_DVI) {
 	if (radeon_output->TMDSType == TMDS_INT) {
 	    if (INREG(RADEON_FP_GEN_CNTL) & RADEON_FP_DETECT_SENSE)


More information about the xorg-commit mailing list