Changeset 3176

Show
Ignore:
Timestamp:
11/05/05 13:24:30 (3 years ago)
Author:
khali
Message:

Backport SMBus PEC support rewrite from Linux 2.6:

Discard I2C_FUNC_SMBUS_*_PEC defines. i2c clients are not supposed to
check for PEC support of i2c bus drivers on individual SMBus
transactions, and i2c bus drivers are not supposed to advertise them.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/kernel/busses/i2c-i801.c

    r3149 r3176  
    9292#endif 
    9393 
    94 #ifdef I2C_FUNC_SMBUS_BLOCK_DATA_PEC 
     94#ifdef I2C_CLIENT_PEC 
    9595#define HAVE_PEC 
    9696#endif 
     
    596596            I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 
    597597#ifdef HAVE_PEC 
    598              | (isich4 ? I2C_FUNC_SMBUS_BLOCK_DATA_PEC | 
    599                          I2C_FUNC_SMBUS_HWPEC_CALC 
    600                        : 0) 
     598             | (isich4 ? I2C_FUNC_SMBUS_HWPEC_CALC : 0) 
    601599#endif 
    602600#if 0 
  • lm-sensors/trunk/kernel/chips/smbus-arp.c

    r2867 r3176  
    186186                I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_HWPEC_CALC)) && 
    187187            (!i2c_check_functionality(adapter, 
    188                 I2C_FUNC_SMBUS_BLOCK_DATA_PEC))) 
     188                I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_I2C))) 
    189189                return(0); 
    190190 
  • lm-sensors/trunk/kernel/include/i2c-dev.h

    r3107 r3176  
    5454#define I2C_FUNC_PROTOCOL_MANGLING      0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ 
    5555#define I2C_FUNC_SMBUS_HWPEC_CALC       0x00000008 /* SMBus 2.0 */ 
    56 #define I2C_FUNC_SMBUS_READ_WORD_DATA_PEC  0x00000800 /* SMBus 2.0 */  
    57 #define I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC 0x00001000 /* SMBus 2.0 */  
    58 #define I2C_FUNC_SMBUS_PROC_CALL_PEC    0x00002000 /* SMBus 2.0 */ 
    59 #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL_PEC 0x00004000 /* SMBus 2.0 */ 
    6056#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL  0x00008000 /* SMBus 2.0 */ 
    6157#define I2C_FUNC_SMBUS_QUICK            0x00010000  
     
    7369#define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2  0x10000000 /* I2C-like block xfer  */ 
    7470#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 /* w/ 2-byte reg. addr. */ 
    75 #define I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC  0x40000000 /* SMBus 2.0 */ 
    76 #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC 0x80000000 /* SMBus 2.0 */ 
    7771 
    7872#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ 
     
    8882#define I2C_FUNC_SMBUS_I2C_BLOCK_2 (I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \ 
    8983                                    I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2) 
    90 #define I2C_FUNC_SMBUS_BLOCK_DATA_PEC (I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC | \ 
    91                                        I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC) 
    92 #define I2C_FUNC_SMBUS_WORD_DATA_PEC  (I2C_FUNC_SMBUS_READ_WORD_DATA_PEC | \ 
    93                                        I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC) 
    94  
    95 #define I2C_FUNC_SMBUS_READ_BYTE_PEC            I2C_FUNC_SMBUS_READ_BYTE_DATA 
    96 #define I2C_FUNC_SMBUS_WRITE_BYTE_PEC           I2C_FUNC_SMBUS_WRITE_BYTE_DATA 
    97 #define I2C_FUNC_SMBUS_READ_BYTE_DATA_PEC       I2C_FUNC_SMBUS_READ_WORD_DATA 
    98 #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA_PEC      I2C_FUNC_SMBUS_WRITE_WORD_DATA 
    99 #define I2C_FUNC_SMBUS_BYTE_PEC                 I2C_FUNC_SMBUS_BYTE_DATA 
    100 #define I2C_FUNC_SMBUS_BYTE_DATA_PEC            I2C_FUNC_SMBUS_WORD_DATA 
    10184 
    10285/*  
  • lm-sensors/trunk/prog/dump/i2cdump.c

    r3110 r3176  
    184184        switch(size) { 
    185185        case I2C_SMBUS_BYTE: 
    186                 if (pec) { 
    187                         if (!(funcs & I2C_FUNC_SMBUS_BYTE_PEC)) { 
    188                                 fprintf(stderr, "Error: Adapter for i2c bus " 
    189                                         "%d does not have byte w/ PEC " 
    190                                         "capability\n", i2cbus); 
    191                                 exit(1); 
    192                         } 
    193                 } else { 
    194                         if (!(funcs & I2C_FUNC_SMBUS_BYTE)) { 
    195                                 fprintf(stderr, "Error: Adapter for i2c bus " 
    196                                         "%d does not have byte capability\n", 
    197                                         i2cbus); 
    198                                 exit(1); 
    199                         } 
     186                if (!((funcs & I2C_FUNC_SMBUS_BYTE) == I2C_FUNC_SMBUS_BYTE)) { 
     187                        fprintf(stderr, "Error: Adapter for i2c bus %d does " 
     188                                "not have byte capability\n", i2cbus); 
     189                        exit(1); 
    200190                } 
    201191                break; 
    202192 
    203193        case I2C_SMBUS_BYTE_DATA: 
    204                 if (pec) { 
    205                         if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA_PEC)) { 
    206                                 fprintf(stderr, "Error: Adapter for i2c bus " 
    207                                         "%d does not have byte read w/ PEC " 
    208                                         "capability\n", i2cbus); 
    209                                 exit(1); 
    210                         } 
    211                 } else { 
    212                         if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { 
    213                                 fprintf(stderr, "Error: Adapter for i2c bus " 
    214                                         "%d does not have byte read " 
    215                                         "capability\n", i2cbus); 
    216                                 exit(1); 
    217                         } 
     194                if (!(funcs & I2C_FUNC_SMBUS_READ_BYTE_DATA)) { 
     195                        fprintf(stderr, "Error: Adapter for i2c bus %d does " 
     196                                "not have byte read capability\n", i2cbus); 
     197                        exit(1); 
    218198                } 
    219199                break; 
    220200 
    221201        case I2C_SMBUS_WORD_DATA: 
    222                 if (pec) { 
    223                         if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA_PEC)) { 
    224                                 fprintf(stderr, "Error: Adapter for i2c bus " 
    225                                         "%d does not have word read w/ PEC " 
    226                                         "capability\n", i2cbus); 
    227                                 exit(1); 
    228                         } 
    229                 } else { 
    230                         if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { 
    231                                 fprintf(stderr, "Error: Adapter for i2c bus " 
    232                                         "%d does not have word read " 
    233                                         "capability\n", i2cbus); 
    234                                 exit(1); 
    235                         } 
     202                if (!(funcs & I2C_FUNC_SMBUS_READ_WORD_DATA)) { 
     203                        fprintf(stderr, "Error: Adapter for i2c bus %d does " 
     204                                "not have word read capability\n", i2cbus); 
     205                        exit(1); 
    236206                } 
    237207                break; 
    238208 
    239209        case I2C_SMBUS_BLOCK_DATA: 
    240                 if (pec) { 
    241                         if (!(funcs & I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC)) { 
    242                                 fprintf(stderr, "Error: Adapter for i2c bus " 
    243                                         "%d does not have smbus block read " 
    244                                         "w/ PEC capability\n", i2cbus); 
    245                                 exit(1); 
    246                         } 
    247                 } else { 
    248                         if (!(funcs & I2C_FUNC_SMBUS_READ_BLOCK_DATA)) { 
    249                                 fprintf(stderr, "Error: Adapter for i2c bus " 
    250                                         "%d does not have smbus block read " 
    251                                         "capability\n", i2cbus); 
    252                                 exit(1); 
    253                         } 
     210                if (!(funcs & I2C_FUNC_SMBUS_READ_BLOCK_DATA)) { 
     211                        fprintf(stderr, "Error: Adapter for i2c bus %d does " 
     212                                "not have smbus block read capability\n", 
     213                                i2cbus); 
     214                        exit(1); 
    254215                } 
    255216                break; 
     
    278239                                strerror(errno)); 
    279240                        exit(1); 
     241                } 
     242                if (!(funcs & (I2C_FUNC_SMBUS_HWPEC_CALC | I2C_FUNC_I2C))) { 
     243                        fprintf(stderr, "Warning: Adapter for i2c bus %d does " 
     244                                "not seem to actually support PEC\n", i2cbus); 
    280245                } 
    281246        }