Changeset 5684

Show
Ignore:
Timestamp:
03/13/09 09:41:19 (6 years ago)
Author:
khali
Message:

Add Nuvoton W83795G/ADG detection. Original patch from Wei Song (Nuvoton).

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r5681 r5684  
    77                  Differentiate between PC8374L and WPCD377I 
    88                  Use dmidecode to find IPMI interfaces if available 
     9                  Add Nuvoton W83795G/ADG detection 
    910 
    10113.1.0 "Happy Birthday Lina" (2009-02-28) 
  • lm-sensors/trunk/prog/detect/sensors-detect

    r5683 r5684  
    649649                i2c_detect => sub { w83793_detect(@_); }, 
    650650        }, { 
     651                name => "Nuvoton W83795G/ADG", 
     652                driver => "w83795", 
     653                i2c_addrs => [0x2c..0x2f], 
     654                i2c_detect => sub { w83795_detect(@_); }, 
     655        }, { 
    651656                name => "Winbond W83627HF", 
    652657                driver => "use-isa-instead", 
     
    43574362        push @res, (($reg & 0x70) >> 4) + 0x48 unless $reg & 0x80; 
    43584363        return @res; 
     4364} 
     4365 
     4366# Registers used: 
     4367#   0xfc: Full I2C Address 
     4368#   0x00: Vendor ID byte selection, and bank selection(Bank 0, 1, 2) 
     4369#   0xfd: Vendor ID(Bank 0, 1, 2) 
     4370#   0xfe: Device ID(Bank 0, 1, 2) 
     4371sub w83795_detect 
     4372{ 
     4373        my ($bank, $reg); 
     4374        my ($file, $addr) = @_; 
     4375 
     4376        $bank = i2c_smbus_read_byte_data($file, 0x00); 
     4377        $reg = i2c_smbus_read_byte_data($file, 0xfd); 
     4378 
     4379        return unless (($bank & 0x80) == 0x00 and $reg == 0xa3) or 
     4380                      (($bank & 0x80) == 0x80 and $reg == 0x5c); 
     4381 
     4382        $reg = i2c_smbus_read_byte_data($file, 0xfe); 
     4383        return if $reg != 0x79; 
     4384 
     4385        # If bank 0 is selected, we can do more checks 
     4386        return 6 unless ($bank & 0x07) == 0; 
     4387        $reg = i2c_smbus_read_byte_data($file, 0xfc) & 0x7f; 
     4388        return unless ($reg == $addr); 
     4389 
     4390        return 8; 
    43594391} 
    43604392