Changeset 2392

Show
Ignore:
Timestamp:
03/27/04 03:50:11 (9 years ago)
Author:
mds
Message:

add smart battery manager and charger detection

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r2390 r2392  
    4141                          Drop support of undetectable adapters 
    4242                          Fix smart battery detection 
     43                          Add smart battery charger and manager detection 
    4344  Program sensors-detect-stat.pl: New 
    4445 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r2383 r2392  
    779779            saa1064_detect w83l784r_detect mozart_detect max6650_detect 
    780780            fscher_detect adm1029_detect adm1031_detect max6900_detect 
    781             m5879_detect pca9540_detect); 
     781            m5879_detect pca9540_detect smartbatt_mgr_detect 
     782            smartbatt_chgr_detect); 
    782783 
    783784# This is a list of all recognized chips.  
     
    12801281       isa_addrs => [ 0x0ca8 ], 
    12811282       isa_detect => sub { ipmi_smic_detect @_ }, 
     1283     }, 
     1284     { 
     1285       name => "Smart Battery Charger", 
     1286       driver => "to-be-written", 
     1287       i2c_addrs => [0x09], 
     1288       i2c_detect => sub { smartbatt_chgr_detect @_}, 
     1289     }, 
     1290     { 
     1291       name => "Smart Battery Manager/Selector", 
     1292       driver => "to-be-written", 
     1293       i2c_addrs => [0x0a], 
     1294       i2c_detect => sub { smartbatt_mgr_detect @_}, 
    12821295     }, 
    12831296     { 
     
    39073920{ 
    39083921  return (1); 
     3922} 
     3923 
     3924# This checks for non-FFFF values for SpecInfo and Status. 
     3925# The address (0x09) is specified by the SMBus standard so it's likely 
     3926# that this really is a smart battery charger. 
     3927# $_[0]: A reference to the file descriptor to access this chip. 
     3928#        We may assume an i2c_set_slave_addr was already done. 
     3929# $_[1]: Address 
     3930# Returns: 5 
     3931sub smartbatt_chgr_detect 
     3932{ 
     3933  my ($file,$addr) = @_; 
     3934  # check some registers 
     3935  if (i2c_smbus_read_word_data($file,0x11) == 0xffff) { 
     3936        return; 
     3937  } 
     3938  if (i2c_smbus_read_word_data($file,0x13) == 0xffff) { 
     3939        return; 
     3940  } 
     3941  return (5); 
     3942} 
     3943 
     3944# This checks for non-FFFF values for State and Info. 
     3945# The address (0x0a) is specified by the SMBus standard so it's likely 
     3946# that this really is a smart battery manager/selector. 
     3947# $_[0]: A reference to the file descriptor to access this chip. 
     3948#        We may assume an i2c_set_slave_addr was already done. 
     3949# $_[1]: Address 
     3950# Returns: 5 
     3951sub smartbatt_mgr_detect 
     3952{ 
     3953  my ($file,$addr) = @_; 
     3954  # check some registers 
     3955  if (i2c_smbus_read_word_data($file,0x01) == 0xffff) { 
     3956        return; 
     3957  } 
     3958  if (i2c_smbus_read_word_data($file,0x04) == 0xffff) { 
     3959        return; 
     3960  } 
     3961  return (5); 
    39093962} 
    39103963