[Openchrome-devel] xf86-video-openchrome: 2 commits - src/via_outputs.c src/via_vt1632.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Sat Feb 20 10:21:41 UTC 2016


 src/via_outputs.c |   27 ++++++++
 src/via_vt1632.c  |  177 +++++++++++++++++++++++++++++++++++++-----------------
 2 files changed, 149 insertions(+), 55 deletions(-)

New commits:
commit 19f47226eba40d2fd5c2c770bc3542d12efa1d57
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Sat Feb 20 02:12:57 2016 -0800

    Added debug messages to via_dvi_init
    
    Added debug messages to via_dvi_init function inside via_outputs.c.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index 2cada37..e57fe53 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -1008,20 +1008,39 @@ via_dvi_init(ScrnInfoPtr pScrn)
     I2CDevPtr pDev = NULL;
     I2CSlaveAddr addr = 0x10;
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered via_dvi_init.\n"));
+
     if (!pVia->pI2CBus2 || !pVia->pI2CBus3) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                    "I2C Bus 2 or I2C Bus 3 does not exist.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                    "Exiting via_dvi_init.\n"));
         return;
     }
 
     if (xf86I2CProbeAddress(pVia->pI2CBus3, addr)) {
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "VT1632A found on I2C Bus 3.\n");
         pBus = pVia->pI2CBus3;
     } else if (xf86I2CProbeAddress(pVia->pI2CBus2, addr)) {
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "VT1632A found on I2C Bus 2.\n");
         pBus = pVia->pI2CBus2;
     } else {
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "VT1632A not found on I2C Bus 2 or I2C Bus 3.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting via_dvi_init.\n"));
         return;
     }
 
     pDev = xf86CreateI2CDevRec();
     if (!pDev) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                    "Failed to create I2C bus structure.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting via_dvi_init.\n"));
         return;
     }
 
@@ -1030,17 +1049,25 @@ via_dvi_init(ScrnInfoPtr pScrn)
     pDev->pI2CBus = pBus;
     if (!xf86I2CDevInit(pDev)) {
         xf86DestroyI2CDevRec(pDev, TRUE);
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                    "Failed to initialize a device on I2C bus.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting via_dvi_init.\n"));
         return;
     }
 
     if (!via_vt1632_probe(pScrn, pDev)) {
         xf86DestroyI2CDevRec(pDev, TRUE);
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting via_dvi_init.\n"));
         return;
     }
 
     private_data = via_vt1632_init(pScrn, pDev);
     if (!private_data) {
         xf86DestroyI2CDevRec(pDev, TRUE);
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting via_dvi_init.\n"));
         return;
     }
 
commit b89cfe5583e02c87ea28384a5f6ace5372ae115f
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Sat Feb 20 01:51:04 2016 -0800

    Added debug messages to via_vt1632.c
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index d90320a..9a72cc6 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -47,14 +47,20 @@ xf86I2CMaskByte(I2CDevPtr d, I2CByte subaddr, I2CByte value, I2CByte mask)
 static void
 via_vt1632_dump_registers(ScrnInfoPtr pScrn, I2CDevPtr pDev)
 {
-	int i;
-	CARD8 tmp;
+    int i;
+    CARD8 tmp;
 
-	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: dumping registers:\n"));
-	for (i = 0; i <= 0x0f; i++) {
-		xf86I2CReadByte(pDev, i, &tmp);
-		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: 0x%02x: 0x%02x\n", i, tmp));
-	}
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered via_vt1632_dump_registers.\n"));
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632A: dumping registers:\n"));
+    for (i = 0; i <= 0x0f; i++) {
+        xf86I2CReadByte(pDev, i, &tmp);
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632A: 0x%02x: 0x%02x\n", i, tmp));
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting via_vt1632_dump_registers.\n"));
 }
 
 
@@ -64,14 +70,19 @@ via_vt1632_power(xf86OutputPtr output, BOOL on)
 	struct ViaVT1632PrivateData * Private = output->driver_private;
 	ScrnInfoPtr pScrn = output->scrn;
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered via_vt1632_power.\n"));
 
 	if (on == TRUE) {
-		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: power on\n"));
 		xf86I2CMaskByte(Private->VT1632I2CDev, 0x08, 0x01, 0x01);
 	} else {
-		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: power off\n"));
 		xf86I2CMaskByte(Private->VT1632I2CDev, 0x08, 0x00, 0x01);
 	}
+
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632A: Power %s.\n",
+                on ? "On" : "Off");
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting via_vt1632_power.\n"));
 }
 
 void
