[Openchrome-devel] [PATCH] VGA not detected solution
James Simmons
jsimmons at infradead.org
Sun Nov 11 05:59:23 PST 2012
Hello!
Several people have reported problems with no EDID info coming
from a VGA monitor. This causes our X driver not to start thinging no
displays are available. So I created this patch to try to detect if a
VGA monitor is attached by watching for a VBlank. This should tell our
xorg driver that a VGA monitor is attached even if we have trouble getting
modes. Please give it a try.
Signed-off-by: James Simmons <jsimmons at infradead.org>
diff --git a/src/via_outputs.c b/src/via_outputs.c
index 45827ac..75d312c 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -755,8 +755,43 @@ via_analog_detect(xf86OutputPtr output)
xf86OutputSetEDID(output, mon);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DDC pI2CBus1 detected a CRT\n"));
status = XF86OutputStatusConnected;
- } else
- ViaDisplayDisableCRT(pScrn);
+ } else {
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ CARD8 SR01 = hwp->readSeq(hwp, 0x01);
+ CARD8 SR40 = hwp->readSeq(hwp, 0x40);
+ CARD8 CR36 = hwp->readCrtc(hwp, 0x36);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Test for CRT with VSYNC\n"));
+ /* We have to power on the display to detect it */
+ ViaSeqMask(hwp, 0x01, 0x00, 0x20);
+ ViaCrtcMask(hwp, 0x36, 0x00, 0xF0);
+
+ /* Wait for vblank */
+ usleep(16);
+
+ /* Detect the load on pins */
+ ViaSeqMask(hwp, 0x40, 0x80, 0x80);
+
+ if ((VIA_CX700 == pVia->Chipset) ||
+ (VIA_VX800 == pVia->Chipset) ||
+ (VIA_VX855 == pVia->Chipset) ||
+ (VIA_VX900 == pVia->Chipset))
+ ViaSeqMask(hwp, 0x40, 0x00, 0x80);
+
+ if (ViaVgahwIn(hwp, 0x3C2) & 0x20)
+ status = XF86OutputStatusConnected;
+
+ if ((VIA_CX700 == pVia->Chipset) ||
+ (VIA_VX800 == pVia->Chipset) ||
+ (VIA_VX855 == pVia->Chipset) ||
+ (VIA_VX900 == pVia->Chipset))
+ ViaSeqMask(hwp, 0x40, 0x00, 0x80);
+
+ /* Restore previous state */
+ hwp->writeSeq(hwp, 0x40, SR40);
+ hwp->writeSeq(hwp, 0x01, SR01);
+ hwp->writeCrtc(hwp, 0x36, CR36);
+ }
return status;
}
diff --git a/src/via_vgahw.c b/src/via_vgahw.c
index 8cfb055..1e0f808 100644
--- a/src/via_vgahw.c
+++ b/src/via_vgahw.c
@@ -40,7 +40,7 @@
#define PIOOFFSET 0
#endif
-static CARD8
+CARD8
ViaVgahwIn(vgaHWPtr hwp, int address)
{
if (hwp->MMIOBase)
diff --git a/src/via_vgahw.h b/src/via_vgahw.h
index 11bfc2c..e1770ab 100644
--- a/src/via_vgahw.h
+++ b/src/via_vgahw.h
@@ -25,6 +25,7 @@
#include "vgaHW.h"
+CARD8 ViaVgahwIn(vgaHWPtr hwp, int address);
void ViaVgahwWrite(vgaHWPtr hwp, int indexaddress, CARD8 index,
int valueaddress, CARD8 value);
More information about the Openchrome-devel
mailing list