Changeset 2533

Show
Ignore:
Timestamp:
05/15/04 13:32:19 (9 years ago)
Author:
khali
Message:

Detect the MAX1619.

Files:
1 modified

Legend:

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

    r2526 r2533  
    820820            fscher_detect adm1029_detect adm1031_detect max6900_detect 
    821821            m5879_detect pca9540_detect smartbatt_mgr_detect 
    822             smartbatt_chgr_detect adt7467_detect lm92_detect); 
     822            smartbatt_chgr_detect adt7467_detect lm92_detect max1619_detect); 
    823823 
    824824# This is a list of all recognized chips.  
     
    11451145       i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], 
    11461146       i2c_detect => sub { adm1021_detect 7, @_ }, 
     1147     }, 
     1148     { 
     1149       name => "Maxim MAX1619", 
     1150       driver => "to-be-written", 
     1151       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
     1152       i2c_detect => sub { max1619_detect 0, @_ }, 
    11471153     }, 
    11481154     { 
     
    35683574} 
    35693575 
     3576# $_[0]: Chip to detect 
     3577#   (0 = MAX1619) 
     3578# $_[1]: A reference to the file descriptor to access this chip. 
     3579#        We may assume an i2c_set_slave_addr was already done. 
     3580# $_[2]: Address 
     3581# Returns: undef if not detected, 7 if detected 
     3582# Registers used: 
     3583#   0xfe: Company ID 
     3584#   0xff: Device ID 
     3585#   0x02: Status 
     3586#   0x03: Configuration 
     3587#   0x04: Conversion rate 
     3588sub max1619_detect 
     3589{ 
     3590  my ($chip, $file, $addr) = @_; 
     3591  my $man_id = i2c_smbus_read_byte_data($file, 0xfe); 
     3592  my $dev_id = i2c_smbus_read_byte_data($file, 0xff); 
     3593  my $conf = i2c_smbus_read_byte_data($file, 0x03); 
     3594  my $status = i2c_smbus_read_byte_data($file, 0x02); 
     3595  my $convrate = i2c_smbus_read_byte_data($file, 0x04); 
     3596 
     3597  return if $man_id != 0x4D 
     3598    or $dev_id != 0x04 
     3599    or ($conf & 0x03) 
     3600    or ($status & 0x61) 
     3601    or $convrate >= 8; 
     3602 
     3603  return 7; 
     3604} 
     3605 
    35703606# $_[0]: Address 
    35713607# Returns: undef if not detected, (9) if detected.