Changeset 2440

Show
Ignore:
Timestamp:
04/14/04 20:29:24 (5 years ago)
Author:
khali
Message:

Support MAX6633, MAX6634, MAX6635 and LM76.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/doc/chips/SUMMARY

    r2428 r2440  
    136136 
    137137lm92 
     138        (all are reported as an "lm92") 
    138139        lm92            1       -       -       -       yes     no 
     140        max6633         1       -       -       -       yes     no 
     141        max6634         1       -       -       -       yes     no 
     142        max6635         1       -       -       -       yes     no 
     143        (lm76 needs force parameter) 
     144        lm76            1       -       -       -       yes     no 
    139145 
    140146maxilife 
  • lm-sensors/trunk/doc/chips/lm92

    r1722 r2440  
    88    Prefix `lm92' 
    99    Addresses scanned: I2C 0x48 - 0x4b (inclusive) 
     10  * National Semiconductors LM76 
     11    Prefix `lm92' 
     12    Addresses scanned: none, force parameter needed 
     13  * Maxim MAX6633/MAX6634/MAX6635 
     14    Prefix `lm92' 
     15    Addresses scanned: I2C 0x48 - 0x4f (inclusive) 
     16    MAX6633 with address in 0x40 - 0x47 needs force parameter 
    1017 
    1118Author: Abraham van der Merwe <abraham@2d3d.co.za> 
     
    4754interrupt pins (INT, T_CRIT_A) are ignored. 
    4855 
     56Support was added later for the LM76 and Maxim MAX6633/MAX6634/MAX6635, 
     57which are mostly compatible. They have not all been tested, so you 
     58may need to use the force parameter. 
     59 
    4960 
    5061Hardware Configurations 
  • lm-sensors/trunk/kernel/chips/lm92.c

    r2437 r2440  
    108108/* addresses to scan */ 
    109109static unsigned short normal_i2c[] = { SENSORS_I2C_END }; 
    110 static unsigned short normal_i2c_range[] = { 0x48, 0x4b, SENSORS_I2C_END }; 
     110static unsigned short normal_i2c_range[] = { 0x48, 0x4f, SENSORS_I2C_END }; 
    111111static unsigned int normal_isa[] = { SENSORS_ISA_END }; 
    112112static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; 
     
    232232} 
    233233 
     234static int max6635_check(struct i2c_client *client) 
     235{ 
     236        int i; 
     237        u16 temp_low, temp_high, temp_hyst, temp_crit; 
     238        u8 conf; 
     239 
     240        temp_low = i2c_smbus_read_word_data(client, LM92_REG_TRIP_LOW); 
     241        temp_high = i2c_smbus_read_word_data(client, LM92_REG_TRIP_HIGH); 
     242        temp_hyst = i2c_smbus_read_word_data(client, LM92_REG_TRIP_HYSTERESIS); 
     243        temp_crit = i2c_smbus_read_word_data(client, LM92_REG_TRIP_CRITICAL); 
     244         
     245        if ((temp_low & 0x7f00) || (temp_high & 0x7f00) 
     246         || (temp_hyst & 0x7f00) || (temp_crit & 0x7f00)) 
     247                return 0; 
     248 
     249        conf = i2c_smbus_read_byte_data(client, LM92_REG_CONFIGURATION); 
     250 
     251        for (i=0; i<128; i+=16) { 
     252                if (temp_low != i2c_smbus_read_word_data(client, LM92_REG_TRIP_LOW + i) 
     253                 || temp_high != i2c_smbus_read_word_data(client, LM92_REG_TRIP_HIGH + i) 
     254                 || temp_hyst != i2c_smbus_read_word_data(client, LM92_REG_TRIP_HYSTERESIS + i) 
     255                 || temp_crit != i2c_smbus_read_word_data(client, LM92_REG_TRIP_CRITICAL + i) 
     256                 || conf != i2c_smbus_read_byte_data(client, LM92_REG_CONFIGURATION + i)) 
     257                        return 0; 
     258        } 
     259         
     260        return 1; 
     261} 
     262 
    234263static int lm92_init_client (struct i2c_client *client) 
    235264{ 
     
    295324        } 
    296325 
    297         if ((kind < 0 && lm92_read16 (client,LM92_REG_MANUFACTURER,&manufacturer) < 0) || 
    298                 manufacturer != LM92_MANUFACTURER_ID) { 
    299                 kfree (client); 
    300                 up (&mutex); 
    301                 return (-ENODEV); 
     326        if (kind < 0) { 
     327                /* Is it an lm92? */ 
     328                if (address < 0x4c 
     329                 && (lm92_read16(client,LM92_REG_MANUFACTURER,&manufacturer) < 0 
     330                  || manufacturer != LM92_MANUFACTURER_ID)) { 
     331                        /* Is it a MAX6635/MAX6635/MAX6635? */ 
     332                        if (!max6635_check(client)) { 
     333                                kfree (client); 
     334                                up (&mutex); 
     335                                return (-ENODEV); 
     336                        } 
     337                } 
    302338        } 
    303339