From f1ceac0174f723d71c0b97a20b0e869c4996c545 Mon Sep 17 00:00:00 2001 From: Kevin Brace Date: Sat, 16 Jan 2016 21:07:21 -0600 Subject: [PATCH 3/7] Added debug messages to via_vt1632.c Added debug messages to via_vt1632.c in order to aid the debugging effort. --- src/via_vt1632.c | 79 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 31 deletions(-) diff --git a/src/via_vt1632.c b/src/via_vt1632.c index d90320a..9b6a0a6 100644 --- a/src/via_vt1632.c +++ b/src/via_vt1632.c @@ -143,7 +143,8 @@ via_vt1632_detect(xf86OutputPtr output) xf86I2CReadByte(Private->VT1632I2CDev, 0x09, &tmp); if (tmp && 0x02) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: DVI is connected\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "VT1632: DVI device is detected.\n"); status = XF86OutputStatusConnected; } @@ -152,41 +153,55 @@ via_vt1632_detect(xf86OutputPtr output) 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_WARNING, + "VT1632A DVI transmitter not detected.\n"); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Exiting via_vt1632_probe.\n")); + return FALSE; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "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) { + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "xnfcalloc failed.\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; @@ -200,5 +215,7 @@ via_vt1632_init(ScrnInfoPtr pScrn, I2CDevPtr pDev) via_vt1632_dump_registers(pScrn, pDev); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Exiting via_vt1632_init.\n")); return Private; } -- 1.7.9.5