[Openchrome-devel] xf86-video-openchrome: 8 commits - configure.ac src/via_sii164.c src/via_sii164.h src/via_tmds.c src/via_ums.h
Kevin Brace
kevinbrace at kemper.freedesktop.org
Mon Jan 1 09:30:27 UTC 2018
configure.ac | 2
src/via_sii164.c | 258 ++++++++++++++++++++++++++++++++++++++++---------------
src/via_sii164.h | 9 +
src/via_tmds.c | 44 +++------
src/via_ums.h | 3
5 files changed, 214 insertions(+), 102 deletions(-)
New commits:
commit 9ba6fb5f5ed8af124e6331f8c7c9f4da88812ac4
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 1 03:28:51 2018 -0600
Version bumped to 0.6.163
Brought the Silicon Image SiI 164 code up to date (i.e., transferring
the proven code written for VIA Technologies VT1632(A).). Also, fix
for SiI 164 not restoring the display after standby resume.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/configure.ac b/configure.ac
index ab6b421..77c2dfb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ(2.57)
AC_INIT([xf86-video-openchrome],
- [0.6.162],
+ [0.6.163],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
[xf86-video-openchrome])
commit 5b8ce6713a94032baee6fdea0095a4eea28ceb44
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 1 03:22:18 2018 -0600
Fully implement SiI 164 prepare and commit callbacks
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_sii164.c b/src/via_sii164.c
index ba7d57f..d20a949 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -256,11 +256,33 @@ via_sii164_mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
static void
via_sii164_prepare(xf86OutputPtr output)
{
+ ScrnInfoPtr pScrn = output->scrn;
+ viaSiI164RecPtr pSiI164Rec = output->driver_private;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered %s.\n", __func__));
+
+ viaSiI164Power(pScrn, pSiI164Rec->pSiI164I2CDev, FALSE);
+ viaExtTMDSIOPadState(pScrn, pSiI164Rec->diPort, FALSE);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting %s.\n", __func__));
}
static void
via_sii164_commit(xf86OutputPtr output)
{
+ ScrnInfoPtr pScrn = output->scrn;
+ viaSiI164RecPtr pSiI164Rec = output->driver_private;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered %s.\n", __func__));
+
+ viaSiI164Power(pScrn, pSiI164Rec->pSiI164I2CDev, TRUE);
+ viaExtTMDSIOPadState(pScrn, pSiI164Rec->diPort, TRUE);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting %s.\n", __func__));
}
static void
commit 84e94e93fb01d8f35f6982e544fe7741177d2c57
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 1 03:13:27 2018 -0600
Actively control I/O pads connected to SiI 164 for DPMS
This commit is essentially identical to commit 440a980. Previously,
the state of I/O pads connected to SiI 164 was not actively controlled
from the DPMS callback. This led to DVI display going blank after
standby resume. This issue is now fixed.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_sii164.c b/src/via_sii164.c
index f69fc75..ba7d57f 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -30,6 +30,7 @@
#endif
#include "via_driver.h"
+#include "via_ums.h"
#include "via_sii164.h"
static void
@@ -192,11 +193,13 @@ via_sii164_dpms(xf86OutputPtr output, int mode)
switch (mode) {
case DPMSModeOn:
viaSiI164Power(pScrn, pSiI164Rec->pSiI164I2CDev, TRUE);
+ viaExtTMDSIOPadState(pScrn, pSiI164Rec->diPort, TRUE);
break;
case DPMSModeStandby:
case DPMSModeSuspend:
case DPMSModeOff:
viaSiI164Power(pScrn, pSiI164Rec->pSiI164I2CDev, FALSE);
+ viaExtTMDSIOPadState(pScrn, pSiI164Rec->diPort, FALSE);
break;
default:
break;
commit 61700003c6a1ed2ab931abd17cdf407a3c7bb491
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 1 03:06:22 2018 -0600
Complete rewrite of via_sii164_detect
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_sii164.c b/src/via_sii164.c
index c6f32cc..f69fc75 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -290,25 +290,48 @@ via_sii164_mode_set(xf86OutputPtr output, DisplayModePtr mode,
static xf86OutputStatus
via_sii164_detect(xf86OutputPtr output)
{
- xf86MonPtr mon;
- xf86OutputStatus status = XF86OutputStatusDisconnected;
ScrnInfoPtr pScrn = output->scrn;
- viaSiI164RecPtr pSiI164Rec = output->driver_private;
+ xf86MonPtr pMon;
+ xf86OutputStatus status = XF86OutputStatusDisconnected;
+ I2CBusPtr pI2CBus;
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ viaSiI164RecPtr pSiI164Rec = (viaSiI164RecPtr) output->driver_private;
+ Bool connectorDetected;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered via_sii_164_detect.\n"));
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Probing for a DVI connector . . .\n");
+
+ connectorDetected = viaSiI164Sense(pScrn, pSiI164Rec->pSiI164I2CDev);
+ if (!connectorDetected) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "DVI connector not detected.\n");
+ goto exit;
+ }
- /* Check for the DVI presence via SiI 164 first before accessing
- * I2C bus. */
- if (viaSiI164Sense(pScrn, pSiI164Rec->pSiI164I2CDev)) {
+ status = XF86OutputStatusConnected;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "DVI connector detected.\n");
- /* Since DVI presence was established, access the I2C bus
- * assigned to DVI. */
- mon = xf86OutputGetEDID(output, pSiI164Rec->pSiI164I2CDev->pI2CBus);
+ if (pSiI164Rec->i2cBus & VIA_I2C_BUS2) {
+ pI2CBus = pVIADisplay->pI2CBus2;
+ } else if (pSiI164Rec->i2cBus & VIA_I2C_BUS3) {
+ pI2CBus = pVIADisplay->pI2CBus3;
+ } else {
+ pI2CBus = NULL;
+ }
+
+ if (pI2CBus) {
+ pMon = xf86OutputGetEDID(output, pI2CBus);
/* Is the interface type digital? */
- if (mon && DIGITAL(mon->features.input_type)) {
- status = XF86OutputStatusConnected;
+ if (pMon && DIGITAL(pMon->features.input_type)) {
+ xf86OutputSetEDID(output, pMon);
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 "
@@ -316,6 +339,9 @@ via_sii164_detect(xf86OutputPtr output)
}
}
+exit:
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting via_sii_164_detect.\n"));
return status;
}
commit c9ad17da1302f646c41f5c825e25e0715f942683
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 1 02:15:22 2018 -0600
Major update to SiI 164 initialization code
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_sii164.c b/src/via_sii164.c
index 1e049fa..c6f32cc 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -437,23 +437,35 @@ exit:
return status;
}
-Bool
-viaSiI164Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus)
+void
+viaSiI164Init(ScrnInfoPtr pScrn)
{
xf86OutputPtr output;
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
- viaSiI164RecPtr pSiI164Rec = NULL;
- I2CDevPtr pI2CDevice = NULL;
+ viaSiI164RecPtr pVIASiI164;
+ I2CBusPtr pI2CBus;
+ I2CDevPtr pI2CDevice;
I2CSlaveAddr i2cAddr = 0x70;
- CARD8 buf;
- CARD16 vendorID, deviceID;
- Bool status = FALSE;
+ CARD8 i2cData;
char outputNameBuffer[32];
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Entered viaSiI164Init.\n"));
+ if ((!(pVIADisplay->extTMDSPresence)) ||
+ (pVIADisplay->extTMDSTransmitter != VIA_TMDS_SII164)) {
+ goto exit;
+ }
+
+ if (pVIADisplay->extTMDSI2CBus & VIA_I2C_BUS2) {
+ pI2CBus = pVIADisplay->pI2CBus2;
+ } else if (pVIADisplay->extTMDSI2CBus & VIA_I2C_BUS3) {
+ pI2CBus = pVIADisplay->pI2CBus3;
+ } else {
+ goto exit;
+ }
+
if (!xf86I2CProbeAddress(pI2CBus, i2cAddr)) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"I2C device not found.\n");
@@ -477,83 +489,65 @@ viaSiI164Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus)
goto exit;
}
- xf86I2CReadByte(pI2CDevice, 0, &buf);
- vendorID = buf;
- xf86I2CReadByte(pI2CDevice, 1, &buf);
- vendorID |= buf << 8;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Vendor ID: 0x%04x\n", vendorID));
-
- xf86I2CReadByte(pI2CDevice, 2, &buf);
- deviceID = buf;
- xf86I2CReadByte(pI2CDevice, 3, &buf);
- deviceID |= buf << 8;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Device ID: 0x%04x\n", deviceID));
-
- if ((vendorID != 0x0001) || (deviceID != 0x0006)) {
+ pVIASiI164 = (viaSiI164RecPtr) xnfcalloc(1, sizeof(viaSiI164Rec));
+ if (!pVIASiI164) {
xf86DestroyI2CDevRec(pI2CDevice, TRUE);
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiI 164 external TMDS transmitter not detected.\n");
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate storage for "
+ "SiI 164.\n"));
goto exit;
}
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiI 164 external TMDS transmitter detected.\n");
-
- pSiI164Rec = xnfcalloc(1, sizeof(viaSiI164Rec));
- if (!pSiI164Rec) {
+ /* 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_sii164_funcs, outputNameBuffer);
+ if (!output) {
+ free(pVIASiI164);
xf86DestroyI2CDevRec(pI2CDevice, TRUE);
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate working storage for SiI 164.\n");
+ "Failed to create X Server display output "
+ "for SiI 164.\n");
goto exit;
}
+ /* Increment the number of DVI connectors. */
+ pVIADisplay->numberDVI++;
+
// Remembering which I2C bus is used for SiI 164.
- pSiI164Rec->pSiI164I2CDev = pI2CDevice;
+ pVIASiI164->pSiI164I2CDev = pI2CDevice;
- xf86I2CReadByte(pI2CDevice, 0x06, &buf);
- pSiI164Rec->DotclockMin = buf * 1000;
+ pVIASiI164->diPort = pVIADisplay->extTMDSDIPort;
- xf86I2CReadByte(pI2CDevice, 0x07, &buf);
- pSiI164Rec->DotclockMax = (buf + 65) * 1000;
+ /* Hint about which I2C bus to access for obtaining EDID. */
+ pVIASiI164->i2cBus = pVIADisplay->extTMDSI2CBus;
+
+ pVIASiI164->transmitter = pVIADisplay->extTMDSTransmitter;
+
+ xf86I2CReadByte(pI2CDevice, 0x06, &i2cData);
+ pVIASiI164->DotclockMin = i2cData * 1000;
+
+ xf86I2CReadByte(pI2CDevice, 0x07, &i2cData);
+ pVIASiI164->DotclockMax = (i2cData + 65) * 1000;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Supported SiI 164 Dot Clock Range: "
"%d to %d MHz\n",
- pSiI164Rec->DotclockMin / 1000,
- pSiI164Rec->DotclockMax / 1000);
-
- /* 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", (pVIADisplay->numberDVI + 1));
- output = xf86OutputCreate(pScrn, &via_sii164_funcs, outputNameBuffer);
- if (!output) {
- free(pSiI164Rec);
- xf86DestroyI2CDevRec(pI2CDevice, TRUE);
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate X Server display output record for "
- "SiI 164.\n");
- goto exit;
- }
+ pVIASiI164->DotclockMin / 1000,
+ pVIASiI164->DotclockMax / 1000);
- output->driver_private = pSiI164Rec;
+ output->driver_private = pVIASiI164;
/* 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;
- viaSiI164DumpRegisters(pScrn, pI2CDevice);
-
- pVIADisplay->numberDVI++;
- status = TRUE;
exit:
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Exiting viaSiI164Init.\n"));
- return status;
}
diff --git a/src/via_sii164.h b/src/via_sii164.h
index fd67105..1a402aa 100644
--- a/src/via_sii164.h
+++ b/src/via_sii164.h
@@ -54,6 +54,6 @@ typedef struct _viaSiI164 {
const xf86OutputFuncsRec via_sii164_funcs;
Bool viaSiI164Probe(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus);
-Bool viaSiI164Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus);
+void viaSiI164Init(ScrnInfoPtr pScrn);
#endif /* _VIA_SII164_H_ */
diff --git a/src/via_tmds.c b/src/via_tmds.c
index 1f28cce..59994a2 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -1293,38 +1293,14 @@ exit:
}
void
-via_dvi_init(ScrnInfoPtr pScrn)
+viaExtTMDSInit(ScrnInfoPtr pScrn)
{
- VIAPtr pVia = VIAPTR(pScrn);
- VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
-
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered via_dvi_init.\n"));
+ "Entered viaExtTMDSInit.\n"));
viaVT1632Init(pScrn);
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Probing I2C Bus 2 for SiI 164.\n");
- if (!viaSiI164Init(pScrn, pVIADisplay->pI2CBus2)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "I2C Bus 2 was not initialized for DVI use.\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "SiI 164 attached to I2C Bus 2 was initialized "
- "successfully for DVI use.\n");
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Probing I2C Bus 3 for SiI 164.\n");
- if (!viaSiI164Init(pScrn, pVIADisplay->pI2CBus3)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "I2C Bus 3 was not initialized for DVI use.\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "SiI 164 attached to I2C Bus 3 was initialized "
- "successfully for DVI use.\n");
- }
+ viaSiI164Init(pScrn);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting via_dvi_init.\n"));
+ "Exiting viaExtTMDSInit.\n"));
}
diff --git a/src/via_ums.h b/src/via_ums.h
index 5c97ba4..cf240a1 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -1592,7 +1592,7 @@ void viaExtTMDSSetDataDriveStrength(ScrnInfoPtr pScrn,
void viaTMDSProbe(ScrnInfoPtr pScrn);
void viaExtTMDSProbe(ScrnInfoPtr pScrn);
void viaTMDSInit(ScrnInfoPtr pScrn);
-void via_dvi_init(ScrnInfoPtr pScrn);
+void viaExtTMDSInit(ScrnInfoPtr pScrn);
/*via_tv.c */
#ifdef HAVE_DEBUG
commit b3c099273bd93273c9d21611f00c4d11684010f8
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 1 02:04:58 2018 -0600
Add new members to viaSiI164Rec struct
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_sii164.c b/src/via_sii164.c
index a504411..1e049fa 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -191,12 +191,12 @@ via_sii164_dpms(xf86OutputPtr output, int mode)
switch (mode) {
case DPMSModeOn:
- viaSiI164Power(pScrn, pSiI164Rec->SiI164I2CDev, TRUE);
+ viaSiI164Power(pScrn, pSiI164Rec->pSiI164I2CDev, TRUE);
break;
case DPMSModeStandby:
case DPMSModeSuspend:
case DPMSModeOff:
- viaSiI164Power(pScrn, pSiI164Rec->SiI164I2CDev, FALSE);
+ viaSiI164Power(pScrn, pSiI164Rec->pSiI164I2CDev, FALSE);
break;
default:
break;
@@ -215,7 +215,7 @@ via_sii164_save(xf86OutputPtr output)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Entered via_sii164_save.\n"));
- viaSiI164SaveRegisters(pScrn, pSiI164Rec->SiI164I2CDev, pSiI164Rec);
+ viaSiI164SaveRegisters(pScrn, pSiI164Rec->pSiI164I2CDev, pSiI164Rec);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Exiting via_sii164_save.\n"));
@@ -230,7 +230,7 @@ via_sii164_restore(xf86OutputPtr output)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Entered via_sii164_restore.\n"));
- viaSiI164RestoreRegisters(pScrn, pSiI164Rec->SiI164I2CDev,
+ viaSiI164RestoreRegisters(pScrn, pSiI164Rec->pSiI164I2CDev,
pSiI164Rec);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -276,9 +276,9 @@ via_sii164_mode_set(xf86OutputPtr output, DisplayModePtr mode,
viaExtTMDSSetDataDriveStrength(pScrn, 0x03);
viaExtTMDSEnableIOPads(pScrn, 0x03);
- viaSiI164DumpRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
- viaSiI164InitRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
- viaSiI164DumpRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
+ viaSiI164DumpRegisters(pScrn, pSiI164Rec->pSiI164I2CDev);
+ viaSiI164InitRegisters(pScrn, pSiI164Rec->pSiI164I2CDev);
+ viaSiI164DumpRegisters(pScrn, pSiI164Rec->pSiI164I2CDev);
viaExtTMDSSetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
}
@@ -297,11 +297,11 @@ via_sii164_detect(xf86OutputPtr output)
/* Check for the DVI presence via SiI 164 first before accessing
* I2C bus. */
- if (viaSiI164Sense(pScrn, pSiI164Rec->SiI164I2CDev)) {
+ if (viaSiI164Sense(pScrn, pSiI164Rec->pSiI164I2CDev)) {
/* Since DVI presence was established, access the I2C bus
* assigned to DVI. */
- mon = xf86OutputGetEDID(output, pSiI164Rec->SiI164I2CDev->pI2CBus);
+ mon = xf86OutputGetEDID(output, pSiI164Rec->pSiI164I2CDev->pI2CBus);
/* Is the interface type digital? */
if (mon && DIGITAL(mon->features.input_type)) {
@@ -510,7 +510,7 @@ viaSiI164Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus)
}
// Remembering which I2C bus is used for SiI 164.
- pSiI164Rec->SiI164I2CDev = pI2CDevice;
+ pSiI164Rec->pSiI164I2CDev = pI2CDevice;
xf86I2CReadByte(pI2CDevice, 0x06, &buf);
pSiI164Rec->DotclockMin = buf * 1000;
diff --git a/src/via_sii164.h b/src/via_sii164.h
index 088e694..fd67105 100644
--- a/src/via_sii164.h
+++ b/src/via_sii164.h
@@ -36,7 +36,11 @@
#define VIA_SII164_PDB 0x01
typedef struct _viaSiI164 {
- I2CDevPtr SiI164I2CDev;
+ I2CDevPtr pSiI164I2CDev;
+
+ uint32_t diPort;
+ uint8_t i2cBus;
+ uint8_t transmitter;
int DotclockMin;
int DotclockMax;
commit ec065677012acfc4243b77fc38695b4517595db9
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Sun Dec 31 01:05:22 2017 -0600
Probe for Silicon Image SiI 164 when probing for DVI
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_tmds.c b/src/via_tmds.c
index a429b15..1f28cce 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -1118,12 +1118,17 @@ viaExtTMDSProbe(ScrnInfoPtr pScrn)
if ((!(pVIADisplay->extTMDSPresence)) &&
((pVIADisplay->pI2CBus2) &&
- (~(pVIADisplay->mappedI2CBus & VIA_I2C_BUS2)))) {
+ (~(pVIADisplay->mappedI2CBus & VIA_I2C_BUS2)))) {
if (viaVT1632Probe(pScrn, pVIADisplay->pI2CBus2)) {
pVIADisplay->extTMDSPresence = TRUE;
pVIADisplay->extTMDSI2CBus = VIA_I2C_BUS2;
pVIADisplay->extTMDSTransmitter = VIA_TMDS_VT1632;
pVIADisplay->mappedI2CBus |= VIA_I2C_BUS2;
+ } else if (viaSiI164Probe(pScrn, pVIADisplay->pI2CBus2)) {
+ pVIADisplay->extTMDSPresence = TRUE;
+ pVIADisplay->extTMDSI2CBus = VIA_I2C_BUS2;
+ pVIADisplay->extTMDSTransmitter = VIA_TMDS_SII164;
+ pVIADisplay->mappedI2CBus |= VIA_I2C_BUS2;
}
}
@@ -1135,6 +1140,11 @@ viaExtTMDSProbe(ScrnInfoPtr pScrn)
pVIADisplay->extTMDSI2CBus = VIA_I2C_BUS3;
pVIADisplay->extTMDSTransmitter = VIA_TMDS_VT1632;
pVIADisplay->mappedI2CBus |= VIA_I2C_BUS3;
+ } else if (viaSiI164Probe(pScrn, pVIADisplay->pI2CBus3)) {
+ pVIADisplay->extTMDSPresence = TRUE;
+ pVIADisplay->extTMDSI2CBus = VIA_I2C_BUS3;
+ pVIADisplay->extTMDSTransmitter = VIA_TMDS_SII164;
+ pVIADisplay->mappedI2CBus |= VIA_I2C_BUS3;
}
}
diff --git a/src/via_ums.h b/src/via_ums.h
index 5bcaa83..5c97ba4 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -132,6 +132,7 @@
/* External TMDS (DVI) Transmitter Type */
#define VIA_TMDS_NONE 0x0
#define VIA_TMDS_VT1632 0x1
+#define VIA_TMDS_SII164 0x2
/* To be used with via_analog_set_dpms_control inline function. */
#define VIA_ANALOG_DPMS_ON 0x00
commit e41f3d3249c41363ef7c0d517e51f8d3dfe08efa
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Sat Dec 30 23:57:16 2017 -0600
Added viaSiI164Probe
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_sii164.c b/src/via_sii164.c
index 5541735..a504411 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -363,6 +363,81 @@ const xf86OutputFuncsRec via_sii164_funcs = {
};
Bool
+viaSiI164Probe(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus)
+{
+ I2CDevPtr pI2CDevice = NULL;
+ I2CSlaveAddr i2cAddr = 0x70;
+ CARD8 i2cData;
+ CARD16 vendorID, deviceID;
+ Bool status = FALSE;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered viaSiI164Probe.\n"));
+
+ if (!pI2CBus) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Invalid I2C bus.\n"));
+ goto exit;
+ }
+
+ if (!xf86I2CProbeAddress(pI2CBus, i2cAddr)) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "I2C bus device not found.\n"));
+ goto exit;
+ }
+
+ pI2CDevice = xf86CreateI2CDevRec();
+ if (!pI2CDevice) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to create an I2C bus device "
+ "record.\n"));
+ goto exit;
+ }
+
+ pI2CDevice->DevName = "SiI 164";
+ pI2CDevice->SlaveAddr = i2cAddr;
+ pI2CDevice->pI2CBus = pI2CBus;
+ if (!xf86I2CDevInit(pI2CDevice)) {
+ xf86DestroyI2CDevRec(pI2CDevice, TRUE);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to initialize a device on "
+ "I2C bus.\n"));
+ goto exit;
+ }
+
+ xf86I2CReadByte(pI2CDevice, 0, &i2cData);
+ vendorID = i2cData;
+ xf86I2CReadByte(pI2CDevice, 1, &i2cData);
+ vendorID |= i2cData << 8;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Vendor ID: 0x%04x\n", vendorID));
+
+ xf86I2CReadByte(pI2CDevice, 2, &i2cData);
+ deviceID = i2cData;
+ xf86I2CReadByte(pI2CDevice, 3, &i2cData);
+ deviceID |= i2cData << 8;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Device ID: 0x%04x\n", deviceID));
+
+ if ((vendorID != 0x0001) || (deviceID != 0x0006)) {
+ xf86DestroyI2CDevRec(pI2CDevice, TRUE);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "SiI 164 external TMDS transmitter not "
+ "detected.\n"));
+ goto exit;
+ }
+
+ status = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "SiI 164 external TMDS transmitter detected.\n");
+ xf86DestroyI2CDevRec(pI2CDevice, TRUE);
+exit:
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting viaSiI164Probe.\n"));
+ return status;
+}
+
+Bool
viaSiI164Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus)
{
xf86OutputPtr output;
diff --git a/src/via_sii164.h b/src/via_sii164.h
index 10077a3..088e694 100644
--- a/src/via_sii164.h
+++ b/src/via_sii164.h
@@ -49,6 +49,7 @@ typedef struct _viaSiI164 {
const xf86OutputFuncsRec via_sii164_funcs;
+Bool viaSiI164Probe(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus);
Bool viaSiI164Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus);
#endif /* _VIA_SII164_H_ */
More information about the Openchrome-devel
mailing list