@@ -80,13 +91,19 @@ via_vt1632_save(xf86OutputPtr output)
 	struct ViaVT1632PrivateData * Private = output->driver_private;
 	ScrnInfoPtr pScrn = output->scrn;
 
-	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-		"VT1632: saving state of registers 0x08, 0x09, 0x0A and 0x0C\n"));
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered via_vt1632_save.\n"));
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "VT1632A: Saving the content of registers "
+                        "0x08, 0x09, 0x0A, and 0x0C.\n"));
 	xf86I2CReadByte(Private->VT1632I2CDev, 0x08, &Private->Register08);
 	xf86I2CReadByte(Private->VT1632I2CDev, 0x09, &Private->Register09);
 	xf86I2CReadByte(Private->VT1632I2CDev, 0x0A, &Private->Register0A);
 	xf86I2CReadByte(Private->VT1632I2CDev, 0x0C, &Private->Register0C);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting via_vt1632_save.\n"));
 }
 
 void
@@ -95,26 +112,45 @@ via_vt1632_restore(xf86OutputPtr output)
 	struct ViaVT1632PrivateData * Private = output->driver_private;
 	ScrnInfoPtr pScrn = output->scrn;
 
-	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-		"VT1632: restoring register 0x08, 0x09, 0x0A and 0x0C\n"));
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered via_vt1632_restore.\n"));
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "VT1632A: Restoring registers 0x08, 0x09, "
+                        "0x0A, and 0x0C.\n"));
 	xf86I2CWriteByte(Private->VT1632I2CDev, 0x08, Private->Register08);
 	xf86I2CWriteByte(Private->VT1632I2CDev, 0x09, Private->Register09);
 	xf86I2CWriteByte(Private->VT1632I2CDev, 0x0A, Private->Register0A);
 	xf86I2CWriteByte(Private->VT1632I2CDev, 0x0C, Private->Register0C);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting via_vt1632_restore.\n"));
 }
 
 int
 via_vt1632_mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
 {
-	struct ViaVT1632PrivateData * Private = output->driver_private;
+    struct ViaVT1632PrivateData * Private = output->driver_private;
+	ScrnInfoPtr pScrn = output->scrn;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
+                        "Entered via_vt1632_mode_valid.\n"));
 
-	if (pMode->Clock < Private->DotclockMin)
-		return MODE_CLOCK_LOW;
+    if (pMode->Clock < Private->DotclockMin) {
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting via_vt1632_mode_valid.\n"));
+        return MODE_CLOCK_LOW;
+    }
 
-	if (pMode->Clock > Private->DotclockMax)
-		return MODE_CLOCK_HIGH;
+    if (pMode->Clock > Private->DotclockMax) {
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting via_vt1632_mode_valid.\n"));
+        return MODE_CLOCK_HIGH;
+    }
 
-	return MODE_OK;
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting via_vt1632_mode_valid.\n"));
+    return MODE_OK;
 }
 
 void
@@ -124,13 +160,19 @@ via_vt1632_mode_set(xf86OutputPtr output, DisplayModePtr mode,
 	struct ViaVT1632PrivateData * Private = output->driver_private;
 	ScrnInfoPtr pScrn = output->scrn;
 
-	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-		"VT1632: enabling DVI encoder\n"));
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
+                        "Entered via_vt1632_mode_set.\n"));
+
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+		        "VT1632A: Enabling DVI.\n");
 	xf86I2CWriteByte(Private->VT1632I2CDev, 0x0C, 0x89);
 	xf86I2CWriteByte(Private->VT1632I2CDev, 0x08,
 		VIA_VT1632_VEN | VIA_VT1632_HEN | VIA_VT1632_EDGE |
 		VIA_VT1632_PDB);
 	via_vt1632_dump_registers(pScrn, Private->VT1632I2CDev);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting via_vt1632_mode_set.\n"));
 }
 
 xf86OutputStatus
