Changeset 711

Show
Ignore:
Timestamp:
01/28/00 02:05:40 (13 years ago)
Author:
mds
Message:

(mds) Fix broken send_byte_data() for I2C and DDC.

Wasn't used by bt869 so wasn't found before.
i2cdump now works and sensors_detect will find ddc monitor.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/kernel/busses/i2c-voodoo3.c

    r707 r711  
    410410        if (!ddc_rdat()) { 
    411411                printk 
    412                     ("i2c-voodoo3: I2C bus in use or hung!  Try again later.\n"); 
     412                    ("i2c-voodoo3: DDC bus in use or hung!  Try again later.\n"); 
    413413                return 1; 
    414414        } 
     
    443443int Voodoo3_I2CRead_byte_data(int addr, int command) 
    444444{ 
    445         int this_dat = 0; 
    446  
    447445        Voodoo3_I2CStart(); 
    448         if (Voodoo3_I2CSendByte(addr)) { 
     446        if (Voodoo3_I2CSendByte(addr & 0xfe)) { 
    449447#ifdef DEBUG 
    450448                printk 
     
    452450                     addr); 
    453451#endif 
    454                 this_dat = -1; 
    455452                goto ENDREAD2; 
    456453        } 
    457         if (!Voodoo3_I2CSendByte(command)) { 
     454        if (Voodoo3_I2CSendByte(command)) { 
    458455#ifdef DEBUG 
    459456                printk 
     
    461458                     addr); 
    462459#endif 
    463                 this_dat = -1; 
    464460                goto ENDREAD2; 
    465461        } 
    466         this_dat = Voodoo3_I2CReadByte(0); 
     462        return(Voodoo3_I2CRead_byte(addr)); 
    467463      ENDREAD2:Voodoo3_I2CStop(); 
    468464#ifdef DEBUG 
    469465        printk 
    470             ("i2c-voodoo3: Byte read at addr:0x%X (command:0x%X) result:0x%X\n", 
    471              addr, command, this_dat); 
    472 #endif 
    473         return this_dat; 
     466            ("i2c-voodoo3: Byte read at addr:0x%X (command:0x%X) failed\n", 
     467             addr, command); 
     468#endif 
     469        return(-1); 
    474470} 
    475471 
     
    637633int Voodoo3_DDCRead_byte_data(int addr, int command) 
    638634{ 
    639         int this_dat = 0; 
    640  
    641635        Voodoo3_DDCStart(); 
    642         if (Voodoo3_DDCSendByte(addr)) { 
    643                 this_dat = -1; 
     636        if (Voodoo3_DDCSendByte(addr & 0xfe)) 
    644637                goto ENDREAD2; 
    645         } 
    646         if (!Voodoo3_DDCSendByte(command)) { 
    647                 this_dat = -1; 
     638        if (Voodoo3_DDCSendByte(command)) 
    648639                goto ENDREAD2; 
    649         } 
    650         this_dat = Voodoo3_DDCReadByte(0); 
    651       ENDREAD2:Voodoo3_DDCStop(); 
    652         return this_dat; 
     640        return(Voodoo3_DDCRead_byte(addr)); 
     641      ENDREAD2: Voodoo3_DDCStop(); 
     642        return (-1); 
    653643} 
    654644