Changeset 5850

Show
Ignore:
Timestamp:
07/06/10 10:44:21 (19 months ago)
Author:
khali
Message:

Add detection of STMicroelectronics STTS424 (JEDEC JC42.4-compliant
memory-module temperature sensors.)

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r5848 r5850  
    1818                  Fix Maxim MAX6690 support 
    1919                  Fix handling of duplicate detections 
     20                  Add support for STMicroelectronics STTS424 
    2021 
    21223.1.2 (2010-02-02) 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r5849 r5850  
    11861186                i2c_detect => sub { emc1403_detect(@_, 1); }, 
    11871187        }, { 
     1188                name => "ST STTS424", 
     1189                driver => "to-be-written", 
     1190                i2c_addrs => [0x18..0x1f], 
     1191                i2c_detect => sub { jedec_JC42_4_detect(@_, 0); }, 
     1192        }, { 
    11881193                name => "Smart Battery", 
    11891194                driver => "sbs", # ACPI driver, not sure if it always works 
     
    53035308 
    53045309        return 6; 
     5310} 
     5311 
     5312# Chip to detect: 0 = STTS424 
     5313# Registers used: 
     5314#   0x00: Capabilities 
     5315#   0x01: Configuration 
     5316#   0x06: Manufacturer ID 
     5317#   0x07: Device ID 
     5318sub jedec_JC42_4_detect 
     5319{ 
     5320        my ($file, $addr, $chip) = @_; 
     5321        my ($reg, $manid, $devid); 
     5322 
     5323        # We test the MSB only at first, because not all chips enjoy 
     5324        # word access. 
     5325 
     5326        # Check for unused bits 
     5327        $reg = i2c_smbus_read_byte_data($file, 0x00); 
     5328        return if $reg & 0xff; 
     5329        $reg = i2c_smbus_read_byte_data($file, 0x01); 
     5330        return if $reg & 0xf8; 
     5331 
     5332        # Check for manufacturer and device ID 
     5333        $manid = i2c_smbus_read_byte_data($file, 0x06); 
     5334        $devid = i2c_smbus_read_byte_data($file, 0x07); 
     5335        if ($chip == 0) { 
     5336                return unless $manid == 0x10;           # STMicrolectronics 
     5337                return unless $devid == 0x00;           # STTS424 
     5338        } 
     5339 
     5340        # Now, do it all again with words. Note that we get 
     5341        # the MSB first, so all value checks are byte-swapped. 
     5342 
     5343        # Check for unused bits 
     5344        $reg = i2c_smbus_read_word_data($file, 0x00); 
     5345        return if $reg < 0 || $reg & 0xc0ff; 
     5346 
     5347        $manid = i2c_smbus_read_word_data($file, 0x06); 
     5348        $devid = i2c_smbus_read_word_data($file, 0x07); 
     5349        return if $manid < 0 || $devid < 0; 
     5350        if ($chip == 0) { 
     5351                return unless $manid == 0x4a10;         # STMicrolectronics 
     5352                return unless ($devid & 0xfeff) == 0x0000; # STTS424 
     5353        } 
     5354 
     5355        return 5; 
    53055356} 
    53065357