Show
Ignore:
Timestamp:
01/14/11 17:11:54 (16 months ago)
Author:
khali
Message:

Add detection of the National Semiconductor LM94.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/detect/sensors-detect

    r5900 r5901  
    641641                driver => "lm93", 
    642642                i2c_addrs => [0x2c..0x2e], 
    643                 i2c_detect => sub { lm93_detect(@_); }, 
     643                i2c_detect => sub { lm93_detect(@_, 0); }, 
     644        }, { 
     645                name => "National Semiconductor LM94", 
     646                driver => "to-be-written",      # Most likely lm93 
     647                i2c_addrs => [0x2c..0x2e], 
     648                i2c_detect => sub { lm93_detect(@_, 1); }, 
    644649        }, { 
    645650                name => "Winbond W83781D", 
     
    52275232} 
    52285233 
     5234# Chip to detect: 0 = LM93, 1 = LM94 
    52295235# Registers used: 
    52305236#   0x3E: Manufacturer ID 
     
    52325238sub lm93_detect 
    52335239{ 
    5234         my ($file, $addr) = @_; 
    5235         return unless i2c_smbus_read_byte_data($file, 0x3E) == 0x01 
    5236                   and i2c_smbus_read_byte_data($file, 0x3F) == 0x73; 
     5240        my ($file, $addr, $chip) = @_; 
     5241        my ($man_id, $dev_id); 
     5242 
     5243        $man_id = i2c_smbus_read_byte_data($file, 0x3E); 
     5244        $dev_id = i2c_smbus_read_byte_data($file, 0x3F); 
     5245         
     5246        if ($chip == 0) { 
     5247                return unless $man_id == 0x01   # National Semiconductor 
     5248                          and $dev_id == 0x73;  # LM93 
     5249        } 
     5250        if ($chip == 1) { 
     5251                return unless $man_id == 0x01   # National Semiconductor 
     5252                          and $dev_id >= 0x79 
     5253                          and $dev_id <= 0x7A;  # LM94 
     5254        } 
    52375255        return 5; 
    52385256}