Show
Ignore:
Timestamp:
12/12/10 17:54:35 (18 months ago)
Author:
khali
Message:

Add detection of the Analog Devices ADT7410.

Files:
1 modified

Legend:

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

    r5888 r5895  
    598598                i2c_detect => sub { adt7490_detect(@_); }, 
    599599        }, { 
     600                name => "Analog Devices ADT7410", 
     601                driver => "to-be-written", 
     602                i2c_addrs => [0x48..0x4b], 
     603                i2c_detect => sub { adt7410_detect(@_); }, 
     604        }, { 
    600605                name => "Analog Devices ADT7411", 
    601606                driver => "to-be-written", 
     
    45454550        return if ($cid & 0xfc) != 0x6c;        # ADT7490 
    45464551        return 5; 
     4552} 
     4553 
     4554# Registers used: 
     4555#   0x02: Status 
     4556#   0x0a: Thyst 
     4557#   0x0b: ID 
     4558# We also rely on the fact that only the 5 LSB of the address pointer 
     4559# are considered, so registers cycle over 32 byte boundaries. 
     4560sub adt7410_detect 
     4561{ 
     4562        my ($file, $addr) = @_; 
     4563        my $status = i2c_smbus_read_byte_data($file, 0x02); 
     4564        my $thyst = i2c_smbus_read_byte_data($file, 0x0a); 
     4565        my $id = i2c_smbus_read_byte_data($file, 0x0b); 
     4566 
     4567        # Unused bits 
     4568        return if ($status & 0x0f); 
     4569        return if ($thyst & 0xf0); 
     4570 
     4571        # ID register 
     4572        return if $id != 0xcb; 
     4573 
     4574        # Cycling registers 
     4575        for (my $i = 2; $i < 16; $i *= 2) { 
     4576                return if i2c_smbus_read_byte_data($file, 0x0a + $i * 16) != $thyst; 
     4577                return if i2c_smbus_read_byte_data($file, 0x0b + $i * 16) != $id; 
     4578        } 
     4579 
     4580        # Non-existent registers (other devices tend to have ID registers there) 
     4581        return if i2c_smbus_read_byte_data($file, 0x03e) != 0; 
     4582        return if i2c_smbus_read_byte_data($file, 0x03f) != 0; 
     4583        return if i2c_smbus_read_byte_data($file, 0x0fe) != 0; 
     4584        return if i2c_smbus_read_byte_data($file, 0x0ff) != 0; 
     4585 
     4586        return 3; 
    45474587} 
    45484588