Changeset 679

Show
Ignore:
Timestamp:
12/30/99 00:10:48 (13 years ago)
Author:
frodo
Message:

Applied Petr Vandrovec's patch for matrox cards and DDC detection.

Files:
1 modified

Legend:

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

    r678 r679  
    129129       match => sub { $_[0] =~ /^SMBus AMD756 adapter at [0-9,a-f]{4}/ }, 
    130130     }, 
     131     { 
     132       vendid => 0x102b, 
     133       devid  => 0x0519, 
     134       func   => 0, 
     135       procid => "MGA 2064W [Millennium]", 
     136       driver => "i2c-matroxfb", 
     137       match  => sub { $_[0] =~ /^DDC:fb[0-9]{1,2}/ }, 
     138     }, 
     139     { 
     140       vendid => 0x102b, 
     141       devid  => 0x051a, 
     142       func   => 0, 
     143       procid => "MGA 1064SG [Mystique]", 
     144       driver => "i2c-matroxfb", 
     145       match  => sub { $_[0] =~ /^DDC:fb[0-9]{1,2}/ }, 
     146     }, 
     147     { 
     148       vendid => 0x102b, 
     149       devid  => 0x051b, 
     150       func   => 0, 
     151       procid => "MGA 2164W [Millennium II]", 
     152       driver => "i2c-matroxfb", 
     153       match  => sub { $_[0] =~ /^DDC:fb[0-9]{1,2}/ }, 
     154     }, 
     155     { 
     156       vendid => 0x102b, 
     157       devid  => 0x051e, 
     158       func   => 0, 
     159       procid => "MGA 1064SG [Mystique] AGP", 
     160       driver => "i2c-matroxfb", 
     161       match  => sub { $_[0] =~ /^DDC:fb[0-9]{1,2}/ }, 
     162     }, 
     163     { 
     164       vendid => 0x102b, 
     165       devid  => 0x051f, 
     166       func   => 0, 
     167       procid => "MGA 2164W [Millennium II] AGP", 
     168       driver => "i2c-matroxfb", 
     169       match  => sub { $_[0] =~ /^DDC:fb[0-9]{1,2}/ }, 
     170     }, 
     171     { 
     172       vendid => 0x102b, 
     173       devid  => 0x1000, 
     174       func   => 0, 
     175       procid => "MGA G100 [Productiva]", 
     176       driver => "i2c-matroxfb", 
     177       match  => sub { $_[0] =~ /^DDC:fb[0-9]{1,2}/ }, 
     178     }, 
     179     { 
     180       vendid => 0x102b, 
     181       devid  => 0x1001, 
     182       func   => 0, 
     183       procid => "MGA G100 [Productiva] AGP", 
     184       driver => "i2c-matroxfb", 
     185       match  => sub { $_[0] =~ /^DDC:fb[0-9]{1,2}/ }, 
     186     }, 
     187     { 
     188       vendid => 0x102b, 
     189       devid  => 0x0520, 
     190       func   => 0, 
     191       procid => "MGA G200", 
     192       driver => "i2c-matroxfb", 
     193       match  => sub { $_[0] =~ /^DDC:fb[0-9]{1,2}/ }, 
     194     }, 
     195     { 
     196       vendid => 0x102b, 
     197       devid  => 0x0521, 
     198       func   => 0, 
     199       procid => "MGA G200 AGP", 
     200       driver => "i2c-matroxfb", 
     201       match  => sub { $_[0] =~ /^DDC:fb[0-9]{1,2}/ }, 
     202     }, 
     203     { 
     204       vendid => 0x102b, 
     205       devid  => 0x0525, 
     206       func   => 0, 
     207       procid => "MGA G400 AGP", 
     208       driver => "i2c-matroxfb", 
     209       match  => sub { $_[0] =~ /^(DDC,MAVEN):fb[0-9]{1,2}/ }, 
     210     }, 
    131211); 
    132212 
     
    135215            w83781d_isa_detect gl518sm_detect gl520sm_detect adm9240_detect  
    136216            adm1021_detect sis5595_isa_detect eeprom_detect 
    137             adm1022_detect ltc1710_detect gl525sm_detect); 
     217            adm1022_detect ltc1710_detect gl525sm_detect ddcmonitor_detect); 
    138218 
    139219# This is a list of all recognized chips.  
     
    173253     { 
    174254       name => "National Semiconductor LM78-J", 
    175        driver => "lm78", 
     255       driver => "", 
    176256       i2c_addrs => [0x00..0x68,0x6a..0x7f],  
    177257       i2c_driver_addrs => [0x20..0x2f],  
     
    354434       i2c_addrs => [0x58..0x5a], 
    355435       i2c_detect => sub { ltc1710_detect @_ }, 
     436     }, 
     437     { 
     438       name => "DDC monitor", 
     439       driver => "ddc-none-available-yet", 
     440       i2c_addrs => [0x50..0x57], 
     441       i2c_detect => sub { ddcmonitor_detect @_ }, 
    356442     }, 
    357443); 
     
    10951181        if (($conf,@chips) = &{$$chip{i2c_detect}} (\*FILE ,$addr)) { 
    10961182          print "Success!\n", 
    1097                 "    (confidence $conf, driver `$$chip{driver}'"; 
     1183                "    (confidence $conf, driver `$$chip{driver}')"; 
    10981184          if (@chips) { 
    10991185            print ", other addresses:"; 
     
    15951681  return (1); 
    15961682} 
    1597    
     1683 
     1684# $_[0]: A reference to the file descriptor to access this chip. 
     1685#        We may assume an i2c_set_slave_addr was already done. 
     1686# $_[1]: Address 
     1687# Returns: undef if not detected, (1) if detected. 
     1688# Registers used: 
     1689#   0x00..0x07: DDC signature 
     1690#   0x08..0x7E: checksumed area 
     1691#   0x7F:       checksum 
     1692# I hope my changes do not break anything... 
     1693sub ddcmonitor_detect 
     1694{ 
     1695  my ($file,$addr) = @_; 
     1696  my $i; 
     1697  for ($i = 0; $i < 8; $i ++) { 
     1698    i2c_set_slave_addr \*FILE,$addr+$i or goto FAILURE; 
     1699    i2c_smbus_read_byte_data($file,0x00) == 0x00 or goto FAILURE; 
     1700    i2c_smbus_read_byte_data($file,0x01) == 0xFF or goto FAILURE; 
     1701    i2c_smbus_read_byte_data($file,0x02) == 0xFF or goto FAILURE; 
     1702    i2c_smbus_read_byte_data($file,0x03) == 0xFF or goto FAILURE; 
     1703    i2c_smbus_read_byte_data($file,0x04) == 0xFF or goto FAILURE; 
     1704    i2c_smbus_read_byte_data($file,0x05) == 0xFF or goto FAILURE; 
     1705    i2c_smbus_read_byte_data($file,0x06) == 0xFF or goto FAILURE; 
     1706    i2c_smbus_read_byte_data($file,0x07) == 0x00 or goto FAILURE; 
     1707  } 
     1708  i2c_set_slave_addr \*FILE,$addr or return; 
     1709  # Check the checksum for validity. We should do this for all addresses, 
     1710  # but it would be too slow. 
     1711  my $checksum = 0; 
     1712  for ($i = 0; $i <= 127; $i = $i + 1) { 
     1713    $checksum = $checksum + i2c_smbus_read_byte_data($file,$i); 
     1714  } 
     1715  $checksum=$checksum & 255; 
     1716  if ($checksum != 0) { 
     1717    # I have one such monitor... 
     1718    return (2,$addr+1,$addr+2,$addr+3,$addr+4,$addr+5,$addr+6,$addr+7); 
     1719  } 
     1720  return (8,$addr+1,$addr+2,$addr+3,$addr+4,$addr+5,$addr+6,$addr+7); 
     1721FAILURE: 
     1722  i2c_set_slave_addr \*FILE,$addr; 
     1723  return; 
     1724} 
    15981725 
    15991726################