From 6877f532c5f41a445d41eb6a9982bf6bcf691bf2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 28 Feb 2006 15:56:06 -0800 Subject: [PATCH] Add untested CRT detection code. --- src/i810_reg.h | 13 +++++++++++++ src/i830_display.c | 16 ++++++++++++++++ src/i830_display.h | 1 + 3 files changed, 30 insertions(+) diff --git a/src/i810_reg.h b/src/i810_reg.h index 7af23e73..1194c231 100644 --- a/src/i810_reg.h +++ b/src/i810_reg.h @@ -693,6 +693,19 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # define FP_M1_DIV_MASK 0x00003f00 # define FP_M2_DIV_MASK 0x0000003f +#define PORT_HOTPLUG_EN 0x61110 +# define SDVOB_HOTPLUG_INT_EN (1 << 26) +# define SDVOC_HOTPLUG_INT_EN (1 << 25) +# define TV_HOTPLUG_INT_EN (1 << 18) +# define CRT_HOTPLUG_INT_EN (1 << 9) +# define CRT_HOTPLUG_FORCE_DETECT (1 << 3) + +#define PORT_HOTPLUG_STAT 0x61114 +# define CRT_HOTPLUG_INT_STATUS (1 << 11) +# define TV_HOTPLUG_INT_STATUS (1 << 10) +# define SDVOC_HOTPLUG_INT_STATUS (1 << 7) +# define SDVOB_HOTPLUG_INT_STATUS (1 << 6) + #define I830_HTOTAL_MASK 0xfff0000 #define I830_HACTIVE_MASK 0x7ff diff --git a/src/i830_display.c b/src/i830_display.c index 84379ac0..73f2d9fa 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -312,3 +312,19 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) OUTREG(DSPBCNTR, temp | DISPLAY_PLANE_ENABLE); }*/ } + +Bool +i830DetectCRT(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + CARD32 temp; + + temp = INREG(PORT_HOTPLUG_EN); + OUTREG(PORT_HOTPLUG_EN, temp | CRT_HOTPLUG_FORCE_DETECT); + + /* Wait for the bit to clear to signal detection finished. */ + while (INREG(PORT_HOTPLUG_EN) & CRT_HOTPLUG_FORCE_DETECT) + ; + + return ((INREG(PORT_HOTPLUG_STAT) & CRT_HOTPLUG_INT_STATUS)); +} diff --git a/src/i830_display.h b/src/i830_display.h index 6cadd75d..6ad150ad 100644 --- a/src/i830_display.h +++ b/src/i830_display.h @@ -1 +1,2 @@ void i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode); +Bool i830DetectCRT(ScreenPtr pScrn);