All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH] lm-sensors: add sch5027 support
@ 2008-02-01  6:42 Juerg Haefliger
  2008-02-03 21:12 ` Jean Delvare
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Juerg Haefliger @ 2008-02-01  6:42 UTC (permalink / raw)
  To: lm-sensors

[-- Attachment #1: Type: text/plain, Size: 128 bytes --]

This patch adds detection of the SMSC SCH5027 Super-IO to sensors-detect.

Signed-Off-By: Juerg Haefliger <juergh at gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: add-support-for-sch5027.patch --]
[-- Type: text/x-patch; name=add-support-for-sch5027.patch, Size: 3133 bytes --]

Index: lm-sensors-3/prog/detect/sensors-detect
===================================================================
--- lm-sensors-3.orig/prog/detect/sensors-detect	2008-01-31 22:39:29.000000000 -0800
+++ lm-sensors-3/prog/detect/sensors-detect	2008-01-31 22:39:38.000000000 -0800
@@ -1411,7 +1411,13 @@
        name => "SMSC DME1737",
        driver => "dme1737",
        i2c_addrs => [0x2c..0x2e],
-       i2c_detect => sub { dme1737_detect(@_); },
+       i2c_detect => sub { dme1737_detect(1, @_); },
+     },
+     {
+       name => "SMSC SCH5027D-NW",
+       driver => "dme1737",
+       i2c_addrs => [0x2c..0x2e],
+       i2c_detect => sub { dme1737_detect(2, @_); },
      },
      {
        name => "Fintek F75111R/RG/N (GPIO)",
@@ -1896,6 +1902,12 @@
 	logdev => 0x08,
       },
       {
+	name => "SMSC SCH5027D-NW Super IO",
+	# Hardware monitoring features are accessed on the SMBus
+	driver => "via-smbus-only",
+	devid => 0x89,
+      },
+      {
 	name => "SMSC SCH5307-NS Super IO",
 	driver => "smsc47b397",
 	devid => 0x81,
@@ -4342,7 +4354,9 @@
 {
   my ($vendor,$file,$addr) = @_;
   return if (i2c_smbus_read_byte_data($file,0x3e)) != $vendor ;
-  return if (i2c_smbus_read_byte_data($file,0x3f) & 0xf0) != 0x60;
+
+  my $verstep = i2c_smbus_read_byte_data($file,0x3f);
+  return if ($verstep & 0xf0) != 0x60;
 
   if ($vendor == 0x41) # Analog Devices
   {
@@ -4350,6 +4364,13 @@
     return (8);
   }
 
+  if ($vendor == 0x5c) # SMSC
+  {
+    # Return undef if this is a SCH5027
+    return if $verstep >= 0x69 and
+        i2c_smbus_read_byte_data($file, 0xba) == 0x0f;
+  }
+
   return (7);
 }
 
@@ -5166,21 +5187,34 @@
   return ($addr == 0x2d ? 6 : 5);
 }
 
-# $_[0]: A reference to the file descriptor to access this chip.
-# $_[1]: Address
+# $_[0]: Chip to detect
+#        (1 = DME1737, 2 = SCH5027)
+# $_[1]: A reference to the file descriptor to access this chip.
+# $_[2]: Address
 # Returns: undef if not detected, 5 or 6 if detected.
 # Registers used:
 #   0x3E: Manufacturer ID
 #   0x3F: Version/Stepping
 #   0x73: Read-only test register (4 test bits)
 #   0x8A: Read-only test register (7 test bits)
+#   0xBA: Read-only test register (8 test bits)
 sub dme1737_detect
 {
-  my ($file, $addr) = @_;
-  return unless i2c_smbus_read_byte_data($file, 0x3E) == 0x5c
-           and (i2c_smbus_read_byte_data($file, 0x3F) & 0xF8) == 0x88
-           and (i2c_smbus_read_byte_data($file, 0x73) & 0x0F) == 0x09
-           and (i2c_smbus_read_byte_data($file, 0x8A) & 0x7F) == 0x4D;
+  my ($chip, $file, $addr) = @_;
+  my $vendor = i2c_smbus_read_byte_data($file, 0x3E);
+  my $verstep = i2c_smbus_read_byte_data($file, 0x3F);
+
+  return unless $vendor == 0x5C; # SMSC
+
+  if ($chip == 1) { # DME1737
+      return unless ($verstep & 0xF8) == 0x88 and
+          (i2c_smbus_read_byte_data($file, 0x73) & 0x0F) == 0x09 and
+          (i2c_smbus_read_byte_data($file, 0x8A) & 0x7F) == 0x4D;
+  } elsif ($chip == 2) { # SCH5027
+      return unless $verstep >= 0x69 and $verstep <= 0x6F and
+          i2c_smbus_read_byte_data($file, 0xBA) == 0x0F;
+  }
+
   return ($addr == 0x2e ? 6 : 5);
 }
 

[-- Attachment #3: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-02-06 13:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-01  6:42 [lm-sensors] [PATCH] lm-sensors: add sch5027 support Juerg Haefliger
2008-02-03 21:12 ` Jean Delvare
2008-02-06 12:41 ` Rudolf Marek
2008-02-06 13:30 ` Michal Medvecký
2008-02-06 13:33 ` Juerg Haefliger
2008-02-06 13:43 ` Michal Medvecký
2008-02-06 13:46 ` Juerg Haefliger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.