@@ -141,52 +183,74 @@ via_vt1632_detect(xf86OutputPtr output)
 	ScrnInfoPtr pScrn = output->scrn;
 	CARD8 tmp;
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
+                        "Entered via_vt1632_detect.\n"));
+
 	xf86I2CReadByte(Private->VT1632I2CDev, 0x09, &tmp);
 	if (tmp && 0x02) {
-		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: DVI is connected\n");
+		xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
+                    "VT1632A: DVI device is detected.\n");
 		status = XF86OutputStatusConnected;
 	}
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting via_vt1632_detect.\n"));
 	return status;
 }
 
 BOOL
 via_vt1632_probe(ScrnInfoPtr pScrn, I2CDevPtr pDev) {
-	CARD8 buf = 0;
-	CARD16 VendorID = 0;
-	CARD16 DeviceID = 0;
-
-	xf86I2CReadByte(pDev, 0, &buf);
-	VendorID = buf;
-	xf86I2CReadByte(pDev, 1, &buf);
-	VendorID |= buf << 8;
-
-	xf86I2CReadByte(pDev, 2, &buf);
-	DeviceID = buf;
-	xf86I2CReadByte(pDev, 3, &buf);
-	DeviceID |= buf << 8;
-
-	if (VendorID != 0x1106 || DeviceID != 0x3192) {
-		return FALSE;
-	}
-
-	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632 DVI transmitter detected\n");
-
-	return TRUE;
+    CARD8 buf = 0;
+    CARD16 VendorID = 0;
+    CARD16 DeviceID = 0;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
+                        "Entered via_vt1632_probe.\n"));
+
+    xf86I2CReadByte(pDev, 0, &buf);
+    VendorID = buf;
+    xf86I2CReadByte(pDev, 1, &buf);
+    VendorID |= buf << 8;
+
+    xf86I2CReadByte(pDev, 2, &buf);
+    DeviceID = buf;
+    xf86I2CReadByte(pDev, 3, &buf);
+    DeviceID |= buf << 8;
+
+    if (VendorID != 0x1106 || DeviceID != 0x3192) {
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "VT1632A DVI transmitter not detected.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting via_vt1632_probe.\n"));
+        return FALSE;
+    }
+
+    xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                "VT1632A DVI transmitter detected.\n");
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting via_vt1632_probe.\n"));
+    return TRUE;
 }
 
 struct ViaVT1632PrivateData *
 via_vt1632_init(ScrnInfoPtr pScrn, I2CDevPtr pDev)
 {
-	VIAPtr pVia = VIAPTR(pScrn);
-	struct ViaVT1632PrivateData * Private = NULL;
-	CARD8 buf = 0;
-
-	Private = xnfcalloc(1, sizeof(struct ViaVT1632PrivateData));
-	if (!Private) {
-		return NULL;
-	}
-	Private->VT1632I2CDev = pDev;
+    VIAPtr pVia = VIAPTR(pScrn);
+    struct ViaVT1632PrivateData * Private = NULL;
+    CARD8 buf = 0;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered via_vt1632_init.\n"));
+
+    Private = xnfcalloc(1, sizeof(struct ViaVT1632PrivateData));
+    if (!Private) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                    "Failed to allocate memory for DVI initialization.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting via_vt1632_init.\n"));
+        return NULL;
+    }
+    Private->VT1632I2CDev = pDev;
 
 	xf86I2CReadByte(pDev, 0x06, &buf);
 	Private->DotclockMin = buf * 1000;
@@ -194,11 +258,14 @@ via_vt1632_init(ScrnInfoPtr pScrn, I2CDevPtr pDev)
 	xf86I2CReadByte(pDev, 0x07, &buf);
 	Private->DotclockMax = (buf + 65) * 1000;
 
-	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: dotclock range %d-%dMHz\n",
-			Private->DotclockMin / 1000,
-			Private->DotclockMax / 1000);
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632A: Dot Clock Range: %d "
+                "to %d MHz.\n",
+                Private->DotclockMin / 1000,
+                Private->DotclockMax / 1000);
 
 	via_vt1632_dump_registers(pScrn, pDev);
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting via_vt1632_init.\n"));
 	return Private;
 }


More information about the Openchrome-devel mailing list