xf86-video-intel: 3 commits - src/ch7017/ch7017.c src/ch7xxx/ch7xxx.c src/i830_dvo.c src/ivch/ivch.c src/sil164/sil164.c src/sil164/sil164_reg.h src/tfp410/tfp410.c src/tfp410/tfp410_reg.h

Eric Anholt anholt at kemper.freedesktop.org
Mon Oct 1 14:17:57 PDT 2007


 src/ch7017/ch7017.c     |   13 ++++++++++++-
 src/ch7xxx/ch7xxx.c     |   27 ++++++++++++++++++---------
 src/i830_dvo.c          |   14 ++++++++------
 src/ivch/ivch.c         |   20 ++++++++++++++------
 src/sil164/sil164.c     |   18 ++++++++++++------
 src/sil164/sil164_reg.h |    1 +
 src/tfp410/tfp410.c     |   18 ++++++++++++------
 src/tfp410/tfp410_reg.h |    2 ++
 8 files changed, 79 insertions(+), 34 deletions(-)

New commits:
diff-tree 29d3188ee9676f697f6fcb859c7f680f5df30318 (from 6dd8228a386334d05836353672aae9f8c456e435)
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Oct 1 13:45:09 2007 -0700

    Suppress I2C failure error messages during DVO device detection.
    
    Otherwise, errors would be printed for every chip probed which wasn't present
    on the system.

diff --git a/src/ch7xxx/ch7xxx.c b/src/ch7xxx/ch7xxx.c
index 3ef9612..3c58165 100644
--- a/src/ch7xxx/ch7xxx.c
+++ b/src/ch7xxx/ch7xxx.c
@@ -67,6 +67,8 @@ struct ch7xxx_reg_state {
 
 struct ch7xxx_priv {
     I2CDevRec d;
+    Bool quiet;
+
     struct ch7xxx_reg_state SavedReg;
     struct ch7xxx_reg_state ModeReg;
     CARD8 save_TCTL, save_TPCP, save_TPD, save_TPVT;
@@ -92,9 +94,11 @@ static Bool
 ch7xxx_read(struct ch7xxx_priv *dev_priv, int addr, unsigned char *ch)
 {
     if (!xf86I2CReadByte(&dev_priv->d, addr, ch)) {
-	xf86DrvMsg(dev_priv->d.pI2CBus->scrnIndex,
-		   X_ERROR, "Unable to read from %s Slave %d.\n",
-		   dev_priv->d.pI2CBus->BusName, dev_priv->d.SlaveAddr);
+	if (!dev_priv->quiet) {
+	    xf86DrvMsg(dev_priv->d.pI2CBus->scrnIndex,
+		       X_ERROR, "Unable to read from %s Slave %d.\n",
+		       dev_priv->d.pI2CBus->BusName, dev_priv->d.SlaveAddr);
+	}
 	return FALSE;
     }
 
@@ -106,9 +110,11 @@ static Bool
 ch7xxx_write(struct ch7xxx_priv *dev_priv, int addr, unsigned char ch)
 {
     if (!xf86I2CWriteByte(&dev_priv->d, addr, ch)) {
-	xf86DrvMsg(dev_priv->d.pI2CBus->scrnIndex, X_ERROR,
-		   "Unable to write to %s Slave %d.\n",
-		   dev_priv->d.pI2CBus->BusName, dev_priv->d.SlaveAddr);
+	if (!dev_priv->quiet) {
+	    xf86DrvMsg(dev_priv->d.pI2CBus->scrnIndex, X_ERROR,
+		       "Unable to write to %s Slave %d.\n",
+		       dev_priv->d.pI2CBus->BusName, dev_priv->d.SlaveAddr);
+	}
 	return FALSE;
     }
 
@@ -136,6 +142,7 @@ ch7xxx_init(I2CBusPtr b, I2CSlaveAddr ad
     dev_priv->d.ByteTimeout = b->ByteTimeout;
     dev_priv->d.DriverPrivate.ptr = dev_priv;
 
+    dev_priv->quiet = TRUE;
     if (!ch7xxx_read(dev_priv, CH7xxx_REG_VID, &vendor))
 	goto out;
 
@@ -159,9 +166,11 @@ ch7xxx_init(I2CBusPtr b, I2CSlaveAddr ad
 		   dev_priv->d.SlaveAddr);
 	goto out;
     }
-	xf86DrvMsg(dev_priv->d.pI2CBus->scrnIndex, X_INFO,
-		   "Detected %s chipset, vendor/device ID 0x%02x/0x%02x\n",
-		   name, vendor, device);
+    dev_priv->quiet = FALSE;
+
+    xf86DrvMsg(dev_priv->d.pI2CBus->scrnIndex, X_INFO,
+	       "Detected %s chipset, vendor/device ID 0x%02x/0x%02x\n",
+	       name, vendor, device);
 
     if (!xf86I2CDevInit(&dev_priv->d)) {
 	goto out;
diff --git a/src/ivch/ivch.c b/src/ivch/ivch.c
index bd11dd4..ac57ff3 100644
--- a/src/ivch/ivch.c
+++ b/src/ivch/ivch.c
@@ -48,6 +48,7 @@ struct ivch_priv {
     I2CDevRec	    d;
 
     xf86OutputPtr   output;
+    Bool quiet;
 
     CARD16    	    width;
     CARD16    	    height;
@@ -105,9 +106,11 @@ ivch_read(struct ivch_priv *priv, int ad
     return TRUE;
 
  fail:
-    xf86DrvMsg(priv->d.pI2CBus->scrnIndex, X_ERROR,
-	       "ivch: Unable to read register 0x%02x from %s:%02x.\n",
-	       addr, priv->d.pI2CBus->BusName, priv->d.SlaveAddr);
+    if (!priv->quiet) {
+	xf86DrvMsg(priv->d.pI2CBus->scrnIndex, X_ERROR,
+		   "ivch: Unable to read register 0x%02x from %s:%02x.\n",
+		   addr, priv->d.pI2CBus->BusName, priv->d.SlaveAddr);
+    }
     b->I2CStop(&priv->d);
 
     return FALSE;
@@ -140,9 +143,12 @@ ivch_write(struct ivch_priv *priv, int a
 
  fail:
     b->I2CStop(&priv->d);
-    xf86DrvMsg(priv->d.pI2CBus->scrnIndex, X_ERROR,
-	       "Unable to write register 0x%02x to %s:%d.\n",
-	       addr, priv->d.pI2CBus->BusName, priv->d.SlaveAddr);
+
+    if (!priv->quiet) {
+	xf86DrvMsg(priv->d.pI2CBus->scrnIndex, X_ERROR,
+		   "Unable to write register 0x%02x to %s:%d.\n",
+		   addr, priv->d.pI2CBus->BusName, priv->d.SlaveAddr);
+    }
 
     return FALSE;
 }
@@ -167,9 +173,11 @@ ivch_init(I2CBusPtr b, I2CSlaveAddr addr
     priv->d.AcknTimeout = b->AcknTimeout;
     priv->d.ByteTimeout = b->ByteTimeout;
     priv->d.DriverPrivate.ptr = priv;
+    priv->quiet = TRUE;
 
     if (!ivch_read(priv, VR00, &temp))
 	goto out;
+    priv->quiet = FALSE;
 
     /* Since the identification bits are probably zeroes, which doesn't seem
      * very unique, check that the value in the base address field matches
diff --git a/src/sil164/sil164.c b/src/sil164/sil164.c
index 60a03e2..c774a56 100644
--- a/src/sil164/sil164.c
+++ b/src/sil164/sil164.c
@@ -49,9 +49,11 @@ static Bool
 sil164ReadByte(SIL164Ptr sil, int addr, CARD8 *ch)
 {
     if (!xf86I2CReadByte(&(sil->d), addr, ch)) {
-	xf86DrvMsg(sil->d.pI2CBus->scrnIndex, X_ERROR,
-		   "Unable to read from %s Slave %d.\n",
-		   sil->d.pI2CBus->BusName, sil->d.SlaveAddr);
+	if (!sil->quiet) {
+	    xf86DrvMsg(sil->d.pI2CBus->scrnIndex, X_ERROR,
+		       "Unable to read from %s Slave %d.\n",
+		       sil->d.pI2CBus->BusName, sil->d.SlaveAddr);
+	}
 	return FALSE;
     }
     return TRUE;
@@ -61,9 +63,11 @@ static Bool
 sil164WriteByte(SIL164Ptr sil, int addr, CARD8 ch)
 {
     if (!xf86I2CWriteByte(&(sil->d), addr, ch)) {
-	xf86DrvMsg(sil->d.pI2CBus->scrnIndex, X_ERROR,
-		   "Unable to write to %s Slave %d.\n",
-		   sil->d.pI2CBus->BusName, sil->d.SlaveAddr);
+	if (!sil->quiet) {
+	    xf86DrvMsg(sil->d.pI2CBus->scrnIndex, X_ERROR,
+		       "Unable to write to %s Slave %d.\n",
+		       sil->d.pI2CBus->BusName, sil->d.SlaveAddr);
+	}
 	return FALSE;
     }
     return TRUE;
@@ -91,6 +95,7 @@ sil164_init(I2CBusPtr b, I2CSlaveAddr ad
     sil->d.AcknTimeout = b->AcknTimeout;
     sil->d.ByteTimeout = b->ByteTimeout;
     sil->d.DriverPrivate.ptr = sil;
+    sil->quiet = TRUE;
 
     if (!sil164ReadByte(sil, SIL164_VID_LO, &ch))
 	goto out;
@@ -111,6 +116,7 @@ sil164_init(I2CBusPtr b, I2CSlaveAddr ad
 		   ch, sil->d.pI2CBus->BusName, sil->d.SlaveAddr);
 	goto out;
     }
+    sil->quiet = FALSE;
 
     if (!xf86I2CDevInit(&(sil->d))) {
 	goto out;
diff --git a/src/sil164/sil164_reg.h b/src/sil164/sil164_reg.h
index ebfcb8c..734e55d 100644
--- a/src/sil164/sil164_reg.h
+++ b/src/sil164/sil164_reg.h
@@ -65,6 +65,7 @@ typedef struct _Sil164SaveRec {
 
 typedef struct {
     I2CDevRec d;
+    Bool quiet;
     SIL164SaveRec SavedReg;
     SIL164SaveRec ModeReg;
 } SIL164Rec, *SIL164Ptr;
diff --git a/src/tfp410/tfp410.c b/src/tfp410/tfp410.c
index fecb64c..bc0ad74 100644
--- a/src/tfp410/tfp410.c
+++ b/src/tfp410/tfp410.c
@@ -48,9 +48,11 @@ static Bool
 tfp410ReadByte(TFP410Ptr tfp, int addr, CARD8 *ch)
 {
     if (!xf86I2CReadByte(&(tfp->d), addr, ch)) {
-	xf86DrvMsg(tfp->d.pI2CBus->scrnIndex, X_ERROR,
-		   "Unable to read from %s Slave %d.\n",
-		   tfp->d.pI2CBus->BusName, tfp->d.SlaveAddr);
+	if (!tfp->quiet) {
+	    xf86DrvMsg(tfp->d.pI2CBus->scrnIndex, X_ERROR,
+		       "Unable to read from %s Slave %d.\n",
+		       tfp->d.pI2CBus->BusName, tfp->d.SlaveAddr);
+	}
 	return FALSE;
     }
     return TRUE;
@@ -60,9 +62,11 @@ static Bool
 tfp410WriteByte(TFP410Ptr tfp, int addr, CARD8 ch)
 {
     if (!xf86I2CWriteByte(&(tfp->d), addr, ch)) {
-	xf86DrvMsg(tfp->d.pI2CBus->scrnIndex, X_ERROR,
-		   "Unable to write to %s Slave %d.\n",
-		   tfp->d.pI2CBus->BusName, tfp->d.SlaveAddr);
+	if (!tfp->quiet) {
+	    xf86DrvMsg(tfp->d.pI2CBus->scrnIndex, X_ERROR,
+		       "Unable to write to %s Slave %d.\n",
+		       tfp->d.pI2CBus->BusName, tfp->d.SlaveAddr);
+	}
 	return FALSE;
     }
     return TRUE;
@@ -103,6 +107,7 @@ tfp410_init(I2CBusPtr b, I2CSlaveAddr ad
     tfp->d.AcknTimeout = b->AcknTimeout;
     tfp->d.ByteTimeout = b->ByteTimeout;
     tfp->d.DriverPrivate.ptr = tfp;
+    tfp->quiet = TRUE;
 
     if ((id = tfp410GetID(tfp, TFP410_VID_LO)) != TFP410_VID) {
 	xf86DrvMsg(tfp->d.pI2CBus->scrnIndex, X_ERROR,
@@ -117,6 +122,7 @@ tfp410_init(I2CBusPtr b, I2CSlaveAddr ad
 		   id, tfp->d.pI2CBus->BusName, tfp->d.SlaveAddr);
 	goto out;
     }
+    tfp->quiet = FALSE;
 
     if (!xf86I2CDevInit(&(tfp->d))) {
 	goto out;
diff --git a/src/tfp410/tfp410_reg.h b/src/tfp410/tfp410_reg.h
index 45afa9b..c555b97 100644
--- a/src/tfp410/tfp410_reg.h
+++ b/src/tfp410/tfp410_reg.h
@@ -95,6 +95,8 @@ typedef struct _TFP410SaveRec {
 
 typedef struct {
     I2CDevRec d;
+    Bool quiet;
+
     TFP410SaveRec SavedReg;
     TFP410SaveRec ModeReg;
 } TFP410Rec, *TFP410Ptr;
diff-tree 6dd8228a386334d05836353672aae9f8c456e435 (from 994ee6721d9f1650ad37e21198b86848352b73af)
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Oct 1 12:07:22 2007 -0700

    Enable CH7017/7018 DVO driver by default.
    
    On hardware containing one of these chips (generally single pipe with an LVDS
    connected), it's probably better to try to enable it and fail in some cases
    than to not probe the output at all.

diff --git a/src/i830_dvo.c b/src/i830_dvo.c
index cb461d7..8ba38bd 100644
--- a/src/i830_dvo.c
+++ b/src/i830_dvo.c
@@ -55,12 +55,10 @@ static const char *ivch_symbols[] = {
     NULL
 };
 
-#if 0
 static const char *ch7017_symbols[] = {
     "ch7017_methods",
     NULL
 };
-#endif
 
 /* driver list */
 struct _I830DVODriver i830_dvo_drivers[] =
@@ -97,10 +95,14 @@ struct _I830DVODriver i830_dvo_drivers[]
 	.address = (TFP410_ADDR_1<<1),
 	.symbols = TFP410Symbols
     },
-    /*
-    { I830_OUTPUT_DVO_LVDS, "ch7017", "ch7017_methods",
-      0xea, ch7017_symbols, NULL, NULL, NULL }
-    */
+    {
+	.type = I830_OUTPUT_DVO_LVDS,
+	.modulename = "ch7017",
+	.fntablename = "ch7017_methods",
+	.dvo_reg = DVOA,
+	.address = 0xea,
+	.symbols = ch7017_symbols,
+    }
 };
 
 #define I830_NUM_DVO_DRIVERS (sizeof(i830_dvo_drivers)/sizeof(struct _I830DVODriver))
diff-tree 994ee6721d9f1650ad37e21198b86848352b73af (from 0e5574e842eeaac75271ccd50027d3e54c57722d)
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Oct 1 12:01:16 2007 -0700

    Disable TV/VGA output on the CH7017/7018 devices.
    
    We don't support those outputs on this chip yet, so turn them off if the BIOS
    had set them on.

diff --git a/src/ch7017/ch7017.c b/src/ch7017/ch7017.c
index 8e3a6ef..4c9b4c6 100644
--- a/src/ch7017/ch7017.c
+++ b/src/ch7017/ch7017.c
@@ -55,6 +55,7 @@ struct ch7017_priv {
     CARD8 save_lvds_control_2;
     CARD8 save_outputs_enable;
     CARD8 save_lvds_power_down;
+    CARD8 save_power_management;
 };
 
 static void
@@ -224,12 +225,20 @@ ch7017_dpms(I2CDevPtr d, int mode)
 
     ch7017_read(priv, CH7017_LVDS_POWER_DOWN, &val);
 
+    /* Turn off TV/VGA, and never turn it on since we don't support it. */
+    ch7017_write(priv, CH7017_POWER_MANAGEMENT,
+		 CH7017_DAC0_POWER_DOWN |
+		 CH7017_DAC1_POWER_DOWN |
+		 CH7017_DAC2_POWER_DOWN |
+		 CH7017_DAC3_POWER_DOWN |
+		 CH7017_TV_POWER_DOWN_EN);
+
     if (mode == DPMSModeOn) {
 	/* Turn on the LVDS */
 	ch7017_write(priv, CH7017_LVDS_POWER_DOWN,
 			val & ~CH7017_LVDS_POWER_DOWN_EN);
     } else {
-	/* Turn on the LVDS */
+	/* Turn off the LVDS */
 	ch7017_write(priv, CH7017_LVDS_POWER_DOWN,
 			val | CH7017_LVDS_POWER_DOWN_EN);
     }
@@ -273,6 +282,7 @@ ch7017_save(I2CDevPtr d)
     ch7017_read(priv, CH7017_LVDS_CONTROL_2, &priv->save_lvds_control_2);
     ch7017_read(priv, CH7017_OUTPUTS_ENABLE, &priv->save_outputs_enable);
     ch7017_read(priv, CH7017_LVDS_POWER_DOWN, &priv->save_lvds_power_down);
+    ch7017_read(priv, CH7017_POWER_MANAGEMENT, &priv->save_power_management);
 }
 
 static void
@@ -290,6 +300,7 @@ ch7017_restore(I2CDevPtr d)
     ch7017_write(priv, CH7017_LVDS_CONTROL_2, priv->save_lvds_control_2);
     ch7017_write(priv, CH7017_OUTPUTS_ENABLE, priv->save_outputs_enable);
     ch7017_write(priv, CH7017_LVDS_POWER_DOWN, priv->save_lvds_power_down);
+    ch7017_write(priv, CH7017_POWER_MANAGEMENT, priv->save_power_management);
 }
 
 I830I2CVidOutputRec ch7017_methods = {


More information about the xorg-commit mailing list