[Openchrome-devel] xf86-video-openchrome: 6 commits - configure.ac src/via_driver.h src/via_outputs.c src/via_sii164.c src/via_tmds.c src/via_ums.h src/via_vt1632.c
Kevin Brace
kevinbrace at kemper.freedesktop.org
Tue May 23 04:06:34 UTC 2017
configure.ac | 2
src/via_driver.h | 3
src/via_outputs.c | 7 +
src/via_sii164.c | 5
src/via_tmds.c | 324 ++++++++++++++++++++++++++----------------------------
src/via_ums.h | 13 +-
src/via_vt1632.c | 5
7 files changed, 182 insertions(+), 177 deletions(-)
New commits:
commit ba5169222151f13e83b42331077847a9483d37cb
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon May 22 21:06:07 2017 -0700
Version bumped to 0.6.118
Rewrote integrated TMDS (DVI) transmitter initialization and
detection code.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/configure.ac b/configure.ac
index 356e926..d3e9b62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ(2.57)
AC_INIT([xf86-video-openchrome],
- [0.6.117],
+ [0.6.118],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
[xf86-video-openchrome])
commit 641189784965a131612d650c472ad327148e1d20
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon May 22 21:03:30 2017 -0700
Updating via_tmds_detect
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_tmds.c b/src/via_tmds.c
index 02298c1..ab8aa78 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -864,43 +864,36 @@ via_tmds_mode_set(xf86OutputPtr output, DisplayModePtr mode,
static xf86OutputStatus
via_tmds_detect(xf86OutputPtr output)
{
- xf86MonPtr mon;
- xf86OutputStatus status = XF86OutputStatusDisconnected;
ScrnInfoPtr pScrn = output->scrn;
+ xf86MonPtr pMon;
+ xf86OutputStatus status = XF86OutputStatusDisconnected;
+ I2CBusPtr pI2CBus;
VIAPtr pVia = VIAPTR(pScrn);
+ VIATMDSPtr pVIATMDS = (VIATMDSPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Entered via_tmds_detect.\n"));
- if (!pVia->pI2CBus2) {
- goto exit;
- }
-
- /* Assume that only I2C bus 2 is used for the DVI connected to the
- * integrated TMDS transmitter. */
- if (!xf86I2CProbeAddress(pVia->pI2CBus2, 0xA0)) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "I2C device on I2C Bus 2 does not support EDID.\n");
- goto exit;
+ if (pVIATMDS->i2cBus & VIA_I2C_BUS2) {
+ pI2CBus = pVia->pI2CBus2;
+ } else if (pVIATMDS->i2cBus & VIA_I2C_BUS3) {
+ pI2CBus = pVia->pI2CBus3;
+ } else {
+ pI2CBus = NULL;
}
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Obtaining EDID for DVI.\n");
-
- /* Since DVI presence was established, access the I2C bus,
- * in order to obtain EDID from the monitor. */
- mon = xf86OutputGetEDID(output, pVia->pI2CBus2);
-
- /* Is the interface type digital? */
- if (mon && DIGITAL(mon->features.input_type)) {
- status = XF86OutputStatusConnected;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected a monitor connected to DVI.\n");
- xf86OutputSetEDID(output, mon);
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Could not obtain EDID from a monitor "
- "connected to DVI.\n");
+ if (pI2CBus) {
+ pMon = xf86OutputGetEDID(output, pI2CBus);
+ if (pMon && DIGITAL(pMon->features.input_type)) {
+ status = XF86OutputStatusConnected;
+ xf86OutputSetEDID(output, pMon);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected a monitor connected to DVI.\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Could not obtain EDID from a monitor "
+ "connected to DVI.\n");
+ }
}
exit:
commit 400a8ac594dca6c9a15f97a56fd093ada8b7bd91
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon May 22 20:50:12 2017 -0700
Rewrite of integrated TMDS (DVI) initialization code
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_outputs.c b/src/via_outputs.c
index 994125e..2c5628f 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -667,6 +667,8 @@ viaInitDisplay(ScrnInfoPtr pScrn)
display detection purposes. */
viaProbePinStrapping(pScrn);
+ viaTMDSProbe(pScrn);
+
viaAnalogProbe(pScrn);
@@ -679,6 +681,9 @@ viaInitDisplay(ScrnInfoPtr pScrn)
/* LVDS */
via_lvds_init(pScrn);
+ /* DVI */
+ viaTMDSInit(pScrn);
+
/* VGA */
viaAnalogInit(pScrn);
diff --git a/src/via_tmds.c b/src/via_tmds.c
index 94debad..02298c1 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -982,94 +982,139 @@ static const xf86OutputFuncsRec via_tmds_funcs = {
.destroy = via_tmds_destroy,
};
+void
+viaTMDSProbe(ScrnInfoPtr pScrn)
+{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ CARD8 sr13, sr5a;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered viaTMDSProbe.\n"));
-Bool
+ /* Detect the presence of integrated TMDS transmitter. */
+ switch (pVia->Chipset) {
+ case VIA_CX700:
+ case VIA_VX800:
+ sr5a = hwp->readSeq(hwp, 0x5A);
+
+ /* Setting SR5A[0] to 1.
+ * This allows the reading out the alternative
+ * pin strapping information from SR12 and SR13. */
+ ViaSeqMask(hwp, 0x5A, BIT(0), BIT(0));
+
+ sr13 = hwp->readSeq(hwp, 0x13);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "SR13: 0x%02X\n", sr13));
+
+ /* 3C5.13[7:6] - Integrated LVDS / DVI Mode Select
+ * (DVP1D15-14 pin strapping)
+ * 00: LVDS1 + LVDS2
+ * 01: DVI + LVDS2
+ * 10: Dual LVDS Channel (High Resolution Panel)
+ * 11: One DVI only (decrease the clock jitter) */
+ /* Check for DVI presence using pin strappings.
+ * VIA Technologies NanoBook reference design based products
+ * have their pin strappings set to a wrong setting to communicate
+ * the presence of DVI, so it requires special handling here. */
+ if (pVia->isVIANanoBook) {
+ pVIADisplay->intTMDSPresence = TRUE;
+ pVIADisplay->intTMDSDIPort = VIA_DI_PORT_TMDS;
+ pVIADisplay->intTMDSI2CBus = VIA_I2C_BUS2;
+ pVIADisplay->mappedI2CBus |= VIA_I2C_BUS2;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Integrated TMDS (DVI) transmitter detected.\n");
+ } else if (((!(sr13 & BIT(7))) && (sr13 & BIT(6)))
+ || ((sr13 & BIT(7)) && (sr13 & BIT(6)))) {
+ pVIADisplay->intTMDSPresence = TRUE;
+ pVIADisplay->intTMDSDIPort = VIA_DI_PORT_TMDS;
+ pVIADisplay->intTMDSI2CBus = VIA_I2C_BUS2;
+ pVIADisplay->mappedI2CBus |= VIA_I2C_BUS2;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Integrated TMDS (DVI) transmitter detected via pin strapping.\n");
+ } else {
+ pVIADisplay->intTMDSPresence = FALSE;
+ pVIADisplay->intTMDSDIPort = VIA_DI_PORT_NONE;
+ pVIADisplay->intTMDSI2CBus = VIA_I2C_NONE;
+ }
+
+ hwp->writeSeq(hwp, 0x5A, sr5a);
+ break;
+ default:
+ pVIADisplay->intTMDSPresence = FALSE;
+ pVIADisplay->intTMDSDIPort = VIA_DI_PORT_NONE;
+ pVIADisplay->intTMDSI2CBus = VIA_I2C_NONE;
+ break;
+ }
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting viaTMDSProbe.\n"));
+}
+
+void
viaTMDSInit(ScrnInfoPtr pScrn)
{
xf86OutputPtr output;
- vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
- VIATMDSPtr pVIATMDS = NULL;
- CARD8 sr13, sr5a;
- Bool status = FALSE;
+ VIATMDSPtr pVIATMDS;
char outputNameBuffer[32];
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Entered viaTMDSInit.\n"));
- sr5a = hwp->readSeq(hwp, 0x5A);
- ViaSeqMask(hwp, 0x5A, sr5a | 0x01, 0x01);
- sr13 = hwp->readSeq(hwp, 0x13);
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "SR13: 0x%02X\n", sr13));
- hwp->writeSeq(hwp, 0x5A, sr5a);
-
- /* 3C5.13[7:6] - Integrated LVDS / DVI Mode Select
- * (DVP1D15-14 pin strapping)
- * 00: LVDS1 + LVDS2
- * 01: DVI + LVDS2
- * 10: Dual LVDS Channel (High Resolution Panel)
- * 11: One DVI only (decrease the clock jitter) */
- /* Check for DVI presence using pin strappings.
- * VIA Technologies NanoBook reference design based products
- * have their pin strappings set to a wrong setting to communicate
- * the presence of DVI, so it requires special handling here. */
- if ((((~(sr13 & 0x80)) && (sr13 & 0x40))
- || ((sr13 & 0x80) && (sr13 & 0x40)))
- || (pVia->isVIANanoBook)) {
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Integrated TMDS transmitter found via pin strapping.\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Integrated TMDS transmitter not found.\n");
+ if (!pVIADisplay->intTMDSPresence) {
goto exit;
}
- pVIATMDS = xnfcalloc(1, sizeof(VIATMDSRec));
+ pVIATMDS = (VIATMDSPtr) xnfcalloc(1, sizeof(VIATMDSRec));
if (!pVIATMDS) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate working storage for integrated "
- "TMDS transmitter.\n");
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate storage for "
+ "integrated TMDS (DVI) transmitter.\n"));
goto exit;
}
- /* Leaving a hint for mode setting and DPMS to know which port
- * to access. For CX700 / VX700 and VX800 integrated TMDS
- * transmitter, it is fixed to LVDS1 (TMDS uses LVDS1 wires). */
- pVIATMDS->diPortType = VIA_DI_PORT_TMDS;
-
- /* The code to dynamically designate the particular DVI (i.e., DVI-1,
+ /* The code to dynamically designate a particular DVI (i.e., DVI-1,
* DVI-2, etc.) for xrandr was borrowed from xf86-video-r128 DDX. */
sprintf(outputNameBuffer, "DVI-%d", (pVIADisplay->numberDVI + 1));
output = xf86OutputCreate(pScrn, &via_tmds_funcs, outputNameBuffer);
if (!output) {
free(pVIATMDS);
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate X Server display output record for "
- "integrated TMDS transmitter.\n");
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to create X Server display output "
+ "for integrated TMDS (DVI) "
+ "transmitter.\n"));
goto exit;
}
+ /* Increment the number of DVI connectors. */
+ pVIADisplay->numberDVI++;
+
+ /* Leaving a hint for mode setting and DPMS to know which port
+ * to access. For CX700 / VX700 and VX800 chipsets' integrated TMDS
+ * transmitter, it is fixed to LVDS1 (TMDS uses LVDS1 pins). */
+ pVIATMDS->diPort = pVIADisplay->intTMDSDIPort;
+
+ /* Hint about which I2C bus to access for obtaining EDID. */
+ pVIATMDS->i2cBus = pVIADisplay->intTMDSI2CBus;
+
output->driver_private = pVIATMDS;
/* Since there are two (2) display controllers registered with the
* X.Org Server and both IGA1 and IGA2 can handle DVI without any
* limitations, possible_crtcs should be set to 0x3 (0b11) so that
* either display controller can get assigned to handle DVI. */
- output->possible_crtcs = (1 << 1) | (1 << 0);
+ output->possible_crtcs = BIT(1) | BIT(0);
output->possible_clones = 0;
output->interlaceAllowed = FALSE;
output->doubleScanAllowed = FALSE;
- pVIADisplay->numberDVI++;
- status = TRUE;
exit:
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Exiting viaTMDSInit.\n"));
- return status;
}
void
@@ -1088,22 +1133,6 @@ via_dvi_init(ScrnInfoPtr pScrn)
return;
}
- /* Check to see if we are dealing with the latest VIA chipsets. */
- if ((pVia->Chipset == VIA_CX700)
- || (pVia->Chipset == VIA_VX800)
- || (pVia->Chipset == VIA_VX855)
- || (pVia->Chipset == VIA_VX900)) {
-
- if (!viaTMDSInit(pScrn)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Integrated TMDS transmitter for DVI not found.\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Integrated TMDS transmitter for DVI was "
- "initialized successfully.\n");
- }
- }
-
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Probing I2C Bus 2 for VT1632.\n");
if (!viaVT1632Init(pScrn, pVia->pI2CBus2)) {
diff --git a/src/via_ums.h b/src/via_ums.h
index 2067f0c..b32dde1 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -148,6 +148,10 @@ typedef struct _VIADISPLAY {
Bool analogPresence;
CARD8 analogI2CBus;
+ Bool intTMDSPresence;
+ CARD8 intTMDSDIPort;
+ CARD8 intTMDSI2CBus;
+
/* Keeping track of the number of analog VGA connectors. */
unsigned int numberVGA;
@@ -223,8 +227,8 @@ typedef struct _VIAFP {
} VIAFPRec, *VIAFPPtr;
typedef struct _VIATMDS {
- I2CBusPtr pVIATMDSI2CBus;
- CARD8 diPortType;
+ CARD8 diPort;
+ CARD8 i2cBus;
} VIATMDSRec, *VIATMDSPtr;
typedef struct
@@ -608,6 +612,8 @@ void viaExtTMDSSetClockDriveStrength(ScrnInfoPtr pScrn,
CARD8 clockDriveStrength);
void viaExtTMDSSetDataDriveStrength(ScrnInfoPtr pScrn,
CARD8 dataDriveStrength);
+void viaTMDSProbe(ScrnInfoPtr pScrn);
+void viaTMDSInit(ScrnInfoPtr pScrn);
void via_dvi_init(ScrnInfoPtr pScrn);
/*via_tv.c */
commit 47a2e1e85f7ad2357498a3ec7968c3fb18e40fa2
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon May 22 20:15:10 2017 -0700
Moving numberDVI variable to a different record
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_driver.h b/src/via_driver.h
index 07854a7..18ceb58 100644
--- a/src/via_driver.h
+++ b/src/via_driver.h
@@ -361,9 +361,6 @@ typedef struct _VIA {
video_via_regs* VideoRegs;
- /* Keeping track of the number of DVI connectors. */
- unsigned int numberDVI;
-
/* Keeping track of the number of FP (Flat Panel) connectors. */
unsigned int numberFP;
diff --git a/src/via_outputs.c b/src/via_outputs.c
index 9646511..994125e 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -658,7 +658,7 @@ viaInitDisplay(ScrnInfoPtr pScrn)
pVIADisplay->numberVGA = 0;
/* Initialize the number of DVI connectors. */
- pVia->numberDVI = 0;
+ pVIADisplay->numberDVI = 0;
/* Initialize the number of FP connectors. */
pVia->numberFP = 0;
diff --git a/src/via_sii164.c b/src/via_sii164.c
index 5900e06..5541735 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -367,6 +367,7 @@ viaSiI164Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus)
{
xf86OutputPtr output;
VIAPtr pVia = VIAPTR(pScrn);
+ VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
viaSiI164RecPtr pSiI164Rec = NULL;
I2CDevPtr pI2CDevice = NULL;
I2CSlaveAddr i2cAddr = 0x70;
@@ -449,7 +450,7 @@ viaSiI164Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus)
/* The code to dynamically designate the particular DVI (i.e., DVI-1,
* DVI-2, etc.) for xrandr was borrowed from xf86-video-r128 DDX. */
- sprintf(outputNameBuffer, "DVI-%d", (pVia->numberDVI + 1));
+ sprintf(outputNameBuffer, "DVI-%d", (pVIADisplay->numberDVI + 1));
output = xf86OutputCreate(pScrn, &via_sii164_funcs, outputNameBuffer);
if (!output) {
free(pSiI164Rec);
@@ -474,7 +475,7 @@ viaSiI164Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus)
viaSiI164DumpRegisters(pScrn, pI2CDevice);
- pVia->numberDVI++;
+ pVIADisplay->numberDVI++;
status = TRUE;
exit:
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
diff --git a/src/via_tmds.c b/src/via_tmds.c
index 5613178..94debad 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -989,6 +989,7 @@ viaTMDSInit(ScrnInfoPtr pScrn)
xf86OutputPtr output;
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
+ VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
VIATMDSPtr pVIATMDS = NULL;
CARD8 sr13, sr5a;
Bool status = FALSE;
@@ -1041,7 +1042,7 @@ viaTMDSInit(ScrnInfoPtr pScrn)
/* The code to dynamically designate the particular DVI (i.e., DVI-1,
* DVI-2, etc.) for xrandr was borrowed from xf86-video-r128 DDX. */
- sprintf(outputNameBuffer, "DVI-%d", (pVia->numberDVI + 1));
+ sprintf(outputNameBuffer, "DVI-%d", (pVIADisplay->numberDVI + 1));
output = xf86OutputCreate(pScrn, &via_tmds_funcs, outputNameBuffer);
if (!output) {
free(pVIATMDS);
@@ -1063,7 +1064,7 @@ viaTMDSInit(ScrnInfoPtr pScrn)
output->interlaceAllowed = FALSE;
output->doubleScanAllowed = FALSE;
- pVia->numberDVI++;
+ pVIADisplay->numberDVI++;
status = TRUE;
exit:
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
diff --git a/src/via_ums.h b/src/via_ums.h
index a7fe582..2067f0c 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -151,6 +151,9 @@ typedef struct _VIADISPLAY {
/* Keeping track of the number of analog VGA connectors. */
unsigned int numberVGA;
+ /* Keeping track of the number of DVI connectors. */
+ unsigned int numberDVI;
+
CARD8 mappedI2CBus;
xf86OutputPtr tv;
diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index 1fe58aa..ba95269 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -379,6 +379,7 @@ viaVT1632Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus)
{
xf86OutputPtr output;
VIAPtr pVia = VIAPTR(pScrn);
+ VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
viaVT1632RecPtr pVIAVT1632Rec = NULL;
I2CDevPtr pI2CDevice = NULL;
I2CSlaveAddr i2cAddr = 0x10;
@@ -461,7 +462,7 @@ viaVT1632Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus)
/* The code to dynamically designate the particular DVI (i.e., DVI-1,
* DVI-2, etc.) for xrandr was borrowed from xf86-video-r128 DDX. */
- sprintf(outputNameBuffer, "DVI-%d", (pVia->numberDVI + 1));
+ sprintf(outputNameBuffer, "DVI-%d", (pVIADisplay->numberDVI + 1));
output = xf86OutputCreate(pScrn, &via_vt1632_funcs, outputNameBuffer);
if (!output) {
free(pVIAVT1632Rec);
@@ -486,7 +487,7 @@ viaVT1632Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus)
viaVT1632DumpRegisters(pScrn, pI2CDevice);
- pVia->numberDVI++;
+ pVIADisplay->numberDVI++;
status = TRUE;
exit:
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
commit 0ffa8877bdbbc2cef0002db38a739614c8cea67e
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon May 22 11:21:47 2017 -0700
Removing viaTMDSSense
This function does not really do anything.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_tmds.c b/src/via_tmds.c
index 1405ef4..5613178 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -154,32 +154,6 @@ viaTMDSInitReg(ScrnInfoPtr pScrn)
}
/*
- * Returns TMDS receiver detection state for VIA Technologies IGP
- * integrated TMDS transmitter.
- */
-static Bool
-viaTMDSSense(ScrnInfoPtr pScrn)
-{
- vgaHWPtr hwp = VGAHWPTR(pScrn);
- VIAPtr pVia = VIAPTR(pScrn);
- CARD8 tmdsReceiverDetected = 0x00;
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered viaTMDSSense.\n"));
-
- /* For now, faking DVI detection.*/
- tmdsReceiverDetected = 0x01;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Integrated TMDS transmitter %s a TMDS receiver.\n",
- (tmdsReceiverDetected & 0x01) ? "detected" : "did not detect");
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting viaTMDSSense.\n"));
- return tmdsReceiverDetected;
-}
-
-/*
* Sets integrated TMDS (DVI) monitor power state.
*/
static void
@@ -898,40 +872,35 @@ via_tmds_detect(xf86OutputPtr output)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Entered via_tmds_detect.\n"));
- /* Check for DVI presence by sensing the TMDS receiver connected
- * to the integrated TMDS transmitter. */
- if (viaTMDSSense(pScrn)) {
+ if (!pVia->pI2CBus2) {
+ goto exit;
+ }
- if (!pVia->pI2CBus2) {
- goto exit;
- }
+ /* Assume that only I2C bus 2 is used for the DVI connected to the
+ * integrated TMDS transmitter. */
+ if (!xf86I2CProbeAddress(pVia->pI2CBus2, 0xA0)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "I2C device on I2C Bus 2 does not support EDID.\n");
+ goto exit;
+ }
- /* Assume that only I2C bus 2 is used for the DVI connected to the
- * integrated TMDS transmitter. */
- if (!xf86I2CProbeAddress(pVia->pI2CBus2, 0xA0)) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "I2C device on I2C Bus 2 does not support EDID.\n");
- goto exit;
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Obtaining EDID for DVI.\n");
+
+ /* Since DVI presence was established, access the I2C bus,
+ * in order to obtain EDID from the monitor. */
+ mon = xf86OutputGetEDID(output, pVia->pI2CBus2);
+ /* Is the interface type digital? */
+ if (mon && DIGITAL(mon->features.input_type)) {
+ status = XF86OutputStatusConnected;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Obtaining EDID for DVI.\n");
-
- /* Since DVI presence was established, access the I2C bus,
- * in order to obtain EDID from the monitor. */
- mon = xf86OutputGetEDID(output, pVia->pI2CBus2);
-
- /* Is the interface type digital? */
- if (mon && DIGITAL(mon->features.input_type)) {
- status = XF86OutputStatusConnected;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected a monitor connected to DVI.\n");
- xf86OutputSetEDID(output, mon);
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Could not obtain EDID from a monitor "
- "connected to DVI.\n");
- }
+ "Detected a monitor connected to DVI.\n");
+ xf86OutputSetEDID(output, mon);
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Could not obtain EDID from a monitor "
+ "connected to DVI.\n");
}
exit:
commit 0b23b185ad3152584f45a2116df00e409b49b60a
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon May 22 11:17:26 2017 -0700
Changed viaTMDSInitRegisters to viaTMDSInitReg
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_tmds.c b/src/via_tmds.c
index 1a87ee0..1405ef4 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -44,16 +44,68 @@
/*
+ * Sets the polarity of horizontal synchronization and vertical
+ * synchronization.
+ */
+static void
+viaTMDSSyncPolarity(ScrnInfoPtr pScrn, unsigned int flags)
+{
+ CARD8 syncPolarity = 0x00;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered viaTMDSSyncPolarity.\n"));
+
+ if (flags & V_NHSYNC) {
+ syncPolarity |= BIT(0);
+ }
+
+ if (flags & V_NHSYNC) {
+ syncPolarity |= BIT(1);
+ }
+
+ viaTMDSSetSyncPolarity(pScrn, syncPolarity);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "TMDS (DVI) Horizontal Sync Polarity: %s\n",
+ (syncPolarity & BIT(0)) ? "-" : "+");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "TMDS (DVI) Vertical Sync Polarity: %s\n",
+ (syncPolarity & BIT(1)) ? "-" : "+");
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting viaTMDSSyncPolarity.\n"));
+}
+
+/*
+ * Sets TMDS (DVI) display source.
+ */
+static void
+viaTMDSDisplaySource(ScrnInfoPtr pScrn, int index)
+{
+ CARD8 displaySource = index;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered viaTMDSDisplaySource.\n"));
+
+ viaTMDSSetDisplaySource(pScrn, displaySource & 0x01);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "TMDS (DVI) Display Source: IGA%d\n",
+ (displaySource & 0x01) + 1);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting viaTMDSDisplaySource.\n"));
+}
+
+/*
* Initializes most registers related to VIA Technologies IGP
* integrated TMDS transmitter. Synchronization polarity and
* display output source need to be set separately. */
static void
-viaTMDSInitRegisters(ScrnInfoPtr pScrn)
+viaTMDSInitReg(ScrnInfoPtr pScrn)
{
vgaHWPtr hwp = VGAHWPTR(pScrn);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered viaTMDSInitRegisters.\n"));
+ "Entered viaTMDSInitReg.\n"));
/* Activate DVI + LVDS2 mode. */
/* 3X5.D2[5:4] - Display Channel Select
@@ -98,59 +150,7 @@ viaTMDSInitRegisters(ScrnInfoPtr pScrn)
ViaSeqMask(hwp, 0x2B, 0x40, 0x40);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting viaTMDSInitRegisters.\n"));
-}
-
-/*
- * Sets the polarity of horizontal synchronization and vertical
- * synchronization.
- */
-static void
-viaTMDSSyncPolarity(ScrnInfoPtr pScrn, unsigned int flags)
-{
- CARD8 syncPolarity = 0x00;
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered viaTMDSSyncPolarity.\n"));
-
- if (flags & V_NHSYNC) {
- syncPolarity |= BIT(0);
- }
-
- if (flags & V_NHSYNC) {
- syncPolarity |= BIT(1);
- }
-
- viaTMDSSetSyncPolarity(pScrn, syncPolarity);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "TMDS (DVI) Horizontal Sync Polarity: %s\n",
- (syncPolarity & BIT(0)) ? "-" : "+");
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "TMDS (DVI) Vertical Sync Polarity: %s\n",
- (syncPolarity & BIT(1)) ? "-" : "+");
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting viaTMDSSyncPolarity.\n"));
-}
-
-/*
- * Sets TMDS (DVI) display source.
- */
-static void
-viaTMDSDisplaySource(ScrnInfoPtr pScrn, int index)
-{
- CARD8 displaySource = index;
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered viaTMDSDisplaySource.\n"));
-
- viaTMDSSetDisplaySource(pScrn, displaySource & 0x01);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "TMDS (DVI) Display Source: IGA%d\n",
- (displaySource & 0x01) + 1);
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting viaTMDSDisplaySource.\n"));
+ "Exiting viaTMDSInitReg.\n"));
}
/*
@@ -875,7 +875,7 @@ via_tmds_mode_set(xf86OutputPtr output, DisplayModePtr mode,
if (output->crtc) {
/* Initialize VIA IGP integrated TMDS transmitter registers. */
- viaTMDSInitRegisters(pScrn);
+ viaTMDSInitReg(pScrn);
/* Set integrated TMDS transmitter sync polarity. */
viaTMDSSyncPolarity(pScrn, adjusted_mode->Flags);
More information about the Openchrome-devel
mailing list