Changeset 4419

Show
Ignore:
Timestamp:
05/28/07 12:31:56 (7 years ago)
Author:
khali
Message:

Support and use the new I2C block read with variable length which will
be available in Linux kernel 2.6.23. Binary compatibility is guaranteed,
source code compatibility isn't, but the incompatibility will be
spotted quickly as the prototype of the helper function
i2c_smbus_read_i2c_block_data() changed. The only problem would be if
a program is calling i2c_smbus_access() directly. Hopefully this should
be a rare case. The py-smbus binding code is in this case and will be
adjusted soon.

Location:
lm-sensors/branches/lm-sensors-3.0.0
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/CHANGES

    r4415 r4419  
    33 
    44SVN HEAD 
     5  File i2c-dev.h: Support I2C block reads with specified length 
    56  All bus modules and documentation: Delete 
    67  All chip modules and documentation: Delete 
     
    1415           Delete support of non-sensor drivers (ddcmon, eeprom) 
    1516  Man page sensors.conf.5: Update the chip statement section 
     17  Program i2cdump: Use the new I2C block read function 
    1618  Program isadump: Detect when address bit 7 is a busy flag 
    1719                   Fix Super-I/O exit sequence for Winbond/Fintek chips 
  • lm-sensors/branches/lm-sensors-3.0.0/kernel/include/i2c-dev.h

    r3177 r4419  
    107107#define I2C_SMBUS_PROC_CALL         4 
    108108#define I2C_SMBUS_BLOCK_DATA        5 
    109 #define I2C_SMBUS_I2C_BLOCK_DATA    6 
     109#define I2C_SMBUS_I2C_BLOCK_BROKEN  6 
    110110#define I2C_SMBUS_BLOCK_PROC_CALL   7           /* SMBus 2.0 */ 
     111#define I2C_SMBUS_I2C_BLOCK_DATA    8 
    111112 
    112113 
     
    272273 
    273274/* Returns the number of read bytes */ 
     275/* Until kernel 2.6.22, the length is hardcoded to 32 bytes. If you 
     276   ask for less than 32 bytes, your code will only work with kernels 
     277   2.6.23 and later. */ 
    274278static inline __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command, 
    275                                                   __u8 *values) 
    276 { 
    277         union i2c_smbus_data data; 
    278         int i; 
     279                                                  __u8 length, __u8 *values) 
     280{ 
     281        union i2c_smbus_data data; 
     282        int i; 
     283 
     284        if (length > 32) 
     285                length = 32; 
     286        data.block[0] = length; 
    279287        if (i2c_smbus_access(file,I2C_SMBUS_READ,command, 
     288                             length == 32 ? I2C_SMBUS_I2C_BLOCK_BROKEN : 
    280289                              I2C_SMBUS_I2C_BLOCK_DATA,&data)) 
    281290                return -1; 
     
    298307        data.block[0] = length; 
    299308        return i2c_smbus_access(file,I2C_SMBUS_WRITE,command, 
    300                                 I2C_SMBUS_I2C_BLOCK_DATA, &data); 
     309                                I2C_SMBUS_I2C_BLOCK_BROKEN, &data); 
    301310} 
    302311 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/dump/i2cdump.c

    r4357 r4419  
    317317                                for (res = 0; res < 256; res += i) { 
    318318                                        i = i2c_smbus_read_i2c_block_data(file, 
    319                                                 res, cblock + res); 
     319                                                res, 32, cblock + res); 
    320320                                        if (i <= 0) 
    321321                                                break;