timc wrote:
Hi, Xavier,
Thanks for your comment. I had removed some redundant spaces. The
attachment is which I fixed. If I misunderstand your meaning, please let me
know.
Thank you.
Best regards,
Tim
A few more trailing white space fixes and a some typo fixes.
Modified patch attached.
Regards,
Xavier
-----Original Message-----
From: Xavier Bachelot [mailto:[email protected]]
Sent: Tuesday, March 03, 2009 10:02 PM
To: timc
Cc: [email protected]
Subject: Re: [Openchrome-devel] Integrated TMDS support
timc wrote:
Hi all,
I attached my patch file in the attachment. If you have any comment,
please let me know. Thank you.
Thanks a lot Tim.
A quick glance at the patch showed that there are a few trailing patches
in your code and also that you are introducing some more trailing spaces
to code you are not otherwise modifying. Agreed, this is purely
cosmetic, but needs to be fixed anyway. I'm not qualified enough to
comment on the code itself, but it doesn't look too much invasive, which
is good.
Regards,
Xavier
Index: src/via_bios.h
===================================================================
--- src/via_bios.h (revision 735)
+++ src/via_bios.h (working copy)
@@ -162,6 +162,10 @@
int panelX;
int panelY;
int resY;
+
+ /* DFP */
+ Bool DfpPresent;
+ Bool DfpActive;
/* Integrated LVDS */
ViaLVDSInfoPtr Lvds;
@@ -216,6 +220,7 @@
void ViaModePrimaryLegacy(ScrnInfoPtr pScrn, DisplayModePtr mode);
void ViaModeSecondaryLegacy(ScrnInfoPtr pScrn, DisplayModePtr mode);
void ViaLCDPower(ScrnInfoPtr pScrn, Bool On);
+void ViaDFPPower(ScrnInfoPtr pScrn, Bool On);
void ViaTVPower(ScrnInfoPtr pScrn, Bool On);
void ViaTVSave(ScrnInfoPtr pScrn);
void ViaTVRestore(ScrnInfoPtr pScrn);
Index: src/via_display.c
===================================================================
--- src/via_display.c (revision 735)
+++ src/via_display.c (working copy)
@@ -126,3 +126,20 @@
else
ViaSeqMask(hwp, 0x16, 0x40, 0x40);
}
+
+/*
+ * Sets the primary or secondary display stream on internal TMDS.
+ */
+void
+ViaDisplaySetStreamOnDFP(ScrnInfoPtr pScrn, Bool primary)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaDisplaySetStreamOnDFP\n"));
+
+ if (primary)
+ ViaCrtcMask(hwp, 0x99, 0x00, 0x10);
+ else
+ ViaCrtcMask(hwp, 0x99, 0x10, 0x10);
+}
+
Index: src/via_driver.c
===================================================================
--- src/via_driver.c (revision 735)
+++ src/via_driver.c (working copy)
@@ -1409,8 +1409,8 @@
pVia->ActiveDevice |= VIA_DEVICE_CRT;
if (strstr(s, "LCD"))
pVia->ActiveDevice |= VIA_DEVICE_LCD;
- if (strstr(s, "DFP")) /* just treat this the same as LCD */
- pVia->ActiveDevice |= VIA_DEVICE_LCD;
+ if (strstr(s, "DFP"))
+ pVia->ActiveDevice |= VIA_DEVICE_DFP;
if (strstr(s, "TV"))
pVia->ActiveDevice |= VIA_DEVICE_TV;
}
@@ -2101,6 +2101,10 @@
}
+ /* Save TMDS status */
+ if (pVia->Chipset == VIA_CX700)
+ Regs->CRD2 = hwp->readCrtc(hwp, 0xD2);
+
vgaHWProtect(pScrn, FALSE);
}
}
@@ -2213,6 +2217,10 @@
}
+ /* Restore TMDS status */
+ if (pVia->Chipset == VIA_CX700)
+ hwp->writeCrtc(hwp, 0xD2, Regs->CRD2);
+
if (pBIOSInfo->Panel->IsActive)
ViaLCDPower(pScrn, TRUE);
@@ -3144,6 +3152,9 @@
if (pBIOSInfo->TVActive)
ViaTVPower(pScrn, TRUE);
+ if (pBIOSInfo->DfpActive)
+ ViaDFPPower(pScrn, TRUE);
+
if (pBIOSInfo->Simultaneous->IsActive)
ViaDisplayEnableSimultaneous(pScrn);
@@ -3164,6 +3175,9 @@
if (pBIOSInfo->TVActive)
ViaTVPower(pScrn, FALSE);
+ if (pBIOSInfo->DfpActive)
+ ViaDFPPower(pScrn, FALSE);
+
if (pBIOSInfo->Simultaneous->IsActive)
ViaDisplayDisableSimultaneous(pScrn);
Index: src/via_driver.h
===================================================================
--- src/via_driver.h (revision 735)
+++ src/via_driver.h (working copy)
@@ -124,6 +124,9 @@
CARD8 CR97, CR99, CR9B, CR9F, CRA0, CRA1, CRA2;
CARD8 CRTCRegs[68];
/* CARD8 LCDRegs[0x40];*/
+
+ /* TMDS/LVDS Control */
+ CARD8 CRD2;
} VIARegRec, *VIARegPtr;
/*
Index: src/via_mode.c
===================================================================
--- src/via_mode.c (revision 735)
+++ src/via_mode.c (working copy)
@@ -292,6 +292,29 @@
return MODE_OK;
}
+
+static Bool
+ViaDFPDetect(ScrnInfoPtr pScrn)
+{
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaDFPDetect\n"));
+
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+ xf86MonPtr monPtr;
+
+ if (pVia->pI2CBus2)
+ monPtr = xf86DoEDID_DDC2(pScrn->scrnIndex, pVia->pI2CBus2);
+
+ if (monPtr) {
+ xf86PrintEDID(monPtr);
+ xf86SetDDCproperties(pScrn, monPtr);
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+
/*
*
*/
@@ -305,7 +328,8 @@
pBIOSInfo->CrtPresent = FALSE;
pBIOSInfo->PanelPresent = FALSE;
-
+ pBIOSInfo->DfpPresent = FALSE;
+
/* Panel */
if (pBIOSInfo->ForcePanel) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling panel from config.\n");
@@ -346,6 +370,19 @@
pBIOSInfo->TVOutput = 0;
}
}
+
+ if (pVia->Chipset == VIA_CX700) {
+
+ if (ViaDFPDetect(pScrn)) {
+ pBIOSInfo->DfpPresent = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "DFP is connected.\n");
+ } else {
+ pBIOSInfo->DfpPresent = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "DFP is disconnected.\n");
+ }
+ }
}
#ifdef HAVE_DEBUG
@@ -399,7 +436,8 @@
pBIOSInfo->Panel->IsActive = FALSE;
pBIOSInfo->CrtActive = FALSE;
pBIOSInfo->TVActive = FALSE;
-
+ pBIOSInfo->DfpActive = FALSE;
+
if (!pVia->ActiveDevice) {
/* always enable the panel when present */
if (pBIOSInfo->PanelPresent)
@@ -410,6 +448,11 @@
/* CRT can be used with everything when present */
if (pBIOSInfo->CrtPresent)
pBIOSInfo->CrtActive = TRUE;
+
+ /* DFP */
+ if (pBIOSInfo->DfpPresent)
+ pBIOSInfo->DfpActive = TRUE;
+
} else {
if (pVia->ActiveDevice & VIA_DEVICE_LCD) {
if (pBIOSInfo->PanelPresent)
@@ -434,8 +477,14 @@
pBIOSInfo->TVActive = TRUE;
}
+ if (pVia->ActiveDevice & VIA_DEVICE_DFP) {
+ pBIOSInfo->DfpPresent = TRUE;
+ pBIOSInfo->DfpActive = TRUE;
+ }
+
if ((pVia->ActiveDevice & VIA_DEVICE_CRT)
- || (!pBIOSInfo->Panel->IsActive && !pBIOSInfo->TVActive)) {
+ || (!pBIOSInfo->Panel->IsActive && !pBIOSInfo->TVActive
+ && !pBIOSInfo->DfpActive)) {
pBIOSInfo->CrtPresent = TRUE;
pBIOSInfo->CrtActive = TRUE;
}
@@ -443,6 +492,8 @@
if (!pVia->UseLegacyModeSwitch) {
if (pBIOSInfo->CrtActive)
pBIOSInfo->FirstCRTC->IsActive = TRUE ;
+ if (pBIOSInfo->DfpActive)
+ pBIOSInfo->FirstCRTC->IsActive = TRUE ;
if (pBIOSInfo->Panel->IsActive) {
pVia->pBIOSInfo->SecondCRTC->IsActive = TRUE ;
if (pVia->Chipset == VIA_P4M900 || pVia->Chipset == VIA_CX700 || pVia->Chipset == VIA_VX800 )
@@ -460,6 +511,9 @@
if (pBIOSInfo->TVActive)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"ViaOutputsSelect: TV.\n"));
+ if (pBIOSInfo->DfpActive)
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "ViaOutputsSelect: DFP.\n"));
#endif
return TRUE; /* !Secondary always has at least CRT */
}
@@ -1489,6 +1543,28 @@
}
void
+ViaDFPPower(ScrnInfoPtr pScrn, Bool On)
+{
+#ifdef HAVE_DEBUG
+ if (On)
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaDFPPower: On.\n");
+ else
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaDFPPower: Off.\n");
+#endif
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
+
+ /* Display Channel Select */
+ ViaCrtcMask(hwp, 0xD2, 0x30, 0x30);
+
+ /* Power on TMDS */
+ ViaCrtcMask(hwp, 0xD2, 0x00, 0x08);
+
+}
+
+
+void
ViaModeFirstCRTC(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaModeFirstCRTC\n");
@@ -1576,9 +1652,18 @@
}
if (pBIOSInfo->FirstCRTC->IsActive) {
- /* CRT on FirstCRTC */
- ViaDisplaySetStreamOnCRT(pScrn, TRUE);
- ViaDisplayEnableCRT(pScrn);
+ if (pBIOSInfo->CrtActive) {
+ /* CRT on FirstCRTC */
+ ViaDisplaySetStreamOnCRT(pScrn, TRUE);
+ ViaDisplayEnableCRT(pScrn);
+ }
+
+ if (pBIOSInfo->DfpActive) {
+ /* DFP on FirstCrtc */
+ ViaDisplaySetStreamOnDFP(pScrn, TRUE);
+ ViaDFPPower(pScrn, TRUE);
+ }
+
ViaModeFirstCRTC(pScrn, mode);
} else {
ViaDisplayDisableCRT(pScrn);
_______________________________________________
Openchrome-devel mailing list
[email protected]
http://wiki.openchrome.org/mailman/listinfo/openchrome-devel