Changeset 5425

Show
Ignore:
Timestamp:
11/24/08 18:10:31 (4 years ago)
Author:
khali
Message:

Merge the GL520 detection into gl518_detect.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/prog/detect/sensors-detect

    r5424 r5425  
    816816       driver => "gl518sm", 
    817817       i2c_addrs => [0x2c, 0x2d], 
    818        i2c_detect => sub { gl518sm_detect(@_); }, 
     818       i2c_detect => sub { gl518sm_detect(@_, 0); }, 
    819819     }, 
    820820     { 
     
    822822       driver => "gl520sm", 
    823823       i2c_addrs => [0x2c, 0x2d], 
    824        i2c_detect => sub { gl520sm_detect(@_); }, 
     824       i2c_detect => sub { gl518sm_detect(@_, 1); }, 
    825825     }, 
    826826     { 
     
    43614361} 
    43624362 
     4363# Chip to detect: 0 = GL518SM, 1 = GL520SM 
    43634364# Registers used: 
    43644365#   0x00: Device ID 
    43654366#   0x01: Revision ID 
    43664367#   0x03: Configuration 
    4367 # Mediocre detection 
    43684368sub gl518sm_detect 
    43694369{ 
    4370   my ($file, $addr) = @_; 
     4370  my ($file, $addr, $chip) = @_; 
    43714371  my $reg; 
    4372   return unless i2c_smbus_read_byte_data($file, 0x00) == 0x80; 
    4373   return unless (i2c_smbus_read_byte_data($file, 0x03) & 0x80) == 0x00; 
    4374   $reg = i2c_smbus_read_byte_data($file, 0x01); 
    4375   return unless $reg == 0x00 or $reg == 0x80; 
    4376   return (6); 
    4377 } 
    4378  
    4379 # Registers used: 
    4380 #   0x00: Device ID 
    4381 #   0x01: Revision ID 
    4382 #   0x03: Configuration 
    4383 # Mediocre detection 
    4384 sub gl520sm_detect 
    4385 { 
    4386   my ($file, $addr) = @_; 
    4387   return unless i2c_smbus_read_byte_data($file, 0x00) == 0x20; 
     4372 
     4373  $reg = i2c_smbus_read_byte_data($file, 0x00); 
     4374  return if $chip == 0 && $reg != 0x80; 
     4375  return if $chip == 1 && $reg != 0x20; 
     4376 
    43884377  return unless (i2c_smbus_read_byte_data($file, 0x03) & 0x80) == 0x00; 
    43894378  $reg = i2c_smbus_read_byte_data($file, 0x01);