Changeset 2367

Show
Ignore:
Timestamp:
03/19/04 19:22:30 (9 years ago)
Author:
khali
Message:

Add support for the PCA9540.

Files:
1 modified

Legend:

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

    r2365 r2367  
    781781            saa1064_detect w83l784r_detect mozart_detect max6650_detect 
    782782                        fscher_detect adm1029_detect adm1031_detect max6900_detect 
    783                         m5879_detect); 
     783                        m5879_detect pca9540_detect); 
    784784 
    785785# This is a list of all recognized chips.  
     
    12521252       i2c_addrs => [0x38..0x3b], 
    12531253       i2c_detect => sub { saa1064_detect @_ }, 
     1254     }, 
     1255     { 
     1256       name => "Philips Semiconductors PCA9540", 
     1257       driver => "pca9540", 
     1258       i2c_addrs => [0x70], 
     1259       i2c_detect => sub { pca9540_detect @_ }, 
    12541260     }, 
    12551261     { 
     
    38053811                if $status == 0x80; 
    38063812        return 4; 
     3813} 
     3814 
     3815# $_[0]: A reference to the file descriptor to access this chip. 
     3816#        We may assume an i2c_set_slave_addr was already done. 
     3817# $_[1]: Address 
     3818# Returns: undef if not detected, 1 if detected 
     3819# Detection is rather difficult, since the PCA9540 has a single register. 
     3820# Fortunately, no other device is known to live at this address. 
     3821sub pca9540_detect 
     3822{ 
     3823        my ($file, $addr) = @_; 
     3824        my $reg = i2c_smbus_read_byte($file); 
     3825 
     3826        return if ($reg & 0xf7); 
     3827        return if $reg != i2c_smbus_read_byte($file); 
     3828        return if $reg != i2c_smbus_read_byte($file); 
     3829        return if $reg != i2c_smbus_read_byte($file); 
     3830 
     3831        return 1; 
    38073832} 
    38083833