[NV driver] I2C bus(ses) question.

Ducrot Bruno <[email protected]>
Newsgroups gmane.comp.xfree86.expert
Message-ID <[email protected]>
Hi Mark, list.

I am a bit confused with the code for the I2C bus(ses), especially
in a multiple heads environment.

The current code use the extended registers 0x3e, 0x3f in order
to implement the I2C's functions I2CPutBits and I2CGetBits, but
I think that the second head should use actually the registers
0x36 and 0x37.

Am I correct?  If yes, following patch should fix that.

Cheers,

-- 
Ducrot Bruno
http://www.poupinou.org        Page profaissionelle
http://toto.tu-me-saoules.com  Haume page
01_fix_i2c.diff (text/plain, 1.8 KB)
diff -Naur xc/programs/Xserver/hw/xfree86/drivers/nv.old/nv_dac.c xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c
--- xc/programs/Xserver/hw/xfree86/drivers/nv.old/nv_dac.c	Mon Oct 14 20:22:45 2002
+++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c	Mon Nov 25 15:36:42 2002
@@ -320,13 +320,16 @@
 {
     NVPtr pNv = NVPTR(pScrn);
     unsigned char val;
+    unsigned char cr;
+
+    cr = pNv->SecondCRTC ? 0x36 : 0x3e;
 
     /* wait for Vsync */
     while(VGA_RD08(pNv->riva.PCIO, 0x3da) & 0x08);
     while(!(VGA_RD08(pNv->riva.PCIO, 0x3da) & 0x08));
 
     /* Get the result */
-    VGA_WR08(pNv->riva.PCIO, 0x3d4, 0x3e);
+    VGA_WR08(pNv->riva.PCIO, 0x3d4, cr);
     val = VGA_RD08(pNv->riva.PCIO, 0x3d5);
     DEBUG(ErrorF("NV_ddc1Read(%p,...) returns %d\n",
                  pScrn, val));
@@ -338,9 +341,12 @@
 {
     NVPtr pNv = NVPTR(xf86Screens[b->scrnIndex]);
     unsigned char val;
+    unsigned char cr;
+
+    cr = pNv->SecondCRTC ? 0x36 : 0x3e;
 
     /* Get the result. */
-    VGA_WR08(pNv->riva.PCIO, 0x3d4, 0x3e);
+    VGA_WR08(pNv->riva.PCIO, 0x3d4, cr);
     val = VGA_RD08(pNv->riva.PCIO, 0x3d5);
 
     *clock = (val & DDC_SCL_READ_MASK) != 0;
@@ -354,8 +360,11 @@
 {
     NVPtr pNv = NVPTR(xf86Screens[b->scrnIndex]);
     unsigned char val;
+    unsigned char cr;
+
+    cr = pNv->SecondCRTC ? 0x37 : 0x3f;
 
-    VGA_WR08(pNv->riva.PCIO, 0x3d4, 0x3f);
+    VGA_WR08(pNv->riva.PCIO, 0x3d4, cr);
     val = VGA_RD08(pNv->riva.PCIO, 0x3d5) & 0xf0;
     if (clock)
         val |= DDC_SCL_WRITE_MASK;
@@ -367,7 +376,7 @@
     else
         val &= ~DDC_SDA_WRITE_MASK;
 
-    VGA_WR08(pNv->riva.PCIO, 0x3d4, 0x3f);
+    VGA_WR08(pNv->riva.PCIO, 0x3d4, cr);
     VGA_WR08(pNv->riva.PCIO, 0x3d5, val | 0x1);
     
     DEBUG(ErrorF("NV_I2CPutBits(%p, %d, %d) val=0x%x\n", b, clock, data, val));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.