Hi,
I've been looking at the i2c code lately, and I have a few questions.
Why don't we scan the first i2C bus in ViaI2CInit ?
Why is I2CScan a debug only option ? Are there any risks induced in
scanning the i2c buses ?
See attached patch
Regards,
Xavier
Index: src/via_driver.c
===================================================================
--- src/via_driver.c (revision 750)
+++ src/via_driver.c (working copy)
@@ -189,8 +189,8 @@
#ifdef HAVE_DEBUG
OPTION_PRINTVGAREGS,
OPTION_PRINTTVREGS,
+#endif
OPTION_I2CSCAN,
-#endif
OPTION_VBEMODES,
OPTION_NOACCEL,
OPTION_ACCELMETHOD,
@@ -1558,13 +1561,13 @@
pVia->PrintVGARegs ? "" : "not ");
if (pVia->PrintVGARegs)
ViaVgahwPrint(VGAHWPTR(pScrn)); /* Do this as early as possible */
+#endif /* HAVE_DEBUG */
pVia->I2CScan = FALSE;
from = xf86GetOptValBool(VIAOptions, OPTION_I2CSCAN, &pVia->I2CScan)
? X_CONFIG : X_DEFAULT;
xf86DrvMsg(pScrn->scrnIndex, from, "Will %sscan I2C buses.\n",
pVia->I2CScan ? "" : "not ");
-#endif /* HAVE_DEBUG */
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"...Finished parsing config file options.\n");
Index: src/via_i2c.c
===================================================================
--- src/via_i2c.c (revision 750)
+++ src/via_i2c.c (working copy)
@@ -341,7 +341,6 @@
}
-#ifdef HAVE_DEBUG
static void
ViaI2CScan(I2CBusPtr Bus)
{
@@ -355,7 +354,6 @@
xf86DrvMsg(Bus->scrnIndex, X_PROBED, "Found slave on %s "
"- 0x%02X\n", Bus->BusName, i);
}
-#endif /* HAVE_DEBUG */
void
@@ -369,12 +367,12 @@
pVia->pI2CBus2 = ViaI2CBus2Init(pScrn->scrnIndex);
pVia->pI2CBus3 = ViaI2CBus3Init(pScrn->scrnIndex);
-#ifdef HAVE_DEBUG
if (pVia->I2CScan) {
+ if (pVia->pI2CBus1)
+ ViaI2CScan(pVia->pI2CBus1);
if (pVia->pI2CBus2)
ViaI2CScan(pVia->pI2CBus2);
if (pVia->pI2CBus3)
ViaI2CScan(pVia->pI2CBus3);
}
-#endif
}
_______________________________________________
Openchrome-devel mailing list
[email protected]
http://wiki.openchrome.org/mailman/listinfo/openchrome-devel