summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgroeck <groeck@7894878c-1315-0410-8ee3-d5d059ff63e0>2014-06-26 14:37:22 +0000
committergroeck <groeck@7894878c-1315-0410-8ee3-d5d059ff63e0>2014-06-26 14:37:22 +0000
commitdd650f07f0770f7f8860e8ad377cee27f3b698be (patch)
tree609c94b8f69cf0096f4e5c05a3c13a35740316fb
parentae384a2516720984c9e652fb0d52a0964b687321 (diff)
downloadlm-sensors-dd650f07f0770f7f8860e8ad377cee27f3b698be.tar.gz
sensors-detect: Add detection of NCT7802Y
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6253 7894878c-1315-0410-8ee3-d5d059ff63e0
-rw-r--r--CHANGES1
-rwxr-xr-xprog/detect/sensors-detect46
2 files changed, 47 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 33909421..a16e7be3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,7 @@ SVN HEAD
Add detection of ITE IT8620E and IT8623E
Add detection of TMP441, TMP442, LM95233, LM95234,
and LM95235
+ Add detection of NCT7802Y
3.3.5 "Happy Birthday Beddy" (2014-01-22)
libsensors: Improve documentation of two functions
diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect
index 1208f4d9..9ce0cf2e 100755
--- a/prog/detect/sensors-detect
+++ b/prog/detect/sensors-detect
@@ -733,6 +733,11 @@ use vars qw(@i2c_adapter_names);
i2c_addrs => [0x2c..0x2f],
i2c_detect => sub { w83795_detect(@_); },
}, {
+ name => "Nuvoton NCT7802Y",
+ driver => "to-be-written",
+ i2c_addrs => [0x28..0x2f],
+ i2c_detect => sub { nct7802_detect(@_); },
+ }, {
name => "Winbond W83627HF",
driver => "use-isa-instead",
i2c_addrs => [0x28..0x2f],
@@ -5483,6 +5488,47 @@ sub w83795_detect
}
# Registers used:
+# 0x00: Bank selection (Bank 0, 1)
+# 0x05: Temperature readout register LSB (Bank 0)
+# 0x08: PECI temperature readout register LSB (Bank 0)
+# 0x0f: Voltage readout register LSB (Bank 0)
+# 0xfd: Vendor ID (Bank 0)
+# 0xfe: Device ID (Bank 0)
+# 0xff: Device Revision (Bank 0)
+#
+# Note that identification registers are not accessible in bank 1,
+# and there is no usable other means to identify the chip if bank 1
+# is selected. Only detect chip if bank 0 is selected.
+sub nct7802_detect
+{
+ my ($bank, $reg);
+ my ($file, $addr) = @_;
+
+ $bank = i2c_smbus_read_byte_data($file, 0x00);
+ return unless $bank == 0x00;
+
+ $reg = i2c_smbus_read_byte_data($file, 0xfd);
+ return unless $reg == 0x50;
+
+ $reg = i2c_smbus_read_byte_data($file, 0xfe);
+ return unless $reg == 0xc3;
+
+ $reg = i2c_smbus_read_byte_data($file, 0xff);
+ return unless ($reg & 0xf0) == 0x20;
+
+ $reg = i2c_smbus_read_byte_data($file, 0x05);
+ return unless ($reg & 0x1f) == 0x00;
+
+ $reg = i2c_smbus_read_byte_data($file, 0x08);
+ return unless ($reg & 0x3f) == 0x00;
+
+ $reg = i2c_smbus_read_byte_data($file, 0x0f);
+ return unless ($reg & 0x3f) == 0x00;
+
+ return 8;
+}
+
+# Registers used:
# 0x48: Full I2C Address
# 0x4e: Vendor ID byte selection
# 0x4f: Vendor